MySQL Forums
Forum List  »  Connector/C++

Binding NULL in a prepared statement
Posted by: Sagun Khosla
Date: January 27, 2019 10:55AM

Hello,

I'm trying to bind NULL for a nullable datetime column using a prepared statement as follows -

session.sql("UPDATE `table` SET `datetime` = ? WHERE `id` = 1").bind(NULL).execute();

This crashes.

Passing null as string gives the following error - "Invalid value for datetime column: 'null'"

How do I achieve this?

Options: ReplyQuote


Subject
Views
Written By
Posted
Binding NULL in a prepared statement
1888
January 27, 2019 10:55AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.