Our solution, which uses dbidentity incrementing primary keys has started issuing these types of errors under 3.5.7 when new records are created:
2008-09-29 21:30:05,437 ERROR [AWT-EventQueue-0] com.servoy.j2db.util.Debug - Select Count(id_panel_members) From panel_members Where id_panels = DbIdentValue1033057
java.sql.SQLException: Unknown column ‘DbIdentValue1033057’ in ‘where clause’
2008-09-29 22:25:23,623 ERROR [AWT-EventQueue-0] com.servoy.j2db.util.Debug - Select id_assignments From assignments Where id_panel_members = DbIdentValue10220320
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column ‘DbIdentValue10220320’ in ‘where clause’
These queries are custom methods which either count related record sets or look up various foreign keys, fired most often on create of new records, and had no issue up to and under 3.5.6.
Was there a change in behavior on how or when Servoy accesses db-managed primary key values for new records?
The DbIdentValue1033057 represents a placeholder for a db-identity value for a record that has not been saved yet (in the case of db-identity the value is not known until the record is inserted)
When auto-save is off and related values or calculations are queried, the sql cannot be executed yet because the value is not known yet.
When you compose custom sql by concatenating strings and columns you will get this error for db identity columns.
The ‘toString’ of the identity columns will always be something like DbIdentValuexxxxx.
You will need to use the question marks method and pass the column in the args:
databaseManager.getDataSetByQuery(server, "Select Count(id_panel_members) From panel_members Where id_panels = ?", [identcolumn])
Note that when the record has not been saved yet, this will still fail (the new value is not known yet)
The reason this comes up now is that in 3.5.7 there was a fix for identity columns in scripting (before always null was returned which was wrong)