ERROR using UpdateHandler

User ffb6e86569

01-05-2007 06:21:05

Dear support:





There're some columns using the reserved word suchlike 'As','In' in my table,so i used it like this:


Code:
......


UpdateHandler uh = new UpdateHandler(conh,UpdateHandler.UPDATE,"mytable","dictionary.As,dictionary.In");


uh.setStructure(mol);


uh.setID(Integer.parseInt(cdid));


uh.setValueForAdditionalColumn(1, as);


uh.setValueForAdditionalColumn(2, in);


......






and then i got this exception:
Quote:
java.sql.SQLException: ERROR: field "MYTABLE.AS" is not present in table "MYTABLE".


at chemaxon.jchem.db.UpdateHandler.getField(UpdateHandler.java:1543)


at chemaxon.jchem.db.UpdateHandler.setAdditionalColumns(UpdateHandler.java:1417)


at chemaxon.jchem.db.UpdateHandler.setFields(UpdateHandler.java:1323)


at chemaxon.jchem.db.UpdateHandler.execute(UpdateHandler.java:1908)


......


even i quote them like


Code:
UpdateHandler uh = new UpdateHandler(conh,UpdateHandler.UPDATE,"mytable","'As','In'");



it didn’t solve the problem.





does it mean that just using the colums name which is indentified


in database?


would you tell me the way to fix it?


and is it be considered for future versions?

ChemAxon e274e1bada

02-05-2007 13:46:01

Hi Xiao,





Could you give me your JChem version name and type/version of your database server?





Edvard

User ffb6e86569

02-05-2007 14:37:34

Hi,Edvard





My JChem base version is 3.2.4 and the db server is mysql v5.1.


but the exception was thrown by JChem,and i think in "setAdditionalColumns()"
Quote:
chemaxon.jchem.db.UpdateHandler.setAdditionalColumns(UpdateHandler.java:1417)
should compare "AdditionalColumn" name with the field name without alias which JChem got from db.





thanks

ChemAxon 9c0afc9aaf

02-05-2007 19:42:34

Hi,





- The field list argument is not processed by any SQL interpreter, you should specify plain field names without the table name.





- JChem does not support reserved words or strings containing special characters for identifiers.


Taking care of this in all affected code would only increase code complexity without any real benefit, so currently we do not plan to solve this (unless there is a compelling reason for it).





- I suggest renaming your fields





- We will update the documentation to mention these facts.





Best regards,





Szilard

User ffb6e86569

03-05-2007 02:03:37

Thanks


i will rename the fields.





best regards





dengxiao