Author | Topic: autoincrement seems not to work. | |
---|---|---|
Sander Elias | autoincrement seems not to work. on Wed, 18 Mar 2015 10:22:31 +0100 Hi All, Hi All, Did I miss out on something? If I use PGDB and create an DB with 'S' field it should be auto increment right? In the below sample, all id's are 0. Did I overlook something? #include "sqlcmd.ch" function sqlExperiment() local cConnStr := "DBE=pgdbe;" local oSession := nil local i := 0 cConnStr += "UID=postgres;" cConnStr += "PWD=postgres;" cConnStr += "SRV=localhost;" cConnStr += "DB=xppsamples;" oSession := dacSession():new(cConnStr) oSession:connect() //sql "drop table todo" drop the table, I'm just experimenting with this. dbcreate("todo", todoStruct()) TODO: check for existing DB's use todo new alias td for i = 1 to 10 dbAppend() td->short := "Short test"+strZero(i) next Browse() all id's seem to be 0, S is suposed to be an autoicrement? oSession:disconnect() return nil function todoStruct() return { ; { "id" , 'S', 8, 1 }, ; { "short" , 'Z', 128, 0 }, ; { "long" , 'V', 128, 0 }, ; { "parent", 'I', 8, 0 } ; } PROCEDURE dbesys DbeLoad("PGDBE") DbeSetDefault( "PGDBE" ) RETURN Regards Sander Elias -------------------------------------------- also a member off the XXP (http://www.xxp.nl) |