Merge lp:~linuxjedi/sysbench/add-attachsql-driver into lp:sysbench
- add-attachsql-driver
- Merge into 0.5
Proposed by
Andrew Hutchings
Status: | Merged |
---|---|
Approved by: | Alexey Kopytov |
Approved revision: | 124 |
Merged at revision: | 124 |
Proposed branch: | lp:~linuxjedi/sysbench/add-attachsql-driver |
Merge into: | lp:sysbench |
Diff against target: |
836 lines (+696/-7) 11 files modified
configure.ac (+23/-0) sysbench/Makefile.am (+6/-2) sysbench/db_driver.c (+3/-0) sysbench/db_driver.h (+4/-0) sysbench/drivers/Makefile.am (+5/-1) sysbench/drivers/attachsql/Makefile.am (+19/-0) sysbench/drivers/attachsql/drv_attachsql.c (+632/-0) sysbench/tests/db/common.lua (+1/-1) sysbench/tests/db/oltp.lua (+1/-1) sysbench/tests/db/select_random_points.lua (+1/-1) sysbench/tests/db/select_random_ranges.lua (+1/-1) |
To merge this branch: | bzr merge lp:~linuxjedi/sysbench/add-attachsql-driver |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexey Kopytov | Approve | ||
Review via email:
|
Commit message
Description of the change
This adds a sysbench driver so that libAttachSQL can be used to talk to MySQL servers.
To post a comment you must log in.
Revision history for this message

