[Gambas-user] gb.db local change

BB adamnt42 at gmail.com
Fri Dec 9 09:14:50 CET 2022

I need a bit of help here. In our local version of the interpreter I 
want to implement a "small" change to use the "RETURNING *" optional SQL 
command. This works fine for postgresql but not for sqlite (at this 
stage of debian's distros). I understand (I'm pretty sure) the object 
model but I can't write the C code.

Within the following patch I want to test the "THIS->conn->" database 
type and only include the RETURNING clause if its a PostgreSQL database 
we are talking to.

+++ b/main/lib/db/CResult.c

@@ -716,7 +716,7 @@ BEGIN_METHOD_VOID(Result_Update)



  			q_add(" )");

+			q_add(" RETURNING * ");              <----- but only if PostgreSQL

  			if (!THIS->driver->Exec(&THIS->conn->db, q_get(), NULL, "Cannot create record: &1"))


This is a LOCAL change as the RETURNING clause is not universally 
supported. In fact I'm not sure if it is conformant to the SQL standard, 
but we really need it here.

I have had many tries at working this out but have had no success.

Can anyone help me here, please.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20221209/9f2e80f1/attachment-0001.htm>

More information about the User mailing list