>>>>> "Paul" == Paul J Stevens <[EMAIL PROTECTED]> writes:

Paul> me no like much.

OK.

Paul> Something like this

Paul> char * db_returning(const char *field)
Paul> {
Paul>   static int bufno;
Paul>   static char fragbuffers[4][DEF_FRAGSIZE];
Paul>   char *fragment = fragbuffers[3 & ++bufno], *frag = fragment;

Paul>   snprintf(frag, DEF_FRAGSIZE, db_get_sql(SQL_RETURNING), field);
Paul>   return fragment;
Paul> }

I'll have to study db_get_sql and this a bit to get my head around it; I
haven't yet had occasion to read that funtion....

Paul> The current patch returns allocated NULL strings! not good :-) A good
Paul> way to return an empty allocated string would be 'return g_strdup("")'

I'll make that change.

I also found 3 bugs which have been corrected:  I forgot that the
physmessage's primary key is called id rather than physmessage_idnr,
I somehow missed the INSERT into headername, and (brown paper bag time)
the bufferlen for dbpdsql.c's db_returning() has to be 10+strlen(query)+1
rather than 10+strlen(query).  (10 for "RETURNING " and 1 for the NULL....)

To browse the patch as it continues to evolve, go to:

http://cgit.freedesktop.org/~cloos/dbmail/commit/?h=pgfix22

(See my next post for some more details.)

-JimC
-- 
James Cloos <[EMAIL PROTECTED]>         OpenPGP: 1024D/ED7DAEA6
_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://twister.fastxs.net/mailman/listinfo/dbmail-dev

Reply via email to