r9531: * db-postgresql/postgresl-sql.lisp: Avoid computing
[clsql.git] / db-mysql / mysql-api.lisp
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          mysql-api.lisp
6 ;;;; Purpose:       Low-level MySQL interface using UFFI
7 ;;;; Programmers:   Kevin M. Rosenberg based on 
8 ;;;;                Original code by Pierre R. Mai 
9 ;;;; Date Started:  Feb 2002
10 ;;;;
11 ;;;; $Id$
12 ;;;;
13 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
14 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
15 ;;;;
16 ;;;; CLSQL users are granted the rights to distribute and use this software
17 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
18 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
19 ;;;; *************************************************************************
20
21 (in-package #:mysql)
22
23 ;;;; Modifications from original code
24 ;;;;  - Updated C-structures to conform to structures in MySQL 3.23.46
25 ;;;;  - Changed from CMUCL interface to UFFI
26 ;;;;  - Added and call a C-helper file to support 64-bit integers
27 ;;;;    that are used in a few routines.
28 ;;;;  - Removed all references to interiors of C-structions, this will
29 ;;;;    increase robustness when MySQL's internal structures change.
30  
31 ;;;; Type definitions
32
33 ;;; Basic Types
34
35 (uffi:def-foreign-type mysql-socket :int)
36 (uffi:def-foreign-type mysql-bool :byte)
37 (uffi:def-foreign-type mysql-byte :unsigned-char)
38
39 (uffi:def-enum mysql-net-type
40     (:tcp-ip
41      :socket
42      :named-pipe))
43
44 (uffi:def-struct mysql-net
45     (vio :pointer-void)
46   (fd mysql-socket)
47   (fcntl :int)
48   (buff (* :unsigned-char))
49   (buff-end (* :unsigned-char))
50   (write-pos (* :unsigned-char))
51   (read-pos (* :unsigned-char))
52   (last-error (:array :char 200))
53   (last-errno :unsigned-int)
54   (max-packet :unsigned-int)
55   (timeout :unsigned-int)
56   (pkt-nr :unsigned-int)
57   (error mysql-bool)
58   (return-errno mysql-bool)
59   (compress mysql-bool)
60   (no-send-ok mysql-bool)
61   (remain-in-buf :unsigned-long)
62   (length :unsigned-long)
63   (buf-length :unsigned-long)
64   (where-b :unsigned-long)
65   (return-status (* :unsigned-int))
66   (reading-or-writing :unsigned-char)
67   (save-char :char))
68
69 ;;; Mem-Root
70 (uffi:def-struct mysql-used-mem
71     (next :pointer-self)
72   (left :unsigned-int)
73   (size :unsigned-int))
74
75 (uffi:def-struct mysql-mem-root
76     (free (:struct-pointer mysql-used-mem))
77   (used (:struct-pointer mysql-used-mem))
78   (pre-alloc (:struct-pointer mysql-used-mem))
79   (min-alloc :unsigned-int)
80   (block-size :unsigned-int)
81   (error-handler :pointer-void))
82
83 ;;; MYSQL-FIELD
84 (uffi:def-enum mysql-field-types
85     (:decimal
86      :tiny
87      :short
88      :long
89      :float
90      :double
91      :null
92      :timestamp
93      :longlong
94      :int24
95      :date
96      :time
97      :datetime
98      :year
99      :newdate
100      (:enum 247)
101      (:set 248)
102      (:tiny-blob 249)
103      (:medium-blob 250)
104      (:long-blob 251)
105      (:blob 252)
106      (:var-string 253)
107      (:string 254)
108      (:geometry 255)))
109
110 #+mysql-client-v3
111 (uffi:def-struct mysql-field
112     (name (* :char))
113   (table (* :char))
114   (def (* :char))
115   (type mysql-field-types)
116   (length :unsigned-int)
117   (max-length :unsigned-int)
118   (flags :unsigned-int)
119   (decimals :unsigned-int))
120
121 ;; structure changed in mysql 4 client
122 #+(and mysql-client-v4 (not mysql-client-v4.1))
123 (uffi:def-struct mysql-field
124     (name (* :char))
125   (table (* :char))
126   (org_table (* :char))
127   (db (* :char))
128   (def (* :char))
129   (length :unsigned-long)
130   (max-length :unsigned-long)
131   (flags :unsigned-int)
132   (decimals :unsigned-int)
133   (type mysql-field-types))
134
135 #+mysql-client-v4.1
136 (uffi:def-struct mysql-field
137     (name (* :char))
138   (org_table (* :char))
139   (table (* :char))
140   (org_table (* :char))
141   (db (* :char))
142   (catalog_db (* :char))
143   (def (* :char))
144   (length :unsigned-long)
145   (max-length :unsigned-long)
146   (name-length :unsigned-int)
147   (org-name-length :unsigned-int)
148   (table-length :unsigned-int)
149   (org-table-length :unsigned-int)
150   (db-length :unsigned-int)
151   (catalog-length :unsigned-int)
152   (def-length :unsigned-int)
153   (flags :unsigned-int)
154   (decimals :unsigned-int)
155   (charsetnr :unsigned-int)
156   (type mysql-field-types))
157
158 ;;; MYSQL-ROWS
159
160 (uffi:def-array-pointer mysql-row (* :unsigned-char))
161
162 (uffi:def-array-pointer mysql-field-vector (* mysql-field))
163
164 (uffi:def-foreign-type mysql-field-offset :unsigned-int)
165
166 (uffi:def-struct mysql-rows
167     (next :pointer-self)
168   (data mysql-row))
169
170 (uffi:def-foreign-type mysql-row-offset (:struct-pointer mysql-rows))
171
172 (uffi:def-struct mysql-data
173     (rows-high32 :unsigned-long)
174   (rows-low32 :unsigned-long)
175   (fields :unsigned-int)
176   (data (:struct-pointer mysql-rows))
177   (alloc (:struct mysql-mem-root)))
178
179 ;;; MYSQL
180 (uffi:def-struct mysql-options
181     (connect-timeout :unsigned-int)
182   (client-flag :unsigned-int)
183   (compress mysql-bool)
184   (named-pipe mysql-bool)
185   (port :unsigned-int)
186   (host (* :char))
187   (init-command (* :char))
188   (user (* :char))
189   (password (* :char))
190   (unix-socket (* :char))
191   (db (* :char))
192   (my-cnf-file (* :char))
193   (my-cnf-group (* :char))
194   (charset-dir (* :char))
195   (charset-name (* :char))
196   (use-ssl mysql-bool)
197   (ssl-key (* :char))
198   (ssl-cert (* :char))
199   (ssl-ca (* :char))
200   (ssl-capath (* :char)))
201
202 (uffi:def-enum mysql-option
203     (:connect-timeout
204      :compress
205      :named-pipe
206      :init-command
207      :read-default-file
208      :read-default-group))
209
210 (uffi:def-enum mysql-status
211     (:ready 
212      :get-result
213      :use-result))
214
215 (uffi:def-struct mysql-mysql
216     (net (:struct mysql-net))
217   (connected-fd (* :char))
218   (host (* :char))
219   (user (* :char))
220   (passwd (* :char))
221   (unix-socket (* :char))
222   (server-version (* :char))
223   (host-info (* :char))
224   (info (* :char))
225   (db (* :char))
226   (port :unsigned-int)
227   (client-flag :unsigned-int)
228   (server-capabilities :unsigned-int)
229   (protocol-version :unsigned-int)
230   (field-count :unsigned-int)
231   (server-status :unsigned-int)
232   (thread-id :unsigned-long)
233   (affected-rows-high32 :unsigned-long)
234   (affected-rows-low32 :unsigned-long)
235   (insert-id-high32 :unsigned-long)
236   (insert-id-low32 :unsigned-long)
237   (extra-info-high32 :unsigned-long)
238   (extra-info-low32 :unsigned-long)
239   (packet-length :unsigned-long)
240   (status mysql-status)
241   (fields (:struct-pointer mysql-field))
242   (field-alloc (:struct mysql-mem-root))
243   (free-me mysql-bool)
244   (reconnect mysql-bool)
245   (options (:struct mysql-options))
246   (scramble-buff (:array :char 9))
247   (charset :pointer-void)
248   (server-language :unsigned-int))
249
250
251 ;;; MYSQL-RES
252 (uffi:def-struct mysql-mysql-res
253     (row-count-high32 :unsigned-long)
254   (row-count-low32 :unsigned-long)
255   (field-count :unsigned-int)
256   (current-field :unsigned-int)
257   (fields (:struct-pointer mysql-field))
258   (data (:struct-pointer mysql-data))
259   (data-cursor (:struct-pointer mysql-rows))
260   (field-alloc (:struct mysql-mem-root))
261   (row mysql-row)
262   (current-row mysql-row)
263   (lengths (* :unsigned-long))
264   (handle (:struct-pointer mysql-mysql))
265   (eof mysql-bool))
266
267 #+mysql-client-4.1
268 (uffi:def-enum mysql-field-types
269     (:ready 
270      :get-result
271      :use-result))
272
273 #+mysql-client-v4.1
274 (uffi:def-struct mysql-bind
275     (length (* :unsigned-long))
276   (is-null (* mysql-bool))
277   (buffer :pointer-void)
278   (buffer-type :int)
279   (buffer-length :unsigned-long)
280   ;; internal use
281   (inter_buffer (* :unsigned-char))
282   (offset :unsigned-long)
283   (internal-length :unsigned-long)
284   (param-number :unsigned-int)
285   (pack-length :unsigned-int)
286   (is-signed mysql-bool)
287   (long-data-used mysql-bool)
288   (internal-is-null mysql-bool)
289   (store-param-func :pointer-void)
290   (fetch-result :pointer-void)
291   (skip-result :pointer-void))
292
293 ;;;; The Foreign C routines
294 (declaim (inline mysql-init))
295 (uffi:def-function "mysql_init"
296   ((mysql (* mysql-mysql)))
297   :module "mysql" 
298   :returning (* mysql-mysql))
299
300 #-mysql-client-v4
301 (declaim (inline mysql-connect))
302 #-mysql-client-v4
303 (uffi:def-function "mysql_connect"
304     ((mysql (* mysql-mysql))
305      (host :cstring)
306      (user :cstring)
307      (passwd :cstring))
308   :module "mysql"
309   :returning (* mysql-mysql))
310
311 ;; Need to comment this out for LW 4.2.6
312 ;; ? bug in LW version
313 #-lispworks (declaim (inline mysql-real-connect))
314 (uffi:def-function "mysql_real_connect"
315     ((mysql (* mysql-mysql))
316      (host :cstring)
317      (user :cstring)
318      (passwd :cstring)
319      (db :cstring)
320      (port :unsigned-int)
321      (unix-socket :cstring)
322      (clientflag :unsigned-long))
323   :module "mysql"
324   :returning (* mysql-mysql))
325
326 (declaim (inline mysql-close))
327 (uffi:def-function "mysql_close"
328     ((sock (* mysql-mysql)))
329   :module "mysql"
330   :returning :void)
331
332 (declaim (inline mysql-select-db))
333 (uffi:def-function "mysql_select_db"
334   ((mysql (* mysql-mysql))
335    (db :cstring))
336   :module "mysql"
337   :returning :int)
338
339 (declaim (inline mysql-query))
340 (uffi:def-function "mysql_query"
341     ((mysql (* mysql-mysql))
342      (query :cstring))
343   :module "mysql"
344   :returning :int)
345
346  ;;; I doubt that this function is really useful for direct Lisp usage,
347 ;;; but it is here for completeness...
348
349 (declaim (inline mysql-real-query))
350 (uffi:def-function "mysql_real_query"
351     ((mysql (* mysql-mysql))
352      (query :cstring)
353      (length :unsigned-int))
354   :module "mysql"
355   :returning :int)
356
357 #-mysql-client-v4
358 (declaim (inline mysql-create-db))
359 #-mysql-client-v4
360 (uffi:def-function "mysql_create_db"
361   ((mysql (* mysql-mysql))
362    (db :cstring))
363   :module "mysql"
364   :returning :int)
365
366 #-mysql-client-v4
367 (declaim (inline mysql-drop-db))
368 #-mysql-client-v4
369 (uffi:def-function "mysql_drop_db"
370     ((mysql (* mysql-mysql))
371      (db :cstring))
372   :module "mysql"
373   :returning :int)
374
375 (declaim (inline mysql-shutdown))
376 (uffi:def-function "mysql_shutdown"
377   ((mysql (* mysql-mysql)))
378   :module "mysql"
379   :returning :int)
380
381 (declaim (inline mysql-dump-debug-info))
382 (uffi:def-function "mysql_dump_debug_info"
383   ((mysql (* mysql-mysql)))
384   :module "mysql"
385   :returning :int)
386
387 (declaim (inline mysql-refresh))
388 (uffi:def-function "mysql_refresh"
389   ((mysql (* mysql-mysql))
390    (refresh-options :unsigned-int))
391   :module "mysql"
392   :returning :int)
393
394 (declaim (inline mysql-kill))
395 (uffi:def-function "mysql_kill"
396     ((mysql (* mysql-mysql))
397      (pid :unsigned-long))
398   :module "mysql"
399   :returning :int)
400
401 (declaim (inline mysql-ping))
402 (uffi:def-function "mysql_ping"
403     ((mysql (* mysql-mysql)))
404   :module "mysql"
405   :returning :int)
406
407 (declaim (inline mysql-stat))
408 (uffi:def-function "mysql_stat"
409   ((mysql (* mysql-mysql)))
410   :module "mysql"
411   :returning :cstring)
412
413 (declaim (inline mysql-get-server-info))
414 (uffi:def-function "mysql_get_server_info"
415     ((mysql (* mysql-mysql)))
416   :module "mysql"
417   :returning :cstring)
418
419 (declaim (inline mysql-get-host-info))
420 (uffi:def-function "mysql_get_host_info"
421     ((mysql (* mysql-mysql)))
422   :module "mysql"
423   :returning :cstring)
424
425 (declaim (inline mysql-get-proto-info))
426 (uffi:def-function "mysql_get_proto_info"
427   ((mysql (* mysql-mysql)))
428   :module "mysql"
429   :returning :unsigned-int)
430
431 (declaim (inline mysql-list-dbs))
432 (uffi:def-function "mysql_list_dbs"
433   ((mysql (* mysql-mysql))
434    (wild :cstring))
435   :module "mysql"
436   :returning (* mysql-mysql-res))
437
438 (declaim (inline mysql-list-tables))
439 (uffi:def-function "mysql_list_tables"
440   ((mysql (* mysql-mysql))
441    (wild :cstring))
442   :module "mysql"
443   :returning (* mysql-mysql-res))
444
445 (declaim (inline mysql-list-fields))
446 (uffi:def-function "mysql_list_fields"
447   ((mysql (* mysql-mysql))
448    (table :cstring)
449    (wild :cstring))
450   :module "mysql"
451   :returning (* mysql-mysql-res))
452
453 (declaim (inline mysql-list-processes))
454 (uffi:def-function "mysql_list_processes"
455   ((mysql (* mysql-mysql)))
456   :module "mysql"
457   :returning (* mysql-mysql-res))
458
459 (declaim (inline mysql-store-result))
460 (uffi:def-function "mysql_store_result"
461   ((mysql (* mysql-mysql)))
462   :module "mysql"
463   :returning (* mysql-mysql-res))
464
465 (declaim (inline mysql-use-result))
466 (uffi:def-function "mysql_use_result"
467   ((mysql (* mysql-mysql)))
468   :module "mysql"
469   :returning (* mysql-mysql-res))
470
471 (declaim (inline mysql-options))
472 (uffi:def-function "mysql_options"
473   ((mysql (* mysql-mysql))
474    (option mysql-option)
475    (arg :cstring))
476   :module "mysql"
477   :returning :int)
478
479 (declaim (inline mysql-free-result))
480 (uffi:def-function "mysql_free_result"
481     ((res (* mysql-mysql-res)))
482   :module "mysql"
483   :returning :void)
484
485 (declaim (inline mysql-row-seek))
486 (uffi:def-function "mysql_row_seek"
487   ((res (* mysql-mysql-res))
488    (offset mysql-row-offset))
489   :module "mysql"
490   :returning mysql-row-offset)
491
492 (declaim (inline mysql-field-seek))
493 (uffi:def-function "mysql_field_seek"
494   ((res (* mysql-mysql-res))
495   (offset mysql-field-offset))
496   :module "mysql"
497   :returning mysql-field-offset)
498
499 (declaim (inline mysql-fetch-row))
500 (uffi:def-function "mysql_fetch_row"
501     ((res (* mysql-mysql-res)))
502   :module "mysql"
503   :returning (* (* :unsigned-char)))
504
505 (declaim (inline mysql-fetch-lengths))
506 (uffi:def-function "mysql_fetch_lengths"
507   ((res (* mysql-mysql-res)))
508   :module "mysql"
509   :returning (* :unsigned-long))
510
511 (declaim (inline mysql-fetch-field))
512 (uffi:def-function "mysql_fetch_field"
513   ((res (* mysql-mysql-res)))
514   :module "mysql"
515   :returning (* mysql-field))
516
517 (declaim (inline mysql-fetch-fields))
518 (uffi:def-function "mysql_fetch_fields"
519   ((res (* mysql-mysql-res)))
520   :module "mysql"
521   :returning (* mysql-field))
522
523 (declaim (inline mysql-fetch-field-direct))
524 (uffi:def-function "mysql_fetch_field_direct"
525   ((res (* mysql-mysql-res))
526    (field-num :unsigned-int))
527   :module "mysql"
528   :returning (* mysql-field))
529
530 (declaim (inline mysql-escape-string))
531 (uffi:def-function "mysql_escape_string"
532     ((to :cstring)
533      (from :cstring)
534      (length :unsigned-int))
535   :module "mysql"
536   :returning :unsigned-int)
537
538 (declaim (inline mysql-debug))
539 (uffi:def-function "mysql_debug"
540     ((debug :cstring))
541   :module "mysql"
542   :returning :void)
543
544 (declaim (inline clsql-mysql-num-rows))
545 (uffi:def-function "clsql_mysql_num_rows"
546     ((res (* mysql-mysql-res))
547      (p-high32 (* :unsigned-int)))
548   :module "clsql-mysql"
549   :returning :unsigned-int)
550
551 #+mysql-client-v4.1
552 (uffi:def-foreign-type mysql-stmt-ptr :pointer-void)
553
554 #+mysql-client-v4.1
555 (uffi:def-function "mysql_stmt_init"
556     ((res (* mysql-mysql-res)))
557   :module "clsql-mysql"
558   :returning mysql-stmt-ptr)
559
560 #+mysql-client-v4.1
561 (uffi:def-function "mysql_stmt_prepare"
562     ((stmt mysql-stmt-ptr)
563      (query :cstring)
564      (length :unsigned-long))
565   :module "clsql-mysql"
566   :returning :int)
567
568 #+mysql-client-v4.1
569 (uffi:def-function "mysql_stmt_param_count"
570     ((stmt mysql-stmt-ptr))
571   :module "clsql-mysql"
572   :returning :unsigned-int)
573
574 #+mysql-client-v4.1
575 (uffi:def-function "mysql_stmt_bind_param"
576     ((stmt mysql-stmt-ptr)
577      (bind (* mysql-bind)))
578   :module "clsql-mysql"
579   :returning :short)
580
581 #+mysql-client-v4.1
582 (uffi:def-function "mysql_stmt_bind_result"
583     ((stmt mysql-stmt-ptr)
584      (bind (* mysql-bind)))
585   :module "clsql-mysql"
586   :returning :short)
587
588 #+mysql-client-v4.1
589 (uffi:def-function "mysql_stmt_result_metadata"
590     ((stmt mysql-stmt-ptr))
591   :module "clsql-mysql"
592   :returning (* mysql-mysql-res))
593
594
595 #+mysql-client-v4.1
596 (uffi:def-function "mysql_stmt_execute"
597     ((stmt mysql-stmt-ptr))
598   :module "clsql-mysql"
599   :returning :int)
600
601 #+mysql-client-v4.1
602 (uffi:def-function "mysql_stmt_fetch"
603     ((stmt mysql-stmt-ptr))
604   :module "clsql-mysql"
605   :returning :int)
606
607 #+mysql-client-v4.1
608 (uffi:def-function "mysql_stmt_free_result"
609     ((stmt mysql-stmt-ptr))
610   :module "clsql-mysql"
611   :returning :short)
612
613 #+mysql-client-v4.1
614 (uffi:def-function "mysql_stmt_close"
615     ((stmt mysql-stmt-ptr))
616   :module "clsql-mysql"
617   :returning :short)
618
619 #+mysql-client-v4.1
620 (uffi:def-function "mysql_stmt_errno"
621     ((stmt mysql-stmt-ptr))
622   :module "clsql-mysql"
623   :returning :unsigned-int)
624
625 #+mysql-client-v4.1
626 (uffi:def-function "mysql_stmt_error"
627     ((stmt mysql-stmt-ptr))
628   :module "clsql-mysql"
629   :returning :cstring)
630
631
632 ;;;; Equivalents of C Macro definitions for accessing various fields
633 ;;;; in the internal MySQL Datastructures
634
635
636 (declaim (inline mysql-num-rows))
637 (defun mysql-num-rows (res)
638   (uffi:with-foreign-object (p-high32 :unsigned-int)
639     (let ((low32 (clsql-mysql-num-rows res p-high32))
640           (high32 (uffi:deref-pointer p-high32 :unsigned-int)))
641       (if (zerop high32)
642           low32
643         (make-64-bit-integer high32 low32)))))
644
645 (uffi:def-function "clsql_mysql_affected_rows"
646     ((mysql (* mysql-mysql))
647      (p-high32 (* :unsigned-int)))
648   :returning :unsigned-int
649   :module "clsql-mysql")
650
651 (defun mysql-affected-rows (mysql)
652   (uffi:with-foreign-object (p-high32 :unsigned-int)
653     (let ((low32 (clsql-mysql-affected-rows mysql p-high32))
654           (high32 (uffi:deref-pointer p-high32 :unsigned-int)))
655       (if (zerop high32)
656           low32
657         (make-64-bit-integer high32 low32)))))
658
659 (uffi:def-function "clsql_mysql_insert_id"
660     ((res (* mysql-mysql))
661      (p-high32 (* :unsigned-int)))
662   :returning :unsigned-int
663   :module "clsql-mysql")
664
665 (defun mysql-insert-id (mysql)
666   (uffi:with-foreign-object (p-high32 :unsigned-int)
667   (let ((low32 (clsql-mysql-insert-id mysql p-high32))
668         (high32 (uffi:deref-pointer p-high32 :unsigned-int)))
669     (if (zerop high32)
670         low32
671       (make-64-bit-integer high32 low32)))))
672
673
674 (declaim (inline mysql-num-fields))
675 (uffi:def-function "mysql_num_fields" 
676   ((res (* mysql-mysql-res)))
677   :returning :unsigned-int
678   :module "mysql")
679                  
680 (declaim (inline clsql-mysql-eof))
681 (uffi:def-function ("mysql_eof" clsql-mysql-eof)
682   ((res (* mysql-mysql-res)))
683   :returning :char
684   :module "mysql")
685
686 (declaim (inline mysql-eof))
687 (defun mysql-eof (res)
688   (if (zerop (clsql-mysql-eof res))
689       nil
690     t))
691
692 (declaim (inline mysql-error))
693 (uffi:def-function ("mysql_error" mysql-error)
694   ((mysql (* mysql-mysql)))
695   :returning :cstring
696   :module "mysql")
697
698 (declaim (inline mysql-error-string))
699 (defun mysql-error-string (mysql)
700   (uffi:convert-from-cstring (mysql-error mysql)))
701
702 (declaim (inline mysql-errno))
703 (uffi:def-function "mysql_errno"
704   ((mysql (* mysql-mysql)))
705   :returning :unsigned-int
706   :module "mysql")
707
708 (declaim (inline mysql-info))
709 (uffi:def-function ("mysql_info" mysql-info)
710   ((mysql (* mysql-mysql)))
711   :returning :cstring
712   :module "mysql")
713
714 (declaim (inline mysql-info-string))
715 (defun mysql-info-string (mysql)
716   (uffi:convert-from-cstring (mysql-info mysql)))
717
718 (declaim (inline clsql-mysql-data-seek))
719 (uffi:def-function "clsql_mysql_data_seek"
720   ((res (* mysql-mysql-res))
721    (offset-high32 :unsigned-int)
722    (offset-low32 :unsigned-int))
723   :module "clsql-mysql"
724   :returning :void)
725
726 (defun mysql-data-seek (res offset)
727   (multiple-value-bind (high32 low32) (split-64-bit-integer offset)
728     (clsql-mysql-data-seek res high32 low32)))