jormah
Posts: 10
|
Posted: 07/19/2004, 11:08 AM |
|
Hi,
In CCS I have Java command:
String sqlStr = ((RawCommand)e.getCommand()).getSqlString();
Which returns:
UPDATE PROJECT SET PROJ_DEPT = '100', PROJ_TYPE = 9, PROJ_NO = '3525 ', PROJ_NAME = 'Karjaa-Hanko kauko-ohjauslaitteiden rakentaminen jne...', TEAM_LEADER = 101, PROJ_START_DATE = '10.04.2000', PROJ_STOP_DATE = '31.10.2000', STATUS = 10, PROJ_ACCOUNT = 'tp3525xxx', PROJ_AGREEMENT = NULL, PROJ_AGR_DESC = NULL, PROJ_CONTRACT = 5, CONTRACT_DESC = NULL, PROJ_CON_DESC = ? , CUST_NO = 1132, CUST_REF = 'P56 Kokkolaan!', CUST_DESC = ? , PROJ_DESC = ? , PROJ_GOAL = ? , PROJ_SCOPE = ? , PROJ_WAR_DESC = ? , STATUS_CHG_DESC = ? , STATUS_CHG_DATE = '19.07.2004', STATUS_CHG_EMP = 101, PROJ_FLAGS = 1 WHERE PROJ_ID = 34
When I try to INSERT this into the database:
String insertStr = "'" + datenewformat + "', " + user + ", '" + ip + "', '" + module + "', '" + operation + "', '" + sqlOp + "', '" + error + "', '" + desc + "'";
String sql = "INSERT INTO LOGGER ( L_TIME, L_USER, L_IP, L_MODULE, L_OPERATION, L_SQL, L_ERROR, L_DESC ) VALUES (" + insertStr + " )";
Nothing happens, no errors, no insert.
But, when I change string sqlOp to
String sqlOp = "something";
everything is ok.
Database is Interbase/Firebird 1.5
And L_SQL datatype BLOB 1024, type 1 (text)
I also try VARCHAR(255) and sqlOp.substring(0,250);
What's the problem with RawCommand ??
Regards,
Jorma Hytonen
_________________
Jorma Hytonen
Mipro Oy, Finland |
|
|
ignat
Posts: 55
|
Posted: 07/26/2004, 6:28 AM |
|
Jorma,
I think you need to escape special characters in your sqlOp variable to get a valid SQL.
Regards,
Ignat.
|
|
|
Anton Hinxman
|
Posted: 07/29/2004, 12:46 AM |
|
I always use
DBTools.toSql( ""+ thetext,JDBCConnection.TEXT,"MYDB")
or any parameter combination of:
JDBCConnection.INTEGER
JDBCConnection.FLOAT
JDBCConnection.NUMERIC
JDBCConnection.DATE
JDBCConnection.BOOLEAN
JDBCConnection.TEXT
JDBCConnection.MEMO
and thus have never suffered these problems and the generated sql is then portable between databases - as set in the project.
|
|
|
|