DBManager executeUpdate and null values

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

Post Reply
jgrotto
Posts: 5
Joined: 29 Jan 2012, 17:21

DBManager executeUpdate and null values

Post 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!
rutabuga
Posts: 4
Joined: 06 Jun 2011, 18:50

Post 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);
jgrotto
Posts: 5
Joined: 29 Jan 2012, 17:21

Post 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.
Post Reply