Page 1 of 1

DBManager executeUpdate and null values

Posted: 29 Jan 2012, 17:33
by jgrotto
Is it possible to send null values as a argument to a insert/update using the executeUpdate method of the SFS Database Manager. The database field is set to allow null values. Sending a Java null results in a NullPointerException.

Thanks!

Posted: 29 Jan 2012, 18:13
by rutabuga
you mean like this, the following code sets all second names in table to NULL

Code: Select all

sql = "UPDATE `table` SET `secondname`= ?;
    			
    	Object[] array = new Object[1];
    	array[0] = null;
    	dbManager.executeUpdate(sql, array);

Posted: 29 Jan 2012, 19:11
by jgrotto
Thanks... I will try that.

For whatever reason, that didn't seem to work in my tests, but I'll give it a try.