r1791: * interfaces/postgresql/postgresql-sql.cl:
[clsql.git] / interfaces / mysql / mysql-usql.cl
index 64e16cb4d7145388bc2bc6e89b9e7b351eb36630..10413a66a2fdb6538b07e43747b5292bb2010b2a 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmers:   Kevin M. Rosenberg and onShore Development Inc
 ;;;; Date Started:  Mar 2002
 ;;;;
-;;;; $Id: mysql-usql.cl,v 1.1 2002/04/01 05:27:55 kevin Exp $
+;;;; $Id: mysql-usql.cl,v 1.3 2002/04/07 15:11:04 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and by onShore Development Inc.
   (mapcar #'car (database-query "show tables" database :auto)))
     
 
-(defmethod database-list-attributes (table (database mysql-database))
-  (let* ((relname (etypecase table
-                   (clsql::sql-ident
-                    (string-downcase
-                     (symbol-name (slot-value table 'clsql::name))))
-                   (string table)))
-        (result
-         (mapcar #'car
-                 (database-query
-                  (format nil
-                          "SHOW COLUMNS FROM ~A" relname)
-                  database nil))))
-    result)) ;; MySQL returns columns in reverse order defined
 
-(defmethod database-attribute-type (attribute table
+(defmethod database-list-attributes ((table string) (database mysql-database))
+  (mapcar #'car
+         (database-query
+          (format nil "SHOW COLUMNS FROM ~A" table)
+          database nil)))
+
+(defmethod database-attribute-type (attribute (table string)
                                    (database mysql-database))
-  (let* ((relname (etypecase table
-                   (clsql::sql-ident
-                    (string-downcase
-                     (symbol-name (slot-value table 'clsql::name))))
-                   (string table)))
-        (result
+  (let ((result
          (mapcar #'cadr
                  (database-query
                   (format nil
-                          "SHOW COLUMNS FROM ~A LIKE '~A'" relname attribute)
+                          "SHOW COLUMNS FROM ~A LIKE '~A'" table attribute)
                   database nil))))
     (let* ((str (car result))
           (end-str (position #\( str))
@@ -86,7 +74,7 @@
    (concatenate 'string "UPDATE " (%sequence-name-to-table sequence-name)
                " SET id=LAST_INSERT_ID(id+1)")
    database)
-  (mysql:mysql-insert-id (mysql::database-mysql-ptr database)))
+  (mysql:mysql-insert-id (clsql-mysql::database-mysql-ptr database)))
 
 #+ignore
 (defmethod database-output-sql ((expr clsql-sys::sql-typecast-exp)