On Fri, 2006-10-06 at 14:33 +0300, Adrian Maier wrote: > On 10/6/06, Adrian Maier <[EMAIL PROTECTED]> wrote: > > On 10/6/06, Adrian Maier <[EMAIL PROTECTED]> wrote: > > > On 10/5/06, Joost van der Sluis <[EMAIL PROTECTED]> wrote: > > > > > > > I'm using Sqldb to access a PostgreSQL database. Is it possible > > > > > > > to find out > > > > > > > easily what sql commands is sqldb generating and trying to > > > > > > > execute ? > > > > > > > > > > > > > > I have a DBgrid which is associated to a table. > > > > > > > After updating a row and executing query.ApplyUpdates , the > > > > > > > program generates > > > > > > > an exception : > > > > > > > "An error occurred while applying the updates in a query: > > > > > > > preparation of query > > > > > > > failed. (PostgreSQL: ERROR: syntax error at end of input at > > > > > > > character 132). " > > > > > > > > > > > > > > > What you could do: compile the sqldb-unit with debuginfo and place a > > > > breakpoint on line 1181. And then take a look at qry.sql.text. Or simply > > > > place a 'writeln(qry.sql.text);' on that line. Recompile fpc and try > > > > again... > > > > > > I was hoping that recompiling sqldb wasn't neccessary . But if there's no > > > other way ... > > > > > > I have added some writelns inside pqconnection.pp just before the > > PQexec calls. > > The query that causes the error is : > > > > ' prepare prepst2 (int,int,numeric,text,int,text,int) as update PROD > > set mag=$1,cod=$2,pu=$3,den=$4,p_vinz=$5,um=$6,stoc_ini=$7 where ' > > > > Which is incomplete... It looks liek it wasn't able to detect the columns > > that > > form the primary key. This table has a PK made up of 3 columns. > > > Can sqldb handle multi-column primary keys ? > Apparently it doesn't :-( or it doesn't work for postgres.
Indeed. Somewhere in the code there's a comment like: 'ToDo: Multiple fields-indexes should be parsed here...' > Replacing the 3-columns primary key with a single-column primary key caused > the problem to disappear. Could you write a bug-report for it? Also mention that it should generate an error, if something like this happens. Instead of sending incomplete requests to the db-server. As a temporary solution you can do: sqlquery1.updatesql := 'update PROD set mag=$1,cod=$2,pu=$3,den= $4,p_vinz=$5,um=$6,stoc_ini=$7 where ...'; But then complete, offcourse. That way it doesn't try to generate the update-query automatically, but it uses the query that you provide. -- Met vriendelijke groeten, Joost van der Sluis CNOC Informatiesystemen en Netwerken http://www.cnoc.nl _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
