X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=base%2Fdatabase.lisp;h=e4016d3c547f603ceefed503a2886bd692257a6e;hp=f3c72b65a2ead44ab85a414296ee959cbad6d2cb;hb=7cdc9aa48baa3c52923d61da6fa632eb47ac0b5d;hpb=4d1a3100285889c84e63f8f4500dbd4b6c1f8ddc diff --git a/base/database.lisp b/base/database.lisp index f3c72b6..e4016d3 100644 --- a/base/database.lisp +++ b/base/database.lisp @@ -204,26 +204,38 @@ if the database connection has been lost." output, for the connected databases and initialized database types. If full is T, detailed status information is printed. The default value of full is NIL." - (declare (ignore full)) - ;; TODO: table details if full is true? (flet ((get-data () (let ((data '())) (dolist (db (connected-databases) data) - (push (list (database-name db) - (string (database-type db)) - (when (conn-pool db) "T" "NIL") - (format nil "~A" (length (database-list-tables db))) - (format nil "~A" (length (database-list-views db))) - (if (equal db *default-database*) " *" "")) - data)))) - (compute-sizes (data) + (push + (append + (list (if (equal db *default-database*) "*" "") + (database-name db) + (string-downcase (string (database-type db))) + (cond ((and (command-recording-stream db) + (result-recording-stream db)) + "Both") + ((command-recording-stream db) "Commands") + ((result-recording-stream db) "Results") + (t "nil"))) + (when full + (list + (if (conn-pool db) "t" "nil") + (format nil "~A" (length (database-list-tables db))) + (format nil "~A" (length (database-list-views db)))))) + data)))) + (compute-sizes (data) (mapcar #'(lambda (x) (apply #'max (mapcar #'length x))) (apply #'mapcar (cons #'list data)))) (print-separator (size) (format t "~&~A" (make-string size :initial-element #\-)))) + (format t "~&CLSQL STATUS: ~A~%" (iso-timestring (get-time))) (let ((data (get-data))) (when data - (let* ((titles (list "NAME" "TYPE" "POOLED" "TABLES" "VIEWS" "DEFAULT")) + (let* ((titles (if full + (list "" "DATABASE" "TYPE" "RECORDING" "POOLED" + "TABLES" "VIEWS") + (list "" "DATABASE" "TYPE" "RECORDING"))) (sizes (compute-sizes (cons titles data))) (total-size (+ (apply #'+ sizes) (* 2 (1- (length titles))))) (control-string (format nil "~~&~~{~{~~~AA ~}~~}" sizes)))