[gnome-db] Patch Postgres provider.



Hello,

Attached a patch for the postgres provider. I can't find any "patch instructions" on your web pages, so not sure about the procedure, so please advise if it is not conform the rules.

Anyway, when using gda_data_model_append_row and a column name is a reserved name like "desc" or "typeid", the INSERT query is unsuccessful and returns an error. What this patch does is place " arround the column names. So:

INSERT INTO parts(part_id, desc, price) VALUES (123, 'Test', 12.34)

becomes

INSERT INTO parts("part_id", "desc", "price") VALUES (123, 'Test', 12.34)

and all works fine.

Sure, it is probably not a good idea to use reserved names for column names, but people will be using them not knowing that some names are special.

Thanks,
Bas.

--- gda-postgres-recordset.c.orig	2004-10-27 16:42:05.230033967 +1000
+++ gda-postgres-recordset.c	2004-10-27 16:42:20.546698434 +1000
@@ -261,7 +261,9 @@
 
 		if (i != 0)
 			sql = g_string_append (sql, ", ");
+		sql = g_string_append (sql, "\"");
 		sql = g_string_append (sql, gda_field_attributes_get_name (fa));
+		sql = g_string_append (sql, "\"");
 	}
 	sql = g_string_append (sql, ") VALUES (");
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]