-;; Return (VALUES ALL-TABLES COLUMN-NAMES), where ALL-TABLES is a
-;; table containing one row for each table available in DB, and
-;; COLUMN-NAMES is a list of header names for the columns in
-;; ALL-TABLES.
-;;
-;; The Allegro version also accepted a HSTMT argument.
-
-;(defmethod database-list-tables ((db oracle-database))
-; (sql:query "select '',OWNER,TABLE_NAME,TABLE_TYPE,'' from all_catalog"))
-
-
-(defmethod list-all-user-database-tables ((db oracle-database))
- (unless db
- (setf db clsql:*default-database*))
- (values (database-query "select TABLE_NAME from all_catalog
- where owner <> 'PUBLIC' and owner <> 'SYSTEM' and owner <> 'SYS'"
- db nil nil)))
-
-
-(defmethod database-list-tables ((database oracle-database)
- &key (system-tables nil) owner)
- (if system-tables
- (database-query "select table_name from all_catalog" database nil nil)
- (database-query "select table_name from all_catalog where owner <> 'PUBLIC' and owner <> 'SYSTEM' and owner <> 'SYS'"
- database nil nil)))
-
-;; Return a list of all columns in TABLE.
-;;
-;; The Allegro version of this also returned a second value.
-
-(defmethod list-all-table-columns (table (db oracle-database))
- (declare (type string table))
- (unless db
- (setf db clsql:*default-database*))
- (let* ((sql-stmt (concatenate
- 'simple-string
- "select "
- "'',"
- "all_tables.OWNER,"
- "'',"
- "user_tab_columns.COLUMN_NAME,"
- "user_tab_columns.DATA_TYPE from user_tab_columns,"
- "all_tables where all_tables.table_name = '" table "'"
- " and user_tab_columns.table_name = '" table "'"))
- (preresult (sql sql-stmt :db db :types :auto)))
- ;; PRERESULT is like RESULT except that it has a name instead of
- ;; type codes in the fifth column of each row. To fix this, we
- ;; destructively modify PRERESULT.
- (dolist (preresult-row preresult)
- (setf (fifth preresult-row)
- (if (find (fifth preresult-row)
- #("NUMBER" "DATE")
- :test #'string=)
- 2 ; numeric
- 1))) ; string
- preresult))