X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=interfaces%2Fmysql%2Fmysql-usql.cl;h=10413a66a2fdb6538b07e43747b5292bb2010b2a;hb=0fe44ce81f47c779d9695c9211668b4780bf4216;hp=13d3b2f147c1593d994809e201751e57fd1b4dd8;hpb=3926d72ba0021044cc122c9ed9aa60607cf9c42d;p=clsql.git diff --git a/interfaces/mysql/mysql-usql.cl b/interfaces/mysql/mysql-usql.cl index 13d3b2f..10413a6 100644 --- a/interfaces/mysql/mysql-usql.cl +++ b/interfaces/mysql/mysql-usql.cl @@ -7,7 +7,7 @@ ;;;; Programmers: Kevin M. Rosenberg and onShore Development Inc ;;;; Date Started: Mar 2002 ;;;; -;;;; $Id: mysql-usql.cl,v 1.2 2002/04/03 04:54:17 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. @@ -26,32 +26,20 @@ (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))