I'm using Mariadb C api. Can I have an example of binding BIT type data? I can't find any of such examples on the Internet.
Here is part of my code
char** test_data = new char*[2];
test_data[0] = new char{'0'};
test_data[1] = new char{'1'};
MYSQL_BIND *bind = new MYSQL_BIND;
bind->buffer_type = MYSQL_TYPE_BIT;
bind->buffer = test_data;
mysql_stmt_attr_set(insertStmt, STMT_ATTR_ARRAY_SIZE, &numRows);
mysql_stmt_bind_param(insertStmt, bind);
mysql_stmt_execute(insertStmt);
The program crashes when executing the code.
I also tried
char** test_data = new char*[2];
test_data[0] = new char{'0'};
test_data[1] = new char{'1'};
MYSQL_BIND *bind = new MYSQL_BIND;
bind->buffer_type = MYSQL_TYPE_STRING;
bind->buffer = test_data;
mysql_stmt_attr_set(insertStmt, STMT_ATTR_ARRAY_SIZE, &numRows);
mysql_stmt_bind_param(insertStmt, bind);
mysql_stmt_execute(insertStmt);
And there is no data fetched back when doing so.