pragma
Joined: 28 May 2004 Posts: 607 Location: Washington, DC
|
Posted: Mon Dec 04, 2006 9:31 pm Post subject: Postgres bugs and issues |
|
|
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 |
|