[Gambas-user] gb.db local change

Benoit Minisini benoit.minisini at gambas-basic.org
Fri Dec 9 14:08:25 CET 2022


Le 09/12/2022 à 09:14, BB a écrit :
> 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"))
> 
>   				void_buffer(THIS);
> 
> 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.
> 
> bruce
> 
> 
> 
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----

What does this "RETURNING" thing do exactly?

-- 
Benoît Minisini.



More information about the User mailing list