I am using mysql-x-devapi and need to insert a row to a table and put UNIX_TIMESTAMP()
of the server in a column:
sql_client_.getSession().getDefaultSchema()
.getTable("event")
.insert("title", "time")
.values("event title", "UNIX_TIMESTAMP()")
.execute();
This code gives me: CDK Error: Incorrect integer value 'UNIX_TIMESTAMP()' for column 'time' at row 1
How can I do this using xdevapi (not sql command that needs sql string)?
I am able to use mysqlx::expr("UNIX_TIMESTAMP()")
in set
function when updating the table. The same doesn't work with insert
and fails with the following error:
/usr/include/mysql-cppconn-8/mysqlx/devapi/table_crud.h:157:17: error: ‘mysqlx::abi2::r0::internal::Expression::Expression(V&&) [with V = mysqlx::abi2::r0::internal::Expression&]’ is private within this context
157 | add_values(get_impl(), rest...);