~ubuntu-branches/ubuntu/utopic/libgda5/utopic

« back to all changes in this revision

Viewing changes to libgda/gda-meta-struct.c

  • Committer: Package Import Robot
  • Author(s): Michael Biebl
  • Date: 2012-02-10 13:43:47 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120210134347-pnhy092ghuopf2gm
Tags: 5.0.3-1
* New upstream release.
* Add symbols file for libgda-5.0-4.

Show diffs side-by-side

added added

removed removed

Lines of Context:
933
933
        }
934
934
        case GDA_META_DB_TABLE: {
935
935
                /* columns */
936
 
                gchar *sql = "SELECT c.column_name, c.data_type, c.gtype, c.is_nullable, t.table_short_name, t.table_full_name, c.column_default, t.table_owner, c.array_spec, c.extra, c.column_comments FROM _tables as t LEFT NATURAL JOIN _columns as c WHERE table_catalog = ##tc::string AND table_schema = ##ts::string AND table_name = ##tname::string ORDER BY ordinal_position";
 
936
                gchar *sql = "SELECT c.column_name, c.data_type, c.gtype, c.is_nullable, t.table_short_name, t.table_full_name, c.column_default, t.table_owner, c.array_spec, c.extra, c.column_comments, coalesce (c.character_maximum_length, c.character_octet_length) FROM _tables as t LEFT NATURAL JOIN _columns as c WHERE table_catalog = ##tc::string AND table_schema = ##ts::string AND table_name = ##tname::string ORDER BY ordinal_position";
937
937
                GdaMetaTable *mt;
938
938
                GdaDataModel *model;
939
939
                gint i, nrows;
981
981
                for (i = 0; i < nrows; i++) {
982
982
                        GdaMetaTableColumn *tcol;
983
983
                        const gchar *cstr = NULL;
 
984
                        gint len = -1;
984
985
                        tcol = g_new0 (GdaMetaTableColumn, 1); /* Note: tcol->pkey is not determined here */
985
986
                        mt->columns = g_slist_prepend (mt->columns, tcol);
986
987
 
992
993
                        if (!cvalue) goto onerror;
993
994
                        if (!gda_value_is_null (cvalue))
994
995
                                cstr = g_value_get_string (cvalue);
995
 
                        if (cstr && *cstr)
996
 
                                tcol->column_type = g_strdup (cstr);
 
996
 
 
997
                        cvalue = gda_data_model_get_value_at (model, 11, i, error);
 
998
                        if (!cvalue) goto onerror;
 
999
                        if (!gda_value_is_null (cvalue))
 
1000
                                len = g_value_get_int (cvalue);
 
1001
 
 
1002
                        if (cstr && *cstr) {
 
1003
                                if (len >= 0)
 
1004
                                        tcol->column_type = g_strdup_printf ("%s (%d)", cstr, len);
 
1005
                                else
 
1006
                                        tcol->column_type = g_strdup (cstr);
 
1007
                        }
997
1008
                        else {
998
1009
                                cvalue = gda_data_model_get_value_at (model, 8, i, error);
999
1010
                                if (!cvalue) goto onerror;
1845
1856
 * Get a list of all the #GdaMetaDbObject structures representing database objects in @mstruct. Note that
1846
1857
 * no #GdaMetaDbObject structure must not be modified.
1847
1858
 *
1848
 
 * Returns: (transfer container) (element-type Gda.MetaObject): a new #GSList list of pointers to #GdaMetaDbObject structures which must be destroyed after usage using g_slist_free(). The individual #GdaMetaDbObject must not be modified.
 
1859
 * Returns: (transfer container) (element-type Gda.MetaDbObject): a new #GSList list of pointers to
 
1860
 * #GdaMetaDbObject structures which must be destroyed after usage using g_slist_free(). The individual
 
1861
 * #GdaMetaDbObject must not be modified.
1849
1862
 */
1850
1863
GSList *
1851
1864
gda_meta_struct_get_all_db_objects (GdaMetaStruct *mstruct)