Hoi zäme,
databaseManager.copyMatchingColumns(srcRecord,destRecord, true) doesn’t copy the PK (the id with auto_incremen).
Even if i try to solve the problem with destRecord.id = srcRecord.id
an then save with databaseManager.saveData()
the destination db is empty, but it creates a record with the next higer id in the sequenz of the last Record earlier.
What can i do ?
thanks for a answer
Sandro Stefanoni
http://www.gigdoodle.ch
you mean with auto_increment that it is a database identity column?
We dont insert those values. Because it is a value that the database will generate.
Look for example on the admin pages, performance data page, when you insert such a row, does the insert statement that is there listed, include the pk column?
I guess not and that is because of the db_ident.
Oh yes you are right. This was my error in reasoning.
Thanke you much
Sandro
if interests somebody, my solution now works fine (mysql):
// drop the autoincrement
var x='ALTER TABLE ' + Tabname + ' CHANGE COLUMN id id INT(10) UNSIGNED NULL FIRST'
globals.myRawSql(ServNam,Tabname,x)
... do my loop to copy records.... then globals.mySaveData()
// set the new autoincrement
var x='ALTER TABLE ' + Tabname + ' CHANGE COLUMN id id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT FIRST'
globals.myRawSql(ServNam,Tabname,x)
var x='ALTER TABLE ' + Tabname + ' AUTO_INCREMENT=1' // autoincrement set automaticaly to the highest id
globals.myRawSql(ServNam,Tabname,x)