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). " > > Enabling the statement logging in postgres doesn't help in this case, > because the > sql command is not recognised at all, and therefore it doesn't show > up in the log.
It's more then 132 characters long, so it should be in the log?
The size is not important. I meant that i've configured postgres to write in the log all the queries that are executed, for debugging. Yet, the query which generates the error is not recognized as a query at all, and only the error appears in the log.
Since it's with applyupdates. The SQL is probably parsed incorrectly. You can look what the updatequery.sql, modifyquery.sql etc. are. Maybe that that already reviels the problem.
I'm afraid that i still don't understand how can I see those queries. What/where are the update.sql, modifyquery.sql that you are referring to? In the program i have the following variables: - Fconnection : tSQLConnection; - Ftransaction : tSQLTransaction; - query1: TSQLQuery; - ds1: TDatasource; - DBGrid1: TDBGrid; - DBNavigator1: TDBNavigator; The initialisation: CreateFConnection; CreateFTransaction; ds1.Enabled:=false; query1.Active:=false; Fconnection.Transaction:=Ftransaction; query1.DataBase:=Fconnection; query1.Transaction:=Ftransaction; query1.SQL.Clear; query1.SQL.Add('select DEN,CNP,C_FISCAL,LOC,REG_COM,JU,CONT,BANCA,ADR,COD_SOC from SOC_M'); query1.Active:=true; DBGrid1.DataSource:=ds1; ds1.DataSet:=query1; ds1.Enabled:=true; DBGrid1.Enabled:=true; The user updates some values in the grid, and then presses a button that does : query1.ApplyUpdates; <--- the exception is generated here Ftransaction.CommitRetaining; I use identical code for other two tables - and updating works ! I have no idea what is different about this table. Cheers, Adrian Maier _________________________________________________________________ To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe" as the Subject archives at http://www.lazarus.freepascal.org/mailarchives