You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
Fixed compiler warnings
This commit is contained in:
@@ -672,7 +672,7 @@ static void convert_to_datetime(MYSQL_TIME *t, unsigned char **row, uint len, en
|
|||||||
if (len)
|
if (len)
|
||||||
{
|
{
|
||||||
unsigned char *to= *row;
|
unsigned char *to= *row;
|
||||||
int has_date= 0, has_time= 0;
|
int has_date= 0;
|
||||||
uint offset= 7;
|
uint offset= 7;
|
||||||
|
|
||||||
if (type == MYSQL_TYPE_TIME)
|
if (type == MYSQL_TYPE_TIME)
|
||||||
@@ -695,7 +695,6 @@ static void convert_to_datetime(MYSQL_TIME *t, unsigned char **row, uint len, en
|
|||||||
|
|
||||||
if (len > 4)
|
if (len > 4)
|
||||||
{
|
{
|
||||||
has_time= 1;
|
|
||||||
t->hour= (uint) to[4];
|
t->hour= (uint) to[4];
|
||||||
t->minute= (uint) to[5];
|
t->minute= (uint) to[5];
|
||||||
t->second= (uint) to[6];
|
t->second= (uint) to[6];
|
||||||
|
@@ -124,7 +124,6 @@ static long thread_id=0;
|
|||||||
my_bool my_thread_init(void)
|
my_bool my_thread_init(void)
|
||||||
{
|
{
|
||||||
struct st_my_thread_var *tmp;
|
struct st_my_thread_var *tmp;
|
||||||
my_bool rc= 0;
|
|
||||||
if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys))
|
if (my_pthread_getspecific(struct st_my_thread_var *,THR_KEY_mysys))
|
||||||
{
|
{
|
||||||
DBUG_PRINT("info", ("my_thread_init was already called. Thread id: %lu",
|
DBUG_PRINT("info", ("my_thread_init was already called. Thread id: %lu",
|
||||||
|
@@ -495,7 +495,7 @@ static int test_reconnect_maxpackage(MYSQL *my)
|
|||||||
res= mysql_store_result(mysql);
|
res= mysql_store_result(mysql);
|
||||||
row= mysql_fetch_row(res);
|
row= mysql_fetch_row(res);
|
||||||
max_packet= atol(row[0]);
|
max_packet= atol(row[0]);
|
||||||
diag("max_allowed_packet=%d", max_packet);
|
diag("max_allowed_packet=%lu", max_packet);
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
|
|
||||||
query= (char *)malloc(max_packet + 30);
|
query= (char *)malloc(max_packet + 30);
|
||||||
@@ -522,7 +522,7 @@ static int test_reconnect_maxpackage(MYSQL *my)
|
|||||||
res= mysql_store_result(mysql);
|
res= mysql_store_result(mysql);
|
||||||
row= mysql_fetch_row(res);
|
row= mysql_fetch_row(res);
|
||||||
max_packet= atol(row[0]);
|
max_packet= atol(row[0]);
|
||||||
diag("max_allowed_packet=%d", max_packet);
|
diag("max_allowed_packet=%lu", max_packet);
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
|
|
||||||
|
|
||||||
@@ -535,7 +535,6 @@ static int test_compressed(MYSQL *my)
|
|||||||
int rc;
|
int rc;
|
||||||
MYSQL *mysql= mysql_init(NULL);
|
MYSQL *mysql= mysql_init(NULL);
|
||||||
MYSQL_RES *res;
|
MYSQL_RES *res;
|
||||||
char *query;
|
|
||||||
|
|
||||||
mysql_options(mysql, MYSQL_OPT_COMPRESS, (void *)1);
|
mysql_options(mysql, MYSQL_OPT_COMPRESS, (void *)1);
|
||||||
FAIL_IF(!mysql_real_connect(mysql, hostname, username, password, schema,
|
FAIL_IF(!mysql_real_connect(mysql, hostname, username, password, schema,
|
||||||
|
@@ -520,12 +520,12 @@ static int test_reconnect(MYSQL *mysql)
|
|||||||
|
|
||||||
FAIL_UNLESS(mysql1->reconnect == 1, "reconnect != 1");
|
FAIL_UNLESS(mysql1->reconnect == 1, "reconnect != 1");
|
||||||
|
|
||||||
diag("Thread_id before kill: %d", mysql_thread_id(mysql1));
|
diag("Thread_id before kill: %lu", mysql_thread_id(mysql1));
|
||||||
mysql_kill(mysql, mysql_thread_id(mysql1));
|
mysql_kill(mysql, mysql_thread_id(mysql1));
|
||||||
|
|
||||||
rc= mysql_query(mysql1, "SELECT 1 FROM DUAL LIMIT 0");
|
rc= mysql_query(mysql1, "SELECT 1 FROM DUAL LIMIT 0");
|
||||||
check_mysql_rc(rc, mysql1);
|
check_mysql_rc(rc, mysql1);
|
||||||
diag("Thread_id after kill: %d", mysql_thread_id(mysql1));
|
diag("Thread_id after kill: %lu", mysql_thread_id(mysql1));
|
||||||
|
|
||||||
FAIL_UNLESS(mysql1->reconnect == 1, "reconnect != 1");
|
FAIL_UNLESS(mysql1->reconnect == 1, "reconnect != 1");
|
||||||
mysql_close(mysql1);
|
mysql_close(mysql1);
|
||||||
|
@@ -479,7 +479,7 @@ void run_tests(struct my_tests_st *test) {
|
|||||||
if (!mysql_default && (test[i].connection & TEST_CONNECTION_DEFAULT))
|
if (!mysql_default && (test[i].connection & TEST_CONNECTION_DEFAULT))
|
||||||
{
|
{
|
||||||
diag("MySQL server not running");
|
diag("MySQL server not running");
|
||||||
skip(1, test[i].name);
|
skip(1, "%s", test[i].name);
|
||||||
} else if (!test[i].skipmsg) {
|
} else if (!test[i].skipmsg) {
|
||||||
mysql= mysql_default;
|
mysql= mysql_default;
|
||||||
if (test[i].connection & TEST_CONNECTION_NEW)
|
if (test[i].connection & TEST_CONNECTION_NEW)
|
||||||
@@ -491,9 +491,9 @@ void run_tests(struct my_tests_st *test) {
|
|||||||
rc= test[i].function(mysql);
|
rc= test[i].function(mysql);
|
||||||
|
|
||||||
if (rc == SKIP)
|
if (rc == SKIP)
|
||||||
skip(1, test[i].name);
|
skip(1, "%s", test[i].name);
|
||||||
else
|
else
|
||||||
ok(rc == OK, test[i].name);
|
ok(rc == OK, "%s", test[i].name);
|
||||||
|
|
||||||
/* if test failed, close and reopen default connection to prevent
|
/* if test failed, close and reopen default connection to prevent
|
||||||
errors for further tests */
|
errors for further tests */
|
||||||
@@ -509,7 +509,7 @@ void run_tests(struct my_tests_st *test) {
|
|||||||
else if (mysql && !(test[i].connection & TEST_CONNECTION_DONT_CLOSE))
|
else if (mysql && !(test[i].connection & TEST_CONNECTION_DONT_CLOSE))
|
||||||
mysql_close(mysql);
|
mysql_close(mysql);
|
||||||
} else {
|
} else {
|
||||||
skip(1, test[i].skipmsg);
|
skip(1, "%s", test[i].skipmsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mysql_default) {
|
if (mysql_default) {
|
||||||
|
@@ -4733,7 +4733,9 @@ int test_notrunc(MYSQL *mysql)
|
|||||||
my_bool trunc= 1;
|
my_bool trunc= 1;
|
||||||
MYSQL_BIND bind[1];
|
MYSQL_BIND bind[1];
|
||||||
char buffer[5];
|
char buffer[5];
|
||||||
int rc, len= 1, error= 0;
|
int rc;
|
||||||
|
my_bool error= 0;
|
||||||
|
unsigned long len= 1;
|
||||||
|
|
||||||
char *query= "SELECT '1234567890' FROM DUAL";
|
char *query= "SELECT '1234567890' FROM DUAL";
|
||||||
|
|
||||||
@@ -4759,7 +4761,7 @@ int test_notrunc(MYSQL *mysql)
|
|||||||
mysql_stmt_store_result(stmt);
|
mysql_stmt_store_result(stmt);
|
||||||
|
|
||||||
rc= mysql_stmt_fetch(stmt);
|
rc= mysql_stmt_fetch(stmt);
|
||||||
diag("rc= %d len=%d", rc, len);
|
diag("rc= %d len=%lu", rc, len);
|
||||||
|
|
||||||
mysql_stmt_close(stmt);
|
mysql_stmt_close(stmt);
|
||||||
return OK;
|
return OK;
|
||||||
|
@@ -376,7 +376,7 @@ int test_sp_reset2(MYSQL *mysql)
|
|||||||
while (rc != MYSQL_NO_DATA)
|
while (rc != MYSQL_NO_DATA)
|
||||||
{
|
{
|
||||||
rc= mysql_stmt_fetch(stmt);
|
rc= mysql_stmt_fetch(stmt);
|
||||||
diag("l=%d", l[0]);
|
diag("l=%ld", l[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc= mysql_stmt_next_result(stmt);
|
rc= mysql_stmt_next_result(stmt);
|
||||||
@@ -389,7 +389,7 @@ int test_sp_reset2(MYSQL *mysql)
|
|||||||
while (rc != MYSQL_NO_DATA)
|
while (rc != MYSQL_NO_DATA)
|
||||||
{
|
{
|
||||||
rc= mysql_stmt_fetch(stmt);
|
rc= mysql_stmt_fetch(stmt);
|
||||||
diag("l=%d l=%d", l[0], l[1]);
|
diag("l=%ld l=%ld", l[0], l[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -403,7 +403,7 @@ int test_sp_reset2(MYSQL *mysql)
|
|||||||
while (rc != MYSQL_NO_DATA)
|
while (rc != MYSQL_NO_DATA)
|
||||||
{
|
{
|
||||||
rc= mysql_stmt_fetch(stmt);
|
rc= mysql_stmt_fetch(stmt);
|
||||||
diag("l=%d l=%d l=%d", l[0], l[1], l[2]);
|
diag("l=%ld l=%ld l=%ld", l[0], l[1], l[2]);
|
||||||
}
|
}
|
||||||
|
|
||||||
rc= mysql_stmt_close(stmt);
|
rc= mysql_stmt_close(stmt);
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "my_test.h"
|
#include "my_test.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_SQLITE
|
||||||
static int test1(MYSQL *mysql)
|
static int test1(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
MYSQL_ROW row;
|
MYSQL_ROW row;
|
||||||
@@ -20,7 +21,7 @@ static int test1(MYSQL *mysql)
|
|||||||
|
|
||||||
diag("Server name: %s", mysql_get_server_name(my));
|
diag("Server name: %s", mysql_get_server_name(my));
|
||||||
|
|
||||||
diag("Connected to: %s (%d)", mysql_get_server_info(my), mysql_get_server_version(my));
|
diag("Connected to: %s (%lu)", mysql_get_server_info(my), mysql_get_server_version(my));
|
||||||
|
|
||||||
rc= mysql_query(my, "CREATE TABLE t1 (a int, b varchar(255))");
|
rc= mysql_query(my, "CREATE TABLE t1 (a int, b varchar(255))");
|
||||||
rc= mysql_query(my, "DELETE FROM t1");
|
rc= mysql_query(my, "DELETE FROM t1");
|
||||||
@@ -168,6 +169,7 @@ static int test_simple_prepare(MYSQL *my)
|
|||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
struct my_tests_st my_tests[] = {
|
struct my_tests_st my_tests[] = {
|
||||||
|
Reference in New Issue
Block a user