Re: [gnome-db] Getting gnome-db to work with postgres 7.2
- From: Joseph Wang <joe confucius gnacademy org>
- To: Rodrigo Moya <rodrigo gnome-db org>
- Cc: gnome-db-list gnome org
- Subject: Re: [gnome-db] Getting gnome-db to work with postgres 7.2
- Date: Sun, 21 Apr 2002 01:03:30 -0500
hmm, this will break pre-7.2 support, since in pre-7.2 versions, that
query works, and really returns the comments for that field, so, I'm
afraid we can't accept your patch :-(
What about this. It displays the comments for pre-7.2 but skips them
for post-7.2
---
libgda-0.2.96/providers/gda-postgres-server/gda-postgres-connection.c.pg72
2002-02-19 12:17:20.000000000 -0600
+++
libgda-0.2.96/providers/gda-postgres-server/gda-postgres-connection.c
2002-04-21 00:47:00.000000000 -0500
@@ -899,11 +899,15 @@
GdaServerCommand *cmd;
GdaServerRecordset *recset = 0;
GDA_Connection_Constraint *ptr;
+ POSTGRES_Connection *pc;
gulong affected;
gchar *table_qualifier = 0, *table_owner = 0, *table_name = 0,
*column_name = 0;
gchar *query;
+ pc = (POSTGRES_Connection *)
+ gda_server_connection_get_user_data (cnc);
+
/* get table name */
ptr = constraint;
while (length) {
@@ -946,7 +950,7 @@
fprintf (stderr, "schema_columns: table name is null\n");
return (0);
}
-
+ if (pc->version < 7.2) {
query = g_strdup_printf ("SELECT b.attname AS \"Name\", "
"c.typname AS \"Type\", "
"textcat(b.attlen, textcat('/', b.atttypmod)) "@@
-965,7 +969,25 @@
"AND b.attnum > 0 "
"ORDER BY b.attnum", table_name,
table_name, table_name);
-
+ } else {
+ query = g_strdup_printf ("SELECT b.attname AS \"Name\", "
+ "c.typname AS \"Type\", "
+ "textcat(b.attlen, textcat('/', b.atttypmod)) "+
"AS \"Size\", "
+ "0 AS \"Precision\", "
+ "NOT(b.attnotnull) AS \"Nullable\", "
+ "textcat('%s ', b.attnum) AS \"Key\", "
+ "textcat('%s ', b.attname) AS \"Default Value\" "
+ "FROM pg_type c, "
+ "pg_attribute b, "
+ "pg_class a "
+ "WHERE a.relname = '%s' "
+ "AND b.attrelid = a.oid "
+ "AND c.oid = b.atttypid "
+ "AND b.attnum > 0 "
+ "ORDER BY b.attnum", table_name,
+ table_name, table_name);
+ }
/* build the command object */
cmd = gda_server_command_new (cnc);
gda_server_command_set_text (cmd, query);
--
-------------------------------------------------------------------------------
Joseph Wang Ph.D. Globewide Network Academy
president gnacademy org FREE Distance Education catalog database
http://www.gnacademy.org Over 30,000 courses and degrees
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]