On Sat, 22 Oct 2011, Felipe Monteiro de Carvalho wrote:
ugh, any ideas how I can obtain the next sequence value using sqldb and postgres then? I have never used sequence values before, and while I am googling I only found either answers which are specific for a particular framework (java, djambo, whatever) or people claiming that it should generate the index automatically! o.O Which clearly it is not doing... I couldn't yet get a generic answer using SQL supported by Postgres, or whatever thing which I could reuse in sqldb.
Just a use a TSQLQuery: With TSQLQuery.Create(Self) do try Database:=MyDatabase; Transaction:=MyTransaction; // Replace sequencename with the correct name of the sequence SQL.Text:='SELECT nextval(''sequencename'')'; Open; TheNewID:=(Fields[0] as TLargeIntField).AsLargeInt; close; finally free; end; That's it. Michael. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal