r10574: start renaming
authorKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 8 Jun 2005 19:21:06 +0000 (19:21 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Wed, 8 Jun 2005 19:21:06 +0000 (19:21 +0000)
db-mysql/Makefile
db-mysql/Makefile.msvc
db-mysql/clsql_mysql.dll [new file with mode: 0644]
db-mysql/clsql_mysql.lib [new file with mode: 0644]
db-mysql/mysql-loader.lisp
db-mysql/mysql.c [deleted file]
db-mysql/mysql.dll [deleted file]
db-mysql/mysql.lib [deleted file]
db-mysql/uffi_mysql.c [new file with mode: 0644]

index 70a2d1822213c279b06fca625c07af4f5302c5fd..dd47bc5d846c43ac6a9f4b0c07edebe26f685479 100644 (file)
@@ -17,16 +17,16 @@ SUBDIRS=
 
 include ../Makefile.common
 
-base=mysql
+base=uffi_mysql
 source=$(base).c
 object=$(base).o
-shared_lib=$(base).so
+shared_lib=uffi_mysql.so
 
 .PHONY: all
 all: $(shared_lib)
 
 $(shared_lib): $(source) Makefile
-       CFLAGS="-I /usr/local/include/mysql -I /usr/include/mysql -I /sw/include/mysql -I /opt/local/include/mysql" LDFLAGS="-L/usr/local/lib64/mysql -L/usr/lib/mysql -L/sw/lib -L/opt/local/lib/mysql -lmysqlclient" BASE=$(base) OBJECT=$(object) SOURCE=$(source) SHARED_LIB=$(shared_lib) sh make.sh
+       CFLAGS="-I /usr/local/include/mysql -I /usr/include/mysql -I /sw/include/mysql -I /opt/local/include/mysql" LDFLAGS="-L/usr/local/lib64/mysql -L/usr/lib/mysql -L/sw/lib -L/opt/local/lib/mysql -lmysqlclient -lz" BASE=$(base) OBJECT=$(object) SOURCE=$(source) SHARED_LIB=$(shared_lib) sh make.sh
        rm $(object)
 
 .PHONY: distclean
index 096bb554f489874745fe1278a37f034ff302b165..a692f4c1e6989b12d0807ffe5e9c962c3356e631 100644 (file)
@@ -17,7 +17,7 @@
 ###########################################################################
 
 
-BASE=mysql
+BASE=clsql_mysql
 
 # Set to the directory where you have installed mysql's library
 MYSQL_DIR=c:/mysql
diff --git a/db-mysql/clsql_mysql.dll b/db-mysql/clsql_mysql.dll
new file mode 100644 (file)
index 0000000..095c091
Binary files /dev/null and b/db-mysql/clsql_mysql.dll differ
diff --git a/db-mysql/clsql_mysql.lib b/db-mysql/clsql_mysql.lib
new file mode 100644 (file)
index 0000000..0a2a75b
Binary files /dev/null and b/db-mysql/clsql_mysql.lib differ
index ffcc576c8287805f54d8b1f14bd7aabaa0b75c52..354e61e771184483c005f68b7707f5e3147ecd32 100644 (file)
 
 (in-package #:mysql)
 
-(defparameter *clsql-mysql-library-path
-  (uffi:find-foreign-library
-   '(#+(or 64bit x86-64) "mysql64" "mysql")
-   `(,clsql-mysql-system::*library-file-dir*
-     "/usr/lib/clsql/"
-     "/sw/lib/clsql/")
-   :drive-letters '("C")))
+(defparameter *clsql-mysql-library-candidate-names
+  (list #+(or 64bit x86-64) (make-pathname :name "clsql_mysql64"
+                                           :directory (pathname-directory *load-truename*))
+        #+(or 64bit x86-64) "clsql_mysql64"
+        (make-pathname :name "clsql_mysql"
+                       :directory (pathname-directory *load-truename*))
+        "clsql_mysql"))
 
 (defvar *mysql-library-candidate-names*
-    '("libmysqlclient" "libmysql"))
-
-(defparameter *mysql-library-candidate-directories*
-    `(,(pathname-directory *load-pathname*)
-      #+(or 64bit x86-64) "/usr/lib64/" #+(or 64bit x86-64) "/usr/local/lib64/mysql/"
-      "/opt/mysql/lib/mysql/" "/usr/local/lib/"
-      "/usr/lib/" "/usr/local/lib/mysql/" "/usr/lib/mysql/" "/mysql/lib/opt/" "/sw/lib/mysql/" "/opt/local/lib/mysql/"))
-
-(defvar *mysql-library-candidate-drive-letters* '("C" "D" "E"))
+  '("libmysqlclient" "libmysql"))
 
 (defvar *mysql-supporting-libraries* '("c")
   "Used only by CMU. List of library flags needed to be passed to ld to
@@ -49,21 +41,12 @@ set to the right path before compiling or loading the system.")
   *mysql-library-loaded*)
                                      
 (defmethod clsql-sys:database-type-load-foreign ((database-type (eql :mysql)))
-  (let ((mysql-path
-        (uffi:find-foreign-library *mysql-library-candidate-names*
-                                   *mysql-library-candidate-directories*
-                                   :drive-letters
-                                   *mysql-library-candidate-drive-letters*)))
-    (unless (probe-file mysql-path)
-      (error "Can't find mysql client library to load"))
-    (uffi:load-foreign-library mysql-path
-                              :module "mysql" 
-                              :supporting-libraries 
-                              *mysql-supporting-libraries*)
-    (uffi:load-foreign-library *clsql-mysql-library-path* 
-                              :module "clsql-mysql" 
-                              :supporting-libraries 
-                              (append *mysql-supporting-libraries*)))
+  (clsql-uffi:find-and-load-foreign-library *mysql-library-candidate-names*
+                                            :module "mysql" 
+                                            :supporting-libraries *mysql-supporting-libraries*)
+  (clsql-uffi:find-and-load-foreign-library *clsql-mysql-library-candidate-names*
+                                            :module "clsql-mysql" 
+                                            :supporting-libraries *mysql-supporting-libraries*)
   (setq *mysql-library-loaded* t))
 
 
diff --git a/db-mysql/mysql.c b/db-mysql/mysql.c
deleted file mode 100644 (file)
index d1bb084..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/****************************************************************************
- * FILE IDENTIFICATION
- *
- *   Name:          clsql-mysql.c
- *   Purpose:       Helper functions for mysql.cl to handle 64-bit parts of API
- *   Programmer:    Kevin M. Rosenberg
- *   Date Started:  Mar 2002
- *
- * $Id$
- *
- * This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
- *
- * CLSQL users are granted the rights to distribute and use this software
- * as governed by the terms of the Lisp Lesser GNU Public License
- * (http://opensource.franz.com/preamble.html), also known as the LLGPL.
- ***************************************************************************/
-
-#ifdef WIN32
-#include <windows.h>
-
-BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason,
-                         LPVOID lpvReserved)
-{
-        return 1;
-}
-       
-#define DLLEXPORT __declspec(dllexport)
-
-#else
-#define DLLEXPORT 
-#endif
-
-
-#include <mysql.h>
-
-/* Need to assemble a 64-bit integer to send to MySQL */
-DLLEXPORT
-void
-clsql_mysql_data_seek (MYSQL_RES* res, unsigned int offset_high32,
-                      unsigned int offset_low32)
-{
-  my_ulonglong offset;
-
-  offset = offset_high32;
-  offset = offset << 32;
-  offset += offset_low32;
-  
-  mysql_data_seek (res, offset);
-}
-
-/* The following functions are used to return 64-bit integers to Lisp.
-   They return the 32-bit low part and store in upper 32-bits in a 
-   located sent via a pointer */
-
-static const unsigned int bitmask_32bits = 0xFFFFFFFF;
-#define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits)
-#define upper_32bits(int64) ((unsigned int) (int64 >> 32))
-
-DLLEXPORT
-unsigned int
-clsql_mysql_num_rows (MYSQL_RES* res, unsigned int* pHigh32)
-{
-  my_ulonglong nRows = mysql_num_rows (res);
-  *pHigh32 = upper_32bits(nRows);
-  return lower_32bits(nRows);
-}
-
-DLLEXPORT
-unsigned int
-clsql_mysql_affected_rows (MYSQL* res, unsigned int* pHigh32)
-{
-  my_ulonglong nAffected = mysql_affected_rows (res);
-  *pHigh32 = upper_32bits(nAffected);
-  return lower_32bits(nAffected);
-}
-
-DLLEXPORT
-unsigned int
-clsql_mysql_insert_id (MYSQL* mysql, unsigned int* pHigh32)
-{
-  my_ulonglong insert_id = mysql_insert_id (mysql);
-  *pHigh32 = upper_32bits(insert_id);
-  return lower_32bits(insert_id);
-}
-
-
-/* Accessor functions to hide the differences across MySQL versions */
-
-DLLEXPORT
-short int
-clsql_mysql_field_type (MYSQL_FIELD* field)
-{
-  return field->type;
-}
-
-DLLEXPORT
-char*
-clsql_mysql_field_name (MYSQL_FIELD* field)
-{
-  return field->name;
-}
-
-DLLEXPORT
-unsigned long
-clsql_mysql_field_length (MYSQL_FIELD* field)
-{
-  return field->length;
-}
-
-DLLEXPORT
-unsigned long
-clsql_mysql_field_max_length (MYSQL_FIELD* field)
-{
-  return field->max_length;
-}
-
-
-#if MYSQL_VERSION_ID >= 40102
-#include <stdlib.h>
-
-DLLEXPORT
-MYSQL_BIND*
-allocate_bind (unsigned int n)
-{
-  return (MYSQL_BIND*) malloc (n * sizeof(MYSQL_BIND));
-}
-
-DLLEXPORT
-void
-bind_param (MYSQL_BIND bind[], unsigned int n, unsigned long length, unsigned short is_null, 
-          void* buffer, unsigned short buffer_type, unsigned long buffer_length)
-{
-  *bind[n].length = length;
-  *bind[n].is_null = is_null;
-  bind[n].buffer = buffer;
-  bind[n].buffer_type = buffer_type;
-  bind[n].buffer_length = buffer_length;
-}
-
-
-DLLEXPORT
-DLLEXPORT
-unsigned int
-clsql_mysql_stmt_affected_rows (MYSQL_STMT* stmt, unsigned int* pHigh32)
-{
-  my_ulonglong nAffected = mysql_stmt_affected_rows (stmt);
-  *pHigh32 = upper_32bits(nAffected);
-  return lower_32bits(nAffected);
-}
-
-
-#endif
-
diff --git a/db-mysql/mysql.dll b/db-mysql/mysql.dll
deleted file mode 100644 (file)
index 095c091..0000000
Binary files a/db-mysql/mysql.dll and /dev/null differ
diff --git a/db-mysql/mysql.lib b/db-mysql/mysql.lib
deleted file mode 100644 (file)
index 0a2a75b..0000000
Binary files a/db-mysql/mysql.lib and /dev/null differ
diff --git a/db-mysql/uffi_mysql.c b/db-mysql/uffi_mysql.c
new file mode 100644 (file)
index 0000000..d1bb084
--- /dev/null
@@ -0,0 +1,153 @@
+/****************************************************************************
+ * FILE IDENTIFICATION
+ *
+ *   Name:          clsql-mysql.c
+ *   Purpose:       Helper functions for mysql.cl to handle 64-bit parts of API
+ *   Programmer:    Kevin M. Rosenberg
+ *   Date Started:  Mar 2002
+ *
+ * $Id$
+ *
+ * This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
+ *
+ * CLSQL users are granted the rights to distribute and use this software
+ * as governed by the terms of the Lisp Lesser GNU Public License
+ * (http://opensource.franz.com/preamble.html), also known as the LLGPL.
+ ***************************************************************************/
+
+#ifdef WIN32
+#include <windows.h>
+
+BOOL WINAPI DllEntryPoint(HINSTANCE hinstdll, DWORD fdwReason,
+                         LPVOID lpvReserved)
+{
+        return 1;
+}
+       
+#define DLLEXPORT __declspec(dllexport)
+
+#else
+#define DLLEXPORT 
+#endif
+
+
+#include <mysql.h>
+
+/* Need to assemble a 64-bit integer to send to MySQL */
+DLLEXPORT
+void
+clsql_mysql_data_seek (MYSQL_RES* res, unsigned int offset_high32,
+                      unsigned int offset_low32)
+{
+  my_ulonglong offset;
+
+  offset = offset_high32;
+  offset = offset << 32;
+  offset += offset_low32;
+  
+  mysql_data_seek (res, offset);
+}
+
+/* The following functions are used to return 64-bit integers to Lisp.
+   They return the 32-bit low part and store in upper 32-bits in a 
+   located sent via a pointer */
+
+static const unsigned int bitmask_32bits = 0xFFFFFFFF;
+#define lower_32bits(int64) ((unsigned int) int64 & bitmask_32bits)
+#define upper_32bits(int64) ((unsigned int) (int64 >> 32))
+
+DLLEXPORT
+unsigned int
+clsql_mysql_num_rows (MYSQL_RES* res, unsigned int* pHigh32)
+{
+  my_ulonglong nRows = mysql_num_rows (res);
+  *pHigh32 = upper_32bits(nRows);
+  return lower_32bits(nRows);
+}
+
+DLLEXPORT
+unsigned int
+clsql_mysql_affected_rows (MYSQL* res, unsigned int* pHigh32)
+{
+  my_ulonglong nAffected = mysql_affected_rows (res);
+  *pHigh32 = upper_32bits(nAffected);
+  return lower_32bits(nAffected);
+}
+
+DLLEXPORT
+unsigned int
+clsql_mysql_insert_id (MYSQL* mysql, unsigned int* pHigh32)
+{
+  my_ulonglong insert_id = mysql_insert_id (mysql);
+  *pHigh32 = upper_32bits(insert_id);
+  return lower_32bits(insert_id);
+}
+
+
+/* Accessor functions to hide the differences across MySQL versions */
+
+DLLEXPORT
+short int
+clsql_mysql_field_type (MYSQL_FIELD* field)
+{
+  return field->type;
+}
+
+DLLEXPORT
+char*
+clsql_mysql_field_name (MYSQL_FIELD* field)
+{
+  return field->name;
+}
+
+DLLEXPORT
+unsigned long
+clsql_mysql_field_length (MYSQL_FIELD* field)
+{
+  return field->length;
+}
+
+DLLEXPORT
+unsigned long
+clsql_mysql_field_max_length (MYSQL_FIELD* field)
+{
+  return field->max_length;
+}
+
+
+#if MYSQL_VERSION_ID >= 40102
+#include <stdlib.h>
+
+DLLEXPORT
+MYSQL_BIND*
+allocate_bind (unsigned int n)
+{
+  return (MYSQL_BIND*) malloc (n * sizeof(MYSQL_BIND));
+}
+
+DLLEXPORT
+void
+bind_param (MYSQL_BIND bind[], unsigned int n, unsigned long length, unsigned short is_null, 
+          void* buffer, unsigned short buffer_type, unsigned long buffer_length)
+{
+  *bind[n].length = length;
+  *bind[n].is_null = is_null;
+  bind[n].buffer = buffer;
+  bind[n].buffer_type = buffer_type;
+  bind[n].buffer_length = buffer_length;
+}
+
+
+DLLEXPORT
+DLLEXPORT
+unsigned int
+clsql_mysql_stmt_affected_rows (MYSQL_STMT* stmt, unsigned int* pHigh32)
+{
+  my_ulonglong nAffected = mysql_stmt_affected_rows (stmt);
+  *pHigh32 = upper_32bits(nAffected);
+  return lower_32bits(nAffected);
+}
+
+
+#endif
+