From aaa79d92bdb60acdf709df806fbd5a3836937a2e Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Sun, 7 Apr 2002 15:11:04 +0000 Subject: [PATCH] r1767: Moved high-level types to clsql-sys --- interfaces/mysql/mysql-usql.cl | 32 ++++++++---------------- interfaces/postgresql/postgresql-usql.cl | 14 ++++------- 2 files changed, 15 insertions(+), 31 deletions(-) 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)) diff --git a/interfaces/postgresql/postgresql-usql.cl b/interfaces/postgresql/postgresql-usql.cl index 25eb696..692bcde 100644 --- a/interfaces/postgresql/postgresql-usql.cl +++ b/interfaces/postgresql/postgresql-usql.cl @@ -7,7 +7,7 @@ ;;;; Programmers: Kevin M. Rosenberg and onShore Development Inc ;;;; Date Started: Mar 2002 ;;;; -;;;; $Id: postgresql-usql.cl,v 1.1 2002/04/01 05:27:55 kevin Exp $ +;;;; $Id: postgresql-usql.cl,v 1.2 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. @@ -33,13 +33,9 @@ -(defmethod database-list-attributes (table (database postgresql-database)) - (let* ((relname (etypecase table - (clsql::sql-ident - (string-downcase - (symbol-name (slot-value table 'clsql::name)))) - (string table))) - (result +(defmethod database-list-attributes ((table string) + (database postgresql-database)) + (let* ((result (mapcar #'car (database-query (format nil @@ -57,7 +53,7 @@ "tableoid") :test #'equal)) result))))) -(defmethod database-attribute-type (attribute table +(defmethod database-attribute-type (attribute (table string) (database postgresql-database)) (let ((result (mapcar #'car -- 2.34.1