I am trying to store a c++ byte array in a mySQL binary(16) field.
mysqlTable is an instance of mysqlx::Table class that works OK with other variable types.
data -> is the table field name of type binary(16)
data1 -> is the table field name of type binary(1)
What I have tried so far:
unsigned char cArray[16];
mysqlTable.insert("data").values(cArray).execute();
I have also tried:
unsigned char * pcArray = new unsigned char[16];
mysqlTable.insert("data").values(pcArray).execute();
And this works just fine:
unsigned char cOneChar;
mysqlTable.insert("data1").values(cOneChar).execute();
The error I get is form the compiler:
see reference to function template instantiation 'mysqlx::TableInsert &mysqlx::TableInsert::values<BYTE*>(BYTE *)' being compiled
error C2783: 'void mysqlx::internal::Args_processor<mysqlx::internal::Table_insert_detail::Add_value,mysqlx::internal::Table_insert_detail::Add_value::Impl *>::process_args(D,C)': could not deduce template argument for '__formal'
with
[
D=mysqlx::internal::Table_insert_detail::Add_value::Impl *
]
Does anyone know how to do this?
cArraydoesn't carry any information about how big it is, at the very least you'd need to pass a size parameter as well. Check the documentation.winapitag.