summaryrefslogtreecommitdiff
blob: a75c9d46d07de9f3917117761fd5b875dc19ca2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
--- a/dbd/mysql/statement.c	2020-03-09 15:55:43.212010825 +0100
+++ b/dbd/mysql/statement.c	2020-03-09 15:57:37.703464570 +0100
@@ -200,7 +200,10 @@
 	switch(type) {
 	    case LUA_TNIL:
 		bind[i].buffer_type = MYSQL_TYPE_NULL;
+#if MYSQL_VERSION_ID >= 80000
+#else
 		bind[i].is_null = (my_bool*)1;
+#endif
 		break;
 
 	    case LUA_TBOOLEAN:
@@ -209,7 +213,11 @@
 		*boolean = lua_toboolean(L, p);
 
 		bind[i].buffer_type = MYSQL_TYPE_LONG;
-		bind[i].is_null = (my_bool*)0;
+#if MYSQL_VERSION_ID >= 80000
+                bind[i].is_null = (bool*) 0;
+#else
+                bind[i].is_null = (my_bool*)0;
+#endif
 		bind[i].buffer = (char *)boolean;
 		bind[i].length = 0;
 		break;
@@ -224,7 +232,11 @@
 		*num = lua_tonumber(L, p);
 
 		bind[i].buffer_type = MYSQL_TYPE_DOUBLE;
-		bind[i].is_null = (my_bool*)0;
+#if MYSQL_VERSION_ID >= 80000
+                bind[i].is_null = (bool*) 0;
+#else
+                bind[i].is_null = (my_bool*)0;
+#endif
 		bind[i].buffer = (char *)num;
 		bind[i].length = 0;
 		break;
@@ -235,7 +247,11 @@
 		str = lua_tolstring(L, p, str_len);
 
 		bind[i].buffer_type = MYSQL_TYPE_STRING;
-		bind[i].is_null = (my_bool*)0;
+#if MYSQL_VERSION_ID >= 80000
+                bind[i].is_null = (bool*) 0;
+#else
+                bind[i].is_null = (my_bool*)0;
+#endif
 		bind[i].buffer = (char *)str;
 		bind[i].length = str_len;
 		break;
@@ -385,7 +385,7 @@
 
 		    if (fields[i].type == MYSQL_TYPE_TIMESTAMP || fields[i].type == MYSQL_TYPE_DATETIME) {
 			char str[20];
-			struct st_mysql_time *t = bind[i].buffer;
+			MYSQL_TIME *t = bind[i].buffer;
 
 			snprintf(str, 20, "%d-%02d-%02d %02d:%02d:%02d", t->year, t->month, t->day, t->hour, t->minute, t->second);
 
@@ -396,7 +396,7 @@
 			}
 		    } else if (fields[i].type == MYSQL_TYPE_TIME) {
 			char str[9];
-			struct st_mysql_time *t = bind[i].buffer;
+			MYSQL_TIME *t = bind[i].buffer;
 
 			snprintf(str, 9, "%02d:%02d:%02d", t->hour, t->minute, t->second);
 
@@ -407,7 +407,7 @@
 			}
 		    } else if (fields[i].type == MYSQL_TYPE_DATE) {
 			char str[20];
-			struct st_mysql_time *t = bind[i].buffer;
+			MYSQL_TIME *t = bind[i].buffer;
 
 			snprintf(str, 11, "%d-%02d-%02d", t->year, t->month, t->day);