FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Postgres bugs and issues

 
Post new topic   Reply to topic     Forum Index -> DDBI
View previous topic :: View next topic  
Author Message
pragma



Joined: 28 May 2004
Posts: 607
Location: Washington, DC

PostPosted: Mon Dec 04, 2006 9:31 pm    Post subject: Postgres bugs and issues Reply with quote

Howdy all!

I've been using DDBI to manipulate Postgres database data recently. So far, I have few complaints, as DDBI has allowed me to do a great wealth of things with very little fuss.

The only bugs I've unearthed so far are:

  • The documentation in PgDatabase shows semicolons for separating connection-string params. Postgres uses whitespace instead.
  • There is a subtle bug with passing query strings to the query() and execute() routines - they expect that the string passed is already zero terminated.

The last one is not covered in the unittest. I stumbled into this when I first tried aggregating arguments into my query strings.

Code:

pgdb.query("SELECT * FROM employees"); //works
pgdb.query("SELECT * FROM employees WHERE firstname = '" ~ "pragma" ~ "'"); // may or may not work


I haven't tried this via Statement, but at first glance at the code, I don't see '\0' or 'tostringz()' so I assume it has the same problem.

Anyway, changing lines 132 and 153 in PgDatabase.d, to the following, seems to do the job:
Code:
PGresult* res = PQexec(connection, sql.dup ~ "\0");


Now if the changes discussed in the DNG go through, regarding implicit casts from char[] to char*, then the following form is needed:

Code:
PGresult* res = PQexec(connection, (sql.dup ~ "\0").ptr);

_________________
-- !Eric.t.Anderton at gmail
Back to top
View user's profile Send private message Yahoo Messenger
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DDBI All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group