- (loop for row in rows
- when (and (not (string-equal "information_schema" (nth 1 row)))
- (string-equal "TABLE" (nth 3 row))
- (not (and (eq :mssql (database-underlying-type database))
- (string-equal "dtproperties" (nth 2 row)))))
- collect (nth 2 row))))
+ (loop for (category schema name ttype . rest) in rows
+ when (and (string-equal type ttype)
+ (or (null owner) (string-equal owner schema))
+ ;; unless requesting by name, skip system schema
+ (not (and (null owner)
+ (member schema '("information_schema" "sys")
+ :test #'string-equal)))
+ ;; skip system specific tables in mssql2000
+ (not (and (eql :mssql (database-underlying-type database))
+ (member name '("dtproperties" "sysconstraints"
+ "syssegments")
+ :test #'string-equal))))
+ collect name)))
+
+(defmethod database-list-tables ((database generic-odbc-database)
+ &key (owner nil))
+ "Since ODBC doesn't expose the owner we use that parameter to filter
+on schema since that's what tends to be exposed. Some DBs like mssql
+2000 conflate the two so at least there it works nicely."
+ (%database-list-* database "TABLE" owner))