You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
Shared memory fixes
This commit is contained in:
@@ -122,6 +122,9 @@ static char *password = 0;
|
||||
static unsigned int port = 0;
|
||||
static char *socketname = 0;
|
||||
static char *username = 0;
|
||||
#ifdef _WIN32
|
||||
static int protocol= 0;
|
||||
#endif
|
||||
/*
|
||||
static struct my_option test_options[] =
|
||||
{
|
||||
@@ -312,19 +315,24 @@ static void usage()
|
||||
printf("-d database\n");
|
||||
printf("-S socketname\n");
|
||||
printf("-P port number\n");
|
||||
printf("-w protocol mode (windows only: 1= named pipe, 2= shared memory)");
|
||||
printf("? displays this help and exits\n");
|
||||
}
|
||||
|
||||
void get_options(int argc, char **argv)
|
||||
{
|
||||
int c= 0;
|
||||
|
||||
while ((c=getopt(argc,argv, "h:u:p:d:P:S:?")) >= 0)
|
||||
while ((c=getopt(argc,argv, "h:u:p:d:w:P:S:?")) >= 0)
|
||||
{
|
||||
switch(c) {
|
||||
case 'h':
|
||||
hostname= optarg;
|
||||
break;
|
||||
case 'w':
|
||||
#ifdef _WIN32
|
||||
protocol= atoi(optarg);
|
||||
#endif
|
||||
break;
|
||||
case 'u':
|
||||
username= optarg;
|
||||
break;
|
||||
@@ -388,7 +396,12 @@ MYSQL *test_connect(struct my_tests_st *test) {
|
||||
diag("%s", "mysql_init failed - exiting");
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
switch (protocol) {
|
||||
case 1: /* named pipe */
|
||||
case 2: /* shared memory */
|
||||
}
|
||||
#endif
|
||||
mysql_options(mysql, MYSQL_REPORT_DATA_TRUNCATION, &truncation_report);
|
||||
mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, &timeout);
|
||||
|
||||
@@ -414,6 +427,7 @@ MYSQL *test_connect(struct my_tests_st *test) {
|
||||
mysql_close(mysql);
|
||||
return(NULL);
|
||||
}
|
||||
printf("Connection: %s\n", mysql->host_info);
|
||||
return(mysql);
|
||||
}
|
||||
|
||||
|
@@ -4857,7 +4857,53 @@ int test_notrunc(MYSQL *mysql)
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int test_bit2tiny(MYSQL *mysql)
|
||||
{
|
||||
MYSQL_BIND bind[2];
|
||||
char data[11];
|
||||
unsigned long length[2];
|
||||
my_bool is_null[2], error[2];
|
||||
char *query = "SELECT val FROM justbit";
|
||||
MYSQL_STMT *stmt;
|
||||
int rc;
|
||||
|
||||
mysql_query(mysql, "DROP TABLE IF EXISTS justbit");
|
||||
mysql_query(mysql, "CREATE TABLE justbit(val bit(1) not null)");
|
||||
mysql_query(mysql, "INSERT INTO justbit values (1)");
|
||||
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
rc= mysql_stmt_prepare(stmt, query, strlen(query));
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
memset(bind, '\0', sizeof(bind));
|
||||
|
||||
bind[0].buffer_type= MYSQL_TYPE_TINY;
|
||||
bind[0].buffer= &data[0];
|
||||
bind[0].buffer_length= 1;
|
||||
bind[0].is_null= &is_null[0];
|
||||
bind[0].length= &length[0];
|
||||
bind[0].error= &error[0];
|
||||
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
rc= mysql_stmt_bind_result(stmt, bind);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
rc= mysql_stmt_store_result(stmt);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
mysql_stmt_fetch(stmt);
|
||||
|
||||
FAIL_IF(data[0] != 1, "Value should be 1");
|
||||
|
||||
mysql_stmt_free_result(stmt);
|
||||
mysql_stmt_close(stmt);
|
||||
return OK;
|
||||
}
|
||||
|
||||
struct my_tests_st my_tests[] = {
|
||||
{"test_bit2tiny", test_bit2tiny, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
{"test_conc97", test_conc97, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||
{"test_conc83", test_conc83, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||
{"test_conc60", test_conc60, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
|
Reference in New Issue
Block a user