Alexey Kopytov (akopytov) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'configure.ac' | |||
2 | --- configure.ac 2012-09-23 13:09:08 +0000 | |||
3 | +++ configure.ac 2014-10-16 09:41:21 +0000 | |||
4 | @@ -107,6 +107,14 @@ | |||
5 | 107 | ) | 107 | ) |
6 | 108 | AC_CACHE_CHECK([whether to compile with Drizzle support], [ac_cv_use_drizzle], [ac_cv_use_drizzle=no]) | 108 | AC_CACHE_CHECK([whether to compile with Drizzle support], [ac_cv_use_drizzle], [ac_cv_use_drizzle=no]) |
7 | 109 | 109 | ||
8 | 110 | # Check if we should compile with libattachsql support | ||
9 | 111 | AC_ARG_WITH([attachsql], | ||
10 | 112 | AS_HELP_STRING([--with-attachsql],[compile with libattachsql support (default is enabled)]), | ||
11 | 113 | [ac_cv_use_attachsql=$withval], [ac_cv_use_attachsql=yes] | ||
12 | 114 | ) | ||
13 | 115 | AC_CACHE_CHECK([whether to compile with libattachsql support], [ac_cv_use_attachsql], [ac_cv_use_attachsql=no]) | ||
14 | 116 | |||
15 | 117 | |||
16 | 110 | # Check if we should compile with Oracle support | 118 | # Check if we should compile with Oracle support |
17 | 111 | AC_ARG_WITH([oracle], | 119 | AC_ARG_WITH([oracle], |
18 | 112 | AS_HELP_STRING([--with-oracle],[compile with Oracle support (default is disabled)]), | 120 | AS_HELP_STRING([--with-oracle],[compile with Oracle support (default is disabled)]), |
19 | @@ -188,6 +196,20 @@ | |||
20 | 188 | fi | 196 | fi |
21 | 189 | AM_CONDITIONAL(USE_DRIZZLE, test x$ac_cv_libdrizzle = xyes) | 197 | AM_CONDITIONAL(USE_DRIZZLE, test x$ac_cv_libdrizzle = xyes) |
22 | 190 | 198 | ||
23 | 199 | if test x$ac_cv_use_attachsql != xno; then | ||
24 | 200 | AC_LIB_HAVE_LINKFLAGS(attachsql,, | ||
25 | 201 | [#include <libattachsql-1.0/attachsql.h>], | ||
26 | 202 | [ | ||
27 | 203 | const char *version= attachsql_get_library_version(); | ||
28 | 204 | ]) | ||
29 | 205 | fi | ||
30 | 206 | if test "x$ac_cv_libattachsql" = "xyes" | ||
31 | 207 | then | ||
32 | 208 | AC_DEFINE(USE_ATTACHSQL,1,[Define to 1 if you want to compile with libattachsql support]) | ||
33 | 209 | fi | ||
34 | 210 | AM_CONDITIONAL(USE_ATTACHSQL, test x$ac_cv_libattachsql = xyes) | ||
35 | 211 | |||
36 | 212 | |||
37 | 191 | AM_CONDITIONAL(USE_ORACLE, test x$ac_cv_use_oracle != xno) | 213 | AM_CONDITIONAL(USE_ORACLE, test x$ac_cv_use_oracle != xno) |
38 | 192 | if test x$ac_cv_use_oracle != xno; then | 214 | if test x$ac_cv_use_oracle != xno; then |
39 | 193 | AC_DEFINE(USE_ORACLE,1,[Define to 1 if you want to compile with Oracle support]) | 215 | AC_DEFINE(USE_ORACLE,1,[Define to 1 if you want to compile with Oracle support]) |
40 | @@ -428,6 +450,7 @@ | |||
41 | 428 | sysbench/drivers/drizzle/Makefile | 450 | sysbench/drivers/drizzle/Makefile |
42 | 429 | sysbench/drivers/oracle/Makefile | 451 | sysbench/drivers/oracle/Makefile |
43 | 430 | sysbench/drivers/pgsql/Makefile | 452 | sysbench/drivers/pgsql/Makefile |
44 | 453 | sysbench/drivers/attachsql/Makefile | ||
45 | 431 | sysbench/tests/Makefile | 454 | sysbench/tests/Makefile |
46 | 432 | sysbench/tests/cpu/Makefile | 455 | sysbench/tests/cpu/Makefile |
47 | 433 | sysbench/tests/fileio/Makefile | 456 | sysbench/tests/fileio/Makefile |
48 | 434 | 457 | ||
49 | === modified file 'sysbench/Makefile.am' | |||
50 | --- sysbench/Makefile.am 2012-08-30 17:59:06 +0000 | |||
51 | +++ sysbench/Makefile.am 2014-10-16 09:41:21 +0000 | |||
52 | @@ -29,6 +29,10 @@ | |||
53 | 29 | drizzle_ldadd = drivers/drizzle/libsbdrizzle.a $(LIBDRIZZLE) | 29 | drizzle_ldadd = drivers/drizzle/libsbdrizzle.a $(LIBDRIZZLE) |
54 | 30 | endif | 30 | endif |
55 | 31 | 31 | ||
56 | 32 | if USE_ATTACHSQL | ||
57 | 33 | attachsql_ldadd = drivers/attachsql/libsbattachsql.a $(LIBATTACHSQL) | ||
58 | 34 | endif | ||
59 | 35 | |||
60 | 32 | if USE_ORACLE | 36 | if USE_ORACLE |
61 | 33 | ora_ldadd = drivers/oracle/libsboracle.a $(ORA_LIBS) | 37 | ora_ldadd = drivers/oracle/libsboracle.a $(ORA_LIBS) |
62 | 34 | endif | 38 | endif |
63 | @@ -49,7 +53,7 @@ | |||
64 | 49 | sysbench_LDADD = tests/fileio/libsbfileio.a tests/threads/libsbthreads.a \ | 53 | sysbench_LDADD = tests/fileio/libsbfileio.a tests/threads/libsbthreads.a \ |
65 | 50 | tests/memory/libsbmemory.a tests/cpu/libsbcpu.a \ | 54 | tests/memory/libsbmemory.a tests/cpu/libsbcpu.a \ |
66 | 51 | tests/mutex/libsbmutex.a scripting/libsbscript.a \ | 55 | tests/mutex/libsbmutex.a scripting/libsbscript.a \ |
68 | 52 | $(mysql_ldadd) $(drizzle_ldadd) $(pgsql_ldadd) $(ora_ldadd) $(lua_ldadd) | 56 | $(mysql_ldadd) $(drizzle_ldadd) $(attachsql_ldadd) $(pgsql_ldadd) $(ora_ldadd) $(lua_ldadd) |
69 | 53 | 57 | ||
71 | 54 | sysbench_LDFLAGS = $(EXTRA_LDFLAGS) $(mysql_ldflags) $(pgsql_ldflags) $(ora_ldflags) $(lua_ldflags) | 58 | sysbench_LDFLAGS = $(EXTRA_LDFLAGS) $(mysql_ldflags) $(attachsql_ldflags) $(pgsql_ldflags) $(ora_ldflags) $(lua_ldflags) |
72 | 55 | 59 | ||
73 | 56 | 60 | ||
74 | === modified file 'sysbench/db_driver.c' | |||
75 | --- sysbench/db_driver.c 2012-08-30 08:43:42 +0000 | |||
76 | +++ sysbench/db_driver.c 2014-10-16 09:41:21 +0000 | |||
77 | @@ -114,6 +114,9 @@ | |||
78 | 114 | #ifdef USE_DRIZZLE | 114 | #ifdef USE_DRIZZLE |
79 | 115 | register_driver_drizzle(&drivers); | 115 | register_driver_drizzle(&drivers); |
80 | 116 | #endif | 116 | #endif |
81 | 117 | #ifdef USE_ATTACHSQL | ||
82 | 118 | register_driver_attachsql(&drivers); | ||
83 | 119 | #endif | ||
84 | 117 | #ifdef USE_DRIZZLECLIENT | 120 | #ifdef USE_DRIZZLECLIENT |
85 | 118 | register_driver_drizzleclient(&drivers); | 121 | register_driver_drizzleclient(&drivers); |
86 | 119 | #endif | 122 | #endif |
87 | 120 | 123 | ||
88 | === modified file 'sysbench/db_driver.h' | |||
89 | --- sysbench/db_driver.h 2011-07-19 14:49:27 +0000 | |||
90 | +++ sysbench/db_driver.h 2014-10-16 09:41:21 +0000 | |||
91 | @@ -309,6 +309,10 @@ | |||
92 | 309 | int register_driver_drizzle(sb_list_t *); | 309 | int register_driver_drizzle(sb_list_t *); |
93 | 310 | #endif | 310 | #endif |
94 | 311 | 311 | ||
95 | 312 | #ifdef USE_ATTACHSQL | ||
96 | 313 | int register_driver_attachsql(sb_list_t *); | ||
97 | 314 | #endif | ||
98 | 315 | |||
99 | 312 | #ifdef USE_DRIZZLECLIENT | 316 | #ifdef USE_DRIZZLECLIENT |
100 | 313 | int register_driver_drizzleclient(sb_list_t *); | 317 | int register_driver_drizzleclient(sb_list_t *); |
101 | 314 | #endif | 318 | #endif |
102 | 315 | 319 | ||
103 | === modified file 'sysbench/drivers/Makefile.am' | |||
104 | --- sysbench/drivers/Makefile.am 2009-06-10 23:43:32 +0000 | |||
105 | +++ sysbench/drivers/Makefile.am 2014-10-16 09:41:21 +0000 | |||
106 | @@ -22,6 +22,10 @@ | |||
107 | 22 | DRIZZLE_DIR = drizzle | 22 | DRIZZLE_DIR = drizzle |
108 | 23 | endif | 23 | endif |
109 | 24 | 24 | ||
110 | 25 | if USE_ATTACHSQL | ||
111 | 26 | ATTACHSQL_DIR = attachsql | ||
112 | 27 | endif | ||
113 | 28 | |||
114 | 25 | if USE_ORACLE | 29 | if USE_ORACLE |
115 | 26 | ORACLE_DIR = oracle | 30 | ORACLE_DIR = oracle |
116 | 27 | endif | 31 | endif |
117 | @@ -30,4 +34,4 @@ | |||
118 | 30 | PGSQL_DIR = pgsql | 34 | PGSQL_DIR = pgsql |
119 | 31 | endif | 35 | endif |
120 | 32 | 36 | ||
122 | 33 | SUBDIRS = $(MYSQL_DIR) $(ORACLE_DIR) $(PGSQL_DIR) $(DRIZZLE_DIR) | 37 | SUBDIRS = $(MYSQL_DIR) $(ORACLE_DIR) $(PGSQL_DIR) $(DRIZZLE_DIR) $(ATTACHSQL_DIR) |
123 | 34 | 38 | ||
124 | === added directory 'sysbench/drivers/attachsql' | |||
125 | === added file 'sysbench/drivers/attachsql/Makefile.am' | |||
126 | --- sysbench/drivers/attachsql/Makefile.am 1970-01-01 00:00:00 +0000 | |||
127 | +++ sysbench/drivers/attachsql/Makefile.am 2014-10-16 09:41:21 +0000 | |||
128 | @@ -0,0 +1,19 @@ | |||
129 | 1 | # Copyright (C) 2009 Sun Microsystems, Inc. | ||
130 | 2 | # | ||
131 | 3 | # This program is free software; you can redistribute it and/or modify | ||
132 | 4 | # it under the terms of the GNU General Public License as published by | ||
133 | 5 | # the Free Software Foundation; either version 2 of the License, or | ||
134 | 6 | # (at your option) any later version. | ||
135 | 7 | # | ||
136 | 8 | # This program is distributed in the hope that it will be useful, | ||
137 | 9 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
138 | 10 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
139 | 11 | # GNU General Public License for more details. | ||
140 | 12 | # | ||
141 | 13 | # You should have received a copy of the GNU General Public License | ||
142 | 14 | # along with this program; if not, write to the Free Software | ||
143 | 15 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
144 | 16 | |||
145 | 17 | noinst_LIBRARIES = libsbattachsql.a | ||
146 | 18 | |||
147 | 19 | libsbattachsql_a_SOURCES = drv_attachsql.c | ||
148 | 0 | 20 | ||
149 | === added file 'sysbench/drivers/attachsql/drv_attachsql.c' | |||
150 | --- sysbench/drivers/attachsql/drv_attachsql.c 1970-01-01 00:00:00 +0000 | |||
151 | +++ sysbench/drivers/attachsql/drv_attachsql.c 2014-10-16 09:41:21 +0000 | |||
152 | @@ -0,0 +1,632 @@ | |||
153 | 1 | /* Copyright 2014 Hewlett-Packard Development Company, L.P. | ||
154 | 2 | based on the Drizzle driver: | ||
155 | 3 | Copyright (C) 2009 Sun Microsystems, Inc. | ||
156 | 4 | |||
157 | 5 | This program is free software; you can redistribute it and/or modify | ||
158 | 6 | it under the terms of the GNU General Public License as published by | ||
159 | 7 | the Free Software Foundation; either version 2 of the License, or | ||
160 | 8 | (at your option) any later version. | ||
161 | 9 | |||
162 | 10 | This program is distributed in the hope that it will be useful, | ||
163 | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
164 | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
165 | 13 | GNU General Public License for more details. | ||
166 | 14 | |||
167 | 15 | You should have received a copy of the GNU General Public License | ||
168 | 16 | along with this program; if not, write to the Free Software | ||
169 | 17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
170 | 18 | */ | ||
171 | 19 | |||
172 | 20 | #ifdef HAVE_CONFIG_H | ||
173 | 21 | # include "config.h" | ||
174 | 22 | #endif | ||
175 | 23 | |||
176 | 24 | #ifdef HAVE_STRING_H | ||
177 | 25 | # include <string.h> | ||
178 | 26 | #endif | ||
179 | 27 | #ifdef HAVE_STRINGS_H | ||
180 | 28 | # include <strings.h> | ||
181 | 29 | #endif | ||
182 | 30 | #include <stdio.h> | ||
183 | 31 | |||
184 | 32 | #include <stdint.h> | ||
185 | 33 | #include <libattachsql-1.0/attachsql.h> | ||
186 | 34 | |||
187 | 35 | #include "sb_options.h" | ||
188 | 36 | |||
189 | 37 | #include "db_driver.h" | ||
190 | 38 | |||
191 | 39 | #define DEBUG(format, ...) do { if (db_globals.debug) log_text(LOG_DEBUG, format, __VA_ARGS__); } while (0) | ||
192 | 40 | |||
193 | 41 | /* Drizzle driver arguments */ | ||
194 | 42 | |||
195 | 43 | static sb_arg_t attachsql_drv_args[] = | ||
196 | 44 | { | ||
197 | 45 | {"attachsql-host", "libAttachSQL server host", SB_ARG_TYPE_LIST, "localhost"}, | ||
198 | 46 | {"attachsql-port", "libAttachSQL server port", SB_ARG_TYPE_INT, "4427"}, | ||
199 | 47 | {"attachsql-socket", "libAttachSQL socket", SB_ARG_TYPE_STRING, NULL}, | ||
200 | 48 | {"attachsql-user", "libAttachSQL user", SB_ARG_TYPE_STRING, ""}, | ||
201 | 49 | {"attachsql-password", "libAttachSQL password", SB_ARG_TYPE_STRING, ""}, | ||
202 | 50 | {"attachsql-db", "libAttachSQL database name", SB_ARG_TYPE_STRING, "sbtest"}, | ||
203 | 51 | {NULL, NULL, SB_ARG_TYPE_NULL, NULL} | ||
204 | 52 | }; | ||
205 | 53 | |||
206 | 54 | typedef struct | ||
207 | 55 | { | ||
208 | 56 | sb_list_t *hosts; | ||
209 | 57 | unsigned int port; | ||
210 | 58 | char *socket; | ||
211 | 59 | char *user; | ||
212 | 60 | char *password; | ||
213 | 61 | char *db; | ||
214 | 62 | } attachsql_drv_args_t; | ||
215 | 63 | |||
216 | 64 | /* AttachSQL driver capabilities | ||
217 | 65 | * At a later date we will add prepared statements to this | ||
218 | 66 | */ | ||
219 | 67 | |||
220 | 68 | static drv_caps_t attachsql_drv_caps = | ||
221 | 69 | { | ||
222 | 70 | .multi_rows_insert = 1, | ||
223 | 71 | .prepared_statements = 1, | ||
224 | 72 | .auto_increment = 1, | ||
225 | 73 | .serial = 0, | ||
226 | 74 | .unsigned_int = 0, | ||
227 | 75 | }; | ||
228 | 76 | |||
229 | 77 | static attachsql_drv_args_t args; /* driver args */ | ||
230 | 78 | |||
231 | 79 | static sb_list_item_t *hosts_pos; | ||
232 | 80 | |||
233 | 81 | static pthread_mutex_t hosts_mutex; | ||
234 | 82 | |||
235 | 83 | /* libAttachSQL driver operations */ | ||
236 | 84 | |||
237 | 85 | static int attachsql_drv_init(void); | ||
238 | 86 | static int attachsql_drv_describe(drv_caps_t *); | ||
239 | 87 | static int attachsql_drv_connect(db_conn_t *); | ||
240 | 88 | static int attachsql_drv_disconnect(db_conn_t *); | ||
241 | 89 | static int attachsql_drv_prepare(db_stmt_t *, const char *); | ||
242 | 90 | static int attachsql_drv_bind_param(db_stmt_t *, db_bind_t *, unsigned int); | ||
243 | 91 | static int attachsql_drv_bind_result(db_stmt_t *, db_bind_t *, unsigned int); | ||
244 | 92 | static int attachsql_drv_execute(db_stmt_t *, db_result_set_t *); | ||
245 | 93 | static int attachsql_drv_fetch(db_result_set_t *); | ||
246 | 94 | static int attachsql_drv_fetch_row(db_result_set_t *, db_row_t *); | ||
247 | 95 | static unsigned long long attachsql_drv_num_rows(db_result_set_t *); | ||
248 | 96 | static int attachsql_drv_query(db_conn_t *, const char *, db_result_set_t *); | ||
249 | 97 | static int attachsql_drv_free_results(db_result_set_t *); | ||
250 | 98 | static int attachsql_drv_close(db_stmt_t *); | ||
251 | 99 | static int attachsql_drv_store_results(db_result_set_t *); | ||
252 | 100 | static int attachsql_drv_done(void); | ||
253 | 101 | |||
254 | 102 | /* libAttachSQL driver definition */ | ||
255 | 103 | |||
256 | 104 | static db_driver_t attachsql_driver = | ||
257 | 105 | { | ||
258 | 106 | .sname = "attachsql", | ||
259 | 107 | .lname = "libAttachSQL driver", | ||
260 | 108 | .args = attachsql_drv_args, | ||
261 | 109 | .ops = | ||
262 | 110 | { | ||
263 | 111 | attachsql_drv_init, | ||
264 | 112 | attachsql_drv_describe, | ||
265 | 113 | attachsql_drv_connect, | ||
266 | 114 | attachsql_drv_disconnect, | ||
267 | 115 | attachsql_drv_prepare, | ||
268 | 116 | attachsql_drv_bind_param, | ||
269 | 117 | attachsql_drv_bind_result, | ||
270 | 118 | attachsql_drv_execute, | ||
271 | 119 | attachsql_drv_fetch, | ||
272 | 120 | attachsql_drv_fetch_row, | ||
273 | 121 | attachsql_drv_num_rows, | ||
274 | 122 | attachsql_drv_free_results, | ||
275 | 123 | attachsql_drv_close, | ||
276 | 124 | attachsql_drv_query, | ||
277 | 125 | attachsql_drv_store_results, | ||
278 | 126 | attachsql_drv_done | ||
279 | 127 | }, | ||
280 | 128 | .listitem = {NULL, NULL} | ||
281 | 129 | }; | ||
282 | 130 | |||
283 | 131 | |||
284 | 132 | /* Local functions */ | ||
285 | 133 | |||
286 | 134 | /* Register libAttachSQL driver */ | ||
287 | 135 | |||
288 | 136 | |||
289 | 137 | int register_driver_attachsql(sb_list_t *drivers) | ||
290 | 138 | { | ||
291 | 139 | SB_LIST_ADD_TAIL(&attachsql_driver.listitem, drivers); | ||
292 | 140 | |||
293 | 141 | return 0; | ||
294 | 142 | } | ||
295 | 143 | |||
296 | 144 | |||
297 | 145 | /* libAttachSQL driver initialization */ | ||
298 | 146 | |||
299 | 147 | |||
300 | 148 | int attachsql_drv_init(void) | ||
301 | 149 | { | ||
302 | 150 | args.hosts = sb_get_value_list("attachsql-host"); | ||
303 | 151 | if (SB_LIST_IS_EMPTY(args.hosts)) | ||
304 | 152 | { | ||
305 | 153 | log_text(LOG_FATAL, "No libAttachSQL hosts specified, aborting"); | ||
306 | 154 | return 1; | ||
307 | 155 | } | ||
308 | 156 | hosts_pos = args.hosts; | ||
309 | 157 | pthread_mutex_init(&hosts_mutex, NULL); | ||
310 | 158 | |||
311 | 159 | args.port = (unsigned int)sb_get_value_int("attachsql-port"); | ||
312 | 160 | args.socket = sb_get_value_string("attachsql-socket"); | ||
313 | 161 | args.user = sb_get_value_string("attachsql-user"); | ||
314 | 162 | args.password = sb_get_value_string("attachsql-password"); | ||
315 | 163 | args.db = sb_get_value_string("attachsql-db"); | ||
316 | 164 | attachsql_library_init(); | ||
317 | 165 | return 0; | ||
318 | 166 | } | ||
319 | 167 | |||
320 | 168 | |||
321 | 169 | /* Describe database capabilities (possibly depending on table type) */ | ||
322 | 170 | |||
323 | 171 | |||
324 | 172 | int attachsql_drv_describe(drv_caps_t *caps ) | ||
325 | 173 | { | ||
326 | 174 | *caps = attachsql_drv_caps; | ||
327 | 175 | |||
328 | 176 | return 0; | ||
329 | 177 | } | ||
330 | 178 | |||
331 | 179 | |||
332 | 180 | /* Connect to libAttachSQL database */ | ||
333 | 181 | |||
334 | 182 | |||
335 | 183 | int attachsql_drv_connect(db_conn_t *sb_conn) | ||
336 | 184 | { | ||
337 | 185 | attachsql_connect_t *con= NULL; | ||
338 | 186 | const char *host; | ||
339 | 187 | attachsql_error_t *error= NULL; | ||
340 | 188 | attachsql_return_t aret= ATTACHSQL_RETURN_NONE; | ||
341 | 189 | |||
342 | 190 | if (args.socket) | ||
343 | 191 | { | ||
344 | 192 | DEBUG("attachsql_connect_create(\"%s\", \"%s\", \"%s\", \"%s\")", | ||
345 | 193 | args.socket, | ||
346 | 194 | args.user, | ||
347 | 195 | args.password, | ||
348 | 196 | args.db); | ||
349 | 197 | con= attachsql_connect_create(args.socket, | ||
350 | 198 | 0, | ||
351 | 199 | args.user, | ||
352 | 200 | args.password, | ||
353 | 201 | args.db, | ||
354 | 202 | &error); | ||
355 | 203 | } else { | ||
356 | 204 | |||
357 | 205 | pthread_mutex_lock(&hosts_mutex); | ||
358 | 206 | hosts_pos = SB_LIST_ITEM_NEXT(hosts_pos); | ||
359 | 207 | if (hosts_pos == args.hosts) | ||
360 | 208 | hosts_pos = SB_LIST_ITEM_NEXT(hosts_pos); | ||
361 | 209 | host = SB_LIST_ENTRY(hosts_pos, value_t, listitem)->data; | ||
362 | 210 | pthread_mutex_unlock(&hosts_mutex); | ||
363 | 211 | |||
364 | 212 | DEBUG("attachsql_connect_create(\"%s\", %u, \"%s\", \"%s\", \"%s\")", | ||
365 | 213 | host, | ||
366 | 214 | args.port, | ||
367 | 215 | args.user, | ||
368 | 216 | args.password, | ||
369 | 217 | args.db); | ||
370 | 218 | con= attachsql_connect_create(host, | ||
371 | 219 | args.port, | ||
372 | 220 | args.user, | ||
373 | 221 | args.password, | ||
374 | 222 | args.db, | ||
375 | 223 | &error); | ||
376 | 224 | } | ||
377 | 225 | if (con == NULL) | ||
378 | 226 | { | ||
379 | 227 | log_text(LOG_FATAL, "unable to Add libAttachSQL Connection, aborting..."); | ||
380 | 228 | log_text(LOG_FATAL, "error %d: %s", attachsql_error_code(error), attachsql_error_message(error)); | ||
381 | 229 | attachsql_error_free(error); | ||
382 | 230 | return 1; | ||
383 | 231 | } | ||
384 | 232 | attachsql_connect_set_option(con, ATTACHSQL_OPTION_SEMI_BLOCKING, NULL); | ||
385 | 233 | |||
386 | 234 | if (!attachsql_connect(con, &error)) | ||
387 | 235 | { | ||
388 | 236 | log_text(LOG_FATAL, "unable to connect to libAttachSQL server"); | ||
389 | 237 | log_text(LOG_FATAL, "error %d: %s", attachsql_error_code(error), attachsql_error_message(error)); | ||
390 | 238 | attachsql_error_free(error); | ||
391 | 239 | attachsql_connect_destroy(con); | ||
392 | 240 | return 1; | ||
393 | 241 | |||
394 | 242 | } | ||
395 | 243 | |||
396 | 244 | while (aret != ATTACHSQL_RETURN_IDLE) | ||
397 | 245 | { | ||
398 | 246 | aret = attachsql_connect_poll(con, &error); | ||
399 | 247 | |||
400 | 248 | if (error) | ||
401 | 249 | { | ||
402 | 250 | log_text(LOG_FATAL, "unable to connect to libAttachSQL server"); | ||
403 | 251 | log_text(LOG_FATAL, "error %d: %s", attachsql_error_code(error), attachsql_error_message(error)); | ||
404 | 252 | attachsql_error_free(error); | ||
405 | 253 | attachsql_connect_destroy(con); | ||
406 | 254 | return 1; | ||
407 | 255 | } | ||
408 | 256 | } | ||
409 | 257 | |||
410 | 258 | sb_conn->ptr = con; | ||
411 | 259 | |||
412 | 260 | return 0; | ||
413 | 261 | } | ||
414 | 262 | |||
415 | 263 | |||
416 | 264 | /* Disconnect from libAttachSQL database */ | ||
417 | 265 | |||
418 | 266 | |||
419 | 267 | int attachsql_drv_disconnect(db_conn_t *sb_conn) | ||
420 | 268 | { | ||
421 | 269 | attachsql_connect_t *con = (attachsql_connect_t *)sb_conn->ptr; | ||
422 | 270 | |||
423 | 271 | if (con != NULL) | ||
424 | 272 | { | ||
425 | 273 | DEBUG("attachsql_connect_destroy(%p)", con); | ||
426 | 274 | attachsql_connect_destroy(con); | ||
427 | 275 | } | ||
428 | 276 | return 0; | ||
429 | 277 | } | ||
430 | 278 | |||
431 | 279 | |||
432 | 280 | /* Prepare statement */ | ||
433 | 281 | |||
434 | 282 | |||
435 | 283 | int attachsql_drv_prepare(db_stmt_t *stmt, const char *query) | ||
436 | 284 | { | ||
437 | 285 | attachsql_connect_t *con= (attachsql_connect_t *)stmt->connection->ptr; | ||
438 | 286 | attachsql_error_t *error= NULL; | ||
439 | 287 | attachsql_return_t aret= ATTACHSQL_RETURN_NONE; | ||
440 | 288 | attachsql_statement_prepare(con, strlen(query), query, &error); | ||
441 | 289 | while(aret != ATTACHSQL_RETURN_EOF) | ||
442 | 290 | { | ||
443 | 291 | aret= attachsql_connect_poll(con, &error); | ||
444 | 292 | if (error) | ||
445 | 293 | { | ||
446 | 294 | log_text(LOG_ALERT, "libAttachSQL Prepare Failed: %u:%s", attachsql_error_code(error), attachsql_error_message(error)); | ||
447 | 295 | attachsql_error_free(error); | ||
448 | 296 | return SB_DB_ERROR_FAILED; | ||
449 | 297 | } | ||
450 | 298 | } | ||
451 | 299 | |||
452 | 300 | return 0; | ||
453 | 301 | } | ||
454 | 302 | |||
455 | 303 | |||
456 | 304 | /* Bind parameters for prepared statement */ | ||
457 | 305 | int attachsql_drv_bind_param(db_stmt_t *stmt, db_bind_t *params, unsigned int len) | ||
458 | 306 | { | ||
459 | 307 | /* libAttachSQL doesn't do this, you do this during execute | ||
460 | 308 | * this is because sysbench doesn't set the values until that time | ||
461 | 309 | */ | ||
462 | 310 | |||
463 | 311 | if (stmt->bound_param != NULL) | ||
464 | 312 | free(stmt->bound_param); | ||
465 | 313 | stmt->bound_param = (db_bind_t *)malloc(len * sizeof(db_bind_t)); | ||
466 | 314 | if (stmt->bound_param == NULL) | ||
467 | 315 | return 1; | ||
468 | 316 | memcpy(stmt->bound_param, params, len * sizeof(db_bind_t)); | ||
469 | 317 | stmt->bound_param_len = len; | ||
470 | 318 | |||
471 | 319 | return 0; | ||
472 | 320 | |||
473 | 321 | } | ||
474 | 322 | |||
475 | 323 | |||
476 | 324 | /* Bind results for prepared statement */ | ||
477 | 325 | int attachsql_drv_bind_result(db_stmt_t *stmt, db_bind_t *params, unsigned int len) | ||
478 | 326 | { | ||
479 | 327 | (void)stmt; | ||
480 | 328 | (void)params; | ||
481 | 329 | (void)len; | ||
482 | 330 | /* libAttachSQL doesn't do this, you get after execute */ | ||
483 | 331 | return 0; | ||
484 | 332 | } | ||
485 | 333 | |||
486 | 334 | |||
487 | 335 | /* Execute prepared statement */ | ||
488 | 336 | |||
489 | 337 | |||
490 | 338 | int attachsql_drv_execute(db_stmt_t *stmt, db_result_set_t *rs) | ||
491 | 339 | { | ||
492 | 340 | (void) rs; | ||
493 | 341 | attachsql_connect_t *con= (attachsql_connect_t *)stmt->connection->ptr; | ||
494 | 342 | attachsql_return_t aret= ATTACHSQL_RETURN_NONE; | ||
495 | 343 | attachsql_error_t *error= NULL; | ||
496 | 344 | |||
497 | 345 | uint16_t i; | ||
498 | 346 | int8_t tinyint; | ||
499 | 347 | int16_t smallint; | ||
500 | 348 | int32_t normalint; | ||
501 | 349 | int64_t bigint; | ||
502 | 350 | float float_type; | ||
503 | 351 | double double_type; | ||
504 | 352 | db_time_t *time_data; | ||
505 | 353 | if (con == NULL) | ||
506 | 354 | return 1; | ||
507 | 355 | |||
508 | 356 | for (i= 0; i < stmt->bound_param_len; i++) | ||
509 | 357 | { | ||
510 | 358 | db_bind_t *param= &stmt->bound_param[i]; | ||
511 | 359 | switch(param->type) | ||
512 | 360 | { | ||
513 | 361 | case DB_TYPE_TINYINT: | ||
514 | 362 | tinyint= *(int8_t*)param->buffer; | ||
515 | 363 | attachsql_statement_set_int(con, i, tinyint, NULL); | ||
516 | 364 | break; | ||
517 | 365 | case DB_TYPE_SMALLINT: | ||
518 | 366 | smallint= *(int16_t*)param->buffer; | ||
519 | 367 | attachsql_statement_set_int(con, i, smallint, NULL); | ||
520 | 368 | break; | ||
521 | 369 | case DB_TYPE_INT: | ||
522 | 370 | normalint= *(int32_t*)param->buffer; | ||
523 | 371 | attachsql_statement_set_int(con, i, normalint, NULL); | ||
524 | 372 | break; | ||
525 | 373 | case DB_TYPE_BIGINT: | ||
526 | 374 | bigint= *(int64_t*)param->buffer; | ||
527 | 375 | attachsql_statement_set_bigint(con, i, bigint, NULL); | ||
528 | 376 | break; | ||
529 | 377 | case DB_TYPE_FLOAT: | ||
530 | 378 | float_type= *(float*)param->buffer; | ||
531 | 379 | attachsql_statement_set_float(con, i, float_type, NULL); | ||
532 | 380 | break; | ||
533 | 381 | case DB_TYPE_DOUBLE: | ||
534 | 382 | double_type= *(double*)param->buffer; | ||
535 | 383 | attachsql_statement_set_double(con, i, double_type, NULL); | ||
536 | 384 | break; | ||
537 | 385 | case DB_TYPE_TIME: | ||
538 | 386 | time_data= (db_time_t*)param->buffer; | ||
539 | 387 | attachsql_statement_set_time(con, i, time_data->hour, time_data->minute, time_data->second, 0, false, NULL); | ||
540 | 388 | break; | ||
541 | 389 | case DB_TYPE_DATE: | ||
542 | 390 | case DB_TYPE_DATETIME: | ||
543 | 391 | case DB_TYPE_TIMESTAMP: | ||
544 | 392 | time_data= (db_time_t*)param->buffer; | ||
545 | 393 | attachsql_statement_set_datetime(con, i, time_data->year, time_data->month, time_data->day, time_data->hour, time_data->minute, time_data->second, 0, NULL); | ||
546 | 394 | break; | ||
547 | 395 | case DB_TYPE_CHAR: | ||
548 | 396 | case DB_TYPE_VARCHAR: | ||
549 | 397 | attachsql_statement_set_string(con, i, param->max_len, param->buffer, NULL); | ||
550 | 398 | case DB_TYPE_NONE: | ||
551 | 399 | default: | ||
552 | 400 | attachsql_statement_set_null(con, i, NULL); | ||
553 | 401 | /* Not supported */ | ||
554 | 402 | } | ||
555 | 403 | } | ||
556 | 404 | |||
557 | 405 | attachsql_statement_execute(con, &error); | ||
558 | 406 | |||
559 | 407 | while(aret != ATTACHSQL_RETURN_EOF) | ||
560 | 408 | { | ||
561 | 409 | aret= attachsql_connect_poll(con, &error); | ||
562 | 410 | if (aret == ATTACHSQL_RETURN_ROW_READY) | ||
563 | 411 | { | ||
564 | 412 | return 0; | ||
565 | 413 | } | ||
566 | 414 | if (error) | ||
567 | 415 | { | ||
568 | 416 | log_text(LOG_ALERT, "libAttachSQL Execute Failed: %u:%s", attachsql_error_code(error), attachsql_error_message(error)); | ||
569 | 417 | attachsql_error_free(error); | ||
570 | 418 | return SB_DB_ERROR_FAILED; | ||
571 | 419 | } | ||
572 | 420 | } | ||
573 | 421 | |||
574 | 422 | return SB_DB_ERROR_NONE; | ||
575 | 423 | } | ||
576 | 424 | |||
577 | 425 | |||
578 | 426 | /* Execute SQL query */ | ||
579 | 427 | |||
580 | 428 | |||
581 | 429 | int attachsql_drv_query(db_conn_t *sb_conn, const char *query, | ||
582 | 430 | db_result_set_t *rs) | ||
583 | 431 | { | ||
584 | 432 | (void) rs; | ||
585 | 433 | attachsql_connect_t *con = sb_conn->ptr; | ||
586 | 434 | unsigned int rc; | ||
587 | 435 | attachsql_error_t *error= NULL; | ||
588 | 436 | attachsql_return_t aret= ATTACHSQL_RETURN_NONE; | ||
589 | 437 | |||
590 | 438 | /* Close any previous query */ | ||
591 | 439 | attachsql_query_close(con); | ||
592 | 440 | |||
593 | 441 | DEBUG("attachsql_query(%p, \"%s\", %u)", | ||
594 | 442 | con, | ||
595 | 443 | query, | ||
596 | 444 | strlen(query)); | ||
597 | 445 | attachsql_query(con, strlen(query), query, 0, NULL, &error); | ||
598 | 446 | |||
599 | 447 | while((aret != ATTACHSQL_RETURN_EOF) && (aret != ATTACHSQL_RETURN_ROW_READY)) | ||
600 | 448 | { | ||
601 | 449 | aret= attachsql_connect_poll(con, &error); | ||
602 | 450 | |||
603 | 451 | if (error) | ||
604 | 452 | { | ||
605 | 453 | rc= attachsql_error_code(error); | ||
606 | 454 | if (rc == 1213 || rc == 1205 || rc == 1020) | ||
607 | 455 | { | ||
608 | 456 | attachsql_error_free(error); | ||
609 | 457 | return SB_DB_ERROR_DEADLOCK; | ||
610 | 458 | } | ||
611 | 459 | log_text(LOG_ALERT, "libAttachSQL Query Failed: %u:%s", attachsql_error_code(error), attachsql_error_message(error)); | ||
612 | 460 | attachsql_error_free(error); | ||
613 | 461 | return SB_DB_ERROR_FAILED; | ||
614 | 462 | } | ||
615 | 463 | } | ||
616 | 464 | //rs->connection->ptr= con; | ||
617 | 465 | DEBUG("attachsql_query \"%s\" returned %d", query, aret); | ||
618 | 466 | |||
619 | 467 | return SB_DB_ERROR_NONE; | ||
620 | 468 | } | ||
621 | 469 | |||
622 | 470 | |||
623 | 471 | /* Fetch row from result set of a prepared statement */ | ||
624 | 472 | |||
625 | 473 | |||
626 | 474 | int attachsql_drv_fetch(db_result_set_t *rs) | ||
627 | 475 | { | ||
628 | 476 | /* NYI */ | ||
629 | 477 | attachsql_connect_t *con = rs->connection->ptr; | ||
630 | 478 | size_t tmp_len; | ||
631 | 479 | uint16_t columns, col; | ||
632 | 480 | attachsql_return_t aret= ATTACHSQL_RETURN_NONE; | ||
633 | 481 | attachsql_error_t *error= NULL; | ||
634 | 482 | |||
635 | 483 | while((aret != ATTACHSQL_RETURN_EOF) && (aret != ATTACHSQL_RETURN_ROW_READY)) | ||
636 | 484 | { | ||
637 | 485 | aret= attachsql_connect_poll(con, &error); | ||
638 | 486 | |||
639 | 487 | if (error) | ||
640 | 488 | { | ||
641 | 489 | log_text(LOG_ALERT, "libAttachSQL Query Failed: %u:%s", attachsql_error_code(error), attachsql_error_message(error)); | ||
642 | 490 | attachsql_error_free(error); | ||
643 | 491 | return 1; | ||
644 | 492 | } | ||
645 | 493 | } | ||
646 | 494 | if (aret == ATTACHSQL_RETURN_EOF) | ||
647 | 495 | { | ||
648 | 496 | return 1; | ||
649 | 497 | } | ||
650 | 498 | attachsql_statement_row_get(con, NULL); | ||
651 | 499 | columns= attachsql_query_column_count(con); | ||
652 | 500 | for (col= 0; col < columns; col++) | ||
653 | 501 | { | ||
654 | 502 | switch (attachsql_statement_get_column_type(con, col)) | ||
655 | 503 | { | ||
656 | 504 | case ATTACHSQL_COLUMN_TYPE_TINY: | ||
657 | 505 | case ATTACHSQL_COLUMN_TYPE_SHORT: | ||
658 | 506 | case ATTACHSQL_COLUMN_TYPE_LONG: | ||
659 | 507 | case ATTACHSQL_COLUMN_TYPE_YEAR: | ||
660 | 508 | case ATTACHSQL_COLUMN_TYPE_INT24: | ||
661 | 509 | attachsql_statement_get_int(con, col, &error); | ||
662 | 510 | break; | ||
663 | 511 | case ATTACHSQL_COLUMN_TYPE_LONGLONG: | ||
664 | 512 | attachsql_statement_get_bigint(con, col, &error); | ||
665 | 513 | break; | ||
666 | 514 | case ATTACHSQL_COLUMN_TYPE_FLOAT: | ||
667 | 515 | attachsql_statement_get_float(con, col, &error); | ||
668 | 516 | break; | ||
669 | 517 | case ATTACHSQL_COLUMN_TYPE_DOUBLE: | ||
670 | 518 | attachsql_statement_get_double(con, col, &error); | ||
671 | 519 | break; | ||
672 | 520 | default: | ||
673 | 521 | attachsql_statement_get_char(con, col, &tmp_len, &error); | ||
674 | 522 | break; | ||
675 | 523 | } | ||
676 | 524 | } | ||
677 | 525 | attachsql_query_row_next(con); | ||
678 | 526 | |||
679 | 527 | return 0; | ||
680 | 528 | } | ||
681 | 529 | |||
682 | 530 | |||
683 | 531 | /* Fetch row from result set of a query */ | ||
684 | 532 | |||
685 | 533 | |||
686 | 534 | int attachsql_drv_fetch_row(db_result_set_t *rs, db_row_t *row) | ||
687 | 535 | { | ||
688 | 536 | attachsql_error_t *error= NULL; | ||
689 | 537 | attachsql_return_t aret= ATTACHSQL_RETURN_NONE; | ||
690 | 538 | |||
691 | 539 | /* NYI */ | ||
692 | 540 | |||
693 | 541 | attachsql_connect_t *con = rs->connection->ptr; | ||
694 | 542 | |||
695 | 543 | while((aret != ATTACHSQL_RETURN_EOF) && (aret != ATTACHSQL_RETURN_ROW_READY)) | ||
696 | 544 | { | ||
697 | 545 | aret= attachsql_connect_poll(con, &error); | ||
698 | 546 | |||
699 | 547 | if (error) | ||
700 | 548 | { | ||
701 | 549 | log_text(LOG_ALERT, "libAttachSQL Query Failed: %u:%s", attachsql_error_code(error), attachsql_error_message(error)); | ||
702 | 550 | attachsql_error_free(error); | ||
703 | 551 | return 1; | ||
704 | 552 | } | ||
705 | 553 | } | ||
706 | 554 | if (aret == ATTACHSQL_RETURN_EOF) | ||
707 | 555 | { | ||
708 | 556 | return 1; | ||
709 | 557 | } | ||
710 | 558 | row->ptr= attachsql_query_row_get(con, NULL); | ||
711 | 559 | attachsql_query_row_next(con); | ||
712 | 560 | |||
713 | 561 | return 0; | ||
714 | 562 | } | ||
715 | 563 | |||
716 | 564 | |||
717 | 565 | /* Return the number of rows in a result set */ | ||
718 | 566 | |||
719 | 567 | |||
720 | 568 | unsigned long long attachsql_drv_num_rows(db_result_set_t *rs) | ||
721 | 569 | { | ||
722 | 570 | return rs->nrows; | ||
723 | 571 | } | ||
724 | 572 | |||
725 | 573 | |||
726 | 574 | /* Store results from the last query */ | ||
727 | 575 | |||
728 | 576 | |||
729 | 577 | int attachsql_drv_store_results(db_result_set_t *rs) | ||
730 | 578 | { | ||
731 | 579 | int ret= 0; | ||
732 | 580 | db_row_t row; | ||
733 | 581 | /* libAttachSQL can't do things in this order */ | ||
734 | 582 | while (ret == 0) | ||
735 | 583 | { | ||
736 | 584 | if (rs->statement != NULL) | ||
737 | 585 | { | ||
738 | 586 | ret= attachsql_drv_fetch(rs); | ||
739 | 587 | } | ||
740 | 588 | else | ||
741 | 589 | { | ||
742 | 590 | ret= attachsql_drv_fetch_row(rs, &row); | ||
743 | 591 | } | ||
744 | 592 | } | ||
745 | 593 | |||
746 | 594 | return SB_DB_ERROR_NONE; | ||
747 | 595 | } | ||
748 | 596 | |||
749 | 597 | |||
750 | 598 | /* Free result set */ | ||
751 | 599 | |||
752 | 600 | |||
753 | 601 | int attachsql_drv_free_results(db_result_set_t *rs) | ||
754 | 602 | { | ||
755 | 603 | |||
756 | 604 | if (rs->connection->ptr != NULL) | ||
757 | 605 | { | ||
758 | 606 | DEBUG("attachsql_query_close(%p)", rs->connection->ptr); | ||
759 | 607 | attachsql_query_close(rs->connection->ptr); | ||
760 | 608 | return 0; | ||
761 | 609 | } | ||
762 | 610 | |||
763 | 611 | return 1; | ||
764 | 612 | } | ||
765 | 613 | |||
766 | 614 | |||
767 | 615 | /* Close prepared statement */ | ||
768 | 616 | |||
769 | 617 | |||
770 | 618 | int attachsql_drv_close(db_stmt_t *stmt) | ||
771 | 619 | { | ||
772 | 620 | attachsql_connect_t *con= (attachsql_connect_t *)stmt->connection->ptr; | ||
773 | 621 | attachsql_statement_close(con); | ||
774 | 622 | |||
775 | 623 | return 0; | ||
776 | 624 | } | ||
777 | 625 | |||
778 | 626 | |||
779 | 627 | /* Uninitialize driver */ | ||
780 | 628 | int attachsql_drv_done(void) | ||
781 | 629 | { | ||
782 | 630 | return 0; | ||
783 | 631 | } | ||
784 | 632 | |||
785 | 0 | 633 | ||
786 | === modified file 'sysbench/tests/db/common.lua' | |||
787 | --- sysbench/tests/db/common.lua 2011-12-01 19:43:29 +0000 | |||
788 | +++ sysbench/tests/db/common.lua 2014-10-16 09:41:21 +0000 | |||
789 | @@ -20,7 +20,7 @@ | |||
790 | 20 | i = table_id | 20 | i = table_id |
791 | 21 | 21 | ||
792 | 22 | print("Creating table 'sbtest" .. i .. "'...") | 22 | print("Creating table 'sbtest" .. i .. "'...") |
794 | 23 | if (db_driver == "mysql") then | 23 | if ((db_driver == "mysql") or (db_driver == "attachsql")) then |
795 | 24 | query = [[ | 24 | query = [[ |
796 | 25 | CREATE TABLE sbtest]] .. i .. [[ ( | 25 | CREATE TABLE sbtest]] .. i .. [[ ( |
797 | 26 | id INTEGER UNSIGNED NOT NULL ]] .. | 26 | id INTEGER UNSIGNED NOT NULL ]] .. |
798 | 27 | 27 | ||
799 | === modified file 'sysbench/tests/db/oltp.lua' | |||
800 | --- sysbench/tests/db/oltp.lua 2011-12-01 19:43:29 +0000 | |||
801 | +++ sysbench/tests/db/oltp.lua 2014-10-16 09:41:21 +0000 | |||
802 | @@ -5,7 +5,7 @@ | |||
803 | 5 | function thread_init(thread_id) | 5 | function thread_init(thread_id) |
804 | 6 | set_vars() | 6 | set_vars() |
805 | 7 | 7 | ||
807 | 8 | if (db_driver == "mysql" and mysql_table_engine == "myisam") then | 8 | if (((db_driver == "mysql") or (db_driver == "attachsql")) and mysql_table_engine == "myisam") then |
808 | 9 | begin_query = "LOCK TABLES sbtest WRITE" | 9 | begin_query = "LOCK TABLES sbtest WRITE" |
809 | 10 | commit_query = "UNLOCK TABLES" | 10 | commit_query = "UNLOCK TABLES" |
810 | 11 | else | 11 | else |
811 | 12 | 12 | ||
812 | === modified file 'sysbench/tests/db/select_random_points.lua' | |||
813 | --- sysbench/tests/db/select_random_points.lua 2010-10-29 02:15:54 +0000 | |||
814 | +++ sysbench/tests/db/select_random_points.lua 2014-10-16 09:41:21 +0000 | |||
815 | @@ -14,7 +14,7 @@ | |||
816 | 14 | 14 | ||
817 | 15 | print("Creating table 'sbtest'...") | 15 | print("Creating table 'sbtest'...") |
818 | 16 | 16 | ||
820 | 17 | if (db_driver == "mysql") then | 17 | if ((db_driver == "mysql") or (db_driver == "attachsql")) then |
821 | 18 | query = [[ | 18 | query = [[ |
822 | 19 | CREATE TABLE sbtest ( | 19 | CREATE TABLE sbtest ( |
823 | 20 | id INTEGER UNSIGNED NOT NULL ]] .. ((oltp_auto_inc and "AUTO_INCREMENT") or "") .. [[, | 20 | id INTEGER UNSIGNED NOT NULL ]] .. ((oltp_auto_inc and "AUTO_INCREMENT") or "") .. [[, |
824 | 21 | 21 | ||
825 | === modified file 'sysbench/tests/db/select_random_ranges.lua' | |||
826 | --- sysbench/tests/db/select_random_ranges.lua 2010-10-29 02:15:54 +0000 | |||
827 | +++ sysbench/tests/db/select_random_ranges.lua 2014-10-16 09:41:21 +0000 | |||
828 | @@ -14,7 +14,7 @@ | |||
829 | 14 | 14 | ||
830 | 15 | print("Creating table 'sbtest'...") | 15 | print("Creating table 'sbtest'...") |
831 | 16 | 16 | ||
833 | 17 | if (db_driver == "mysql") then | 17 | if ((db_driver == "mysql") or (db_driver == "attachsql")) then |
834 | 18 | query = [[ | 18 | query = [[ |
835 | 19 | CREATE TABLE sbtest ( | 19 | CREATE TABLE sbtest ( |
836 | 20 | id INTEGER UNSIGNED NOT NULL ]] .. ((oltp_auto_inc and "AUTO_INCREMENT") or "") .. [[, | 20 | id INTEGER UNSIGNED NOT NULL ]] .. ((oltp_auto_inc and "AUTO_INCREMENT") or "") .. [[, |