Browse files

Include database access keywords in start-help

  • Loading branch information...
1 parent aaca39c commit 924787948fc3012f6ce3a4c078b21e7832e46f67 @bvds committed Feb 10, 2010
Showing with 14 additions and 14 deletions.
  1. +11 −11 Help/database.cl
  2. +3 −3 Help/sessions.cl
View
22 Help/database.cl
@@ -58,25 +58,25 @@
(disconnect))) ;disconnect *default-database*
(error "No common database defined, can't continue.")))
-(defun destroy ()
- (setf *connection-spec* nil)
- (when *debug*
- (format webserver:*stdout* "destroy connected (~A):~%~{ ~A~%~}"
- (hash-table-count clsql-sys::*db-pool*)
- (let (z) (maphash #'(lambda (x y) (push y z))
- clsql-sys::*db-pool*) z)))
- (disconnect-pooled))
-
-(defun create ()
+(defun create (&key host db user password)
;; Should remove at least password from lisp and make
;; user enter when starting server.
- (setf *connection-spec* '(nil "andes" "root" "sin(0)=0"))
+ (setf *connection-spec* (list host (or db "andes") (or user "root")
+ (or password "sin(0)=0")))
(when *debug*
(format webserver:*stdout* "create connected (~A):~%~{ ~A~%~}"
(hash-table-count clsql-sys::*db-pool*)
(let (z) (maphash #'(lambda (x y) (push y z))
clsql-sys::*db-pool*) z))))
+(defun destroy ()
+ (setf *connection-spec* nil)
+ (when *debug*
+ (format webserver:*stdout* "destroy connected (~A):~%~{ ~A~%~}"
+ (hash-table-count clsql-sys::*db-pool*)
+ (let (z) (maphash #'(lambda (x y) (push y z))
+ clsql-sys::*db-pool*) z)))
+ (disconnect-pooled))
;; If a write-transaction is called before set-session, a
;; database error is given.
View
6 Help/sessions.cl
@@ -51,8 +51,8 @@
(defvar *cleanup-thread* "Function to clean up idle sessions")
-(defun start-help (&key (port 8080) server-log-path)
- "start a server with help system, optionally specifying the port."
+(defun start-help (&key host db user password (port 8080) server-log-path)
+ "start a server with help system, optionally specifying the port, log file path, and database access."
;; global setup
;; in runtime version only: set *andes-path* to process working directory
@@ -72,7 +72,7 @@
(physics-algebra-rules-initialize) ;initialize grammar
;; Set up database
- (andes-database:create)
+ (andes-database:create :host host :db db :user user :password password)
;; start webserver
(webserver:start-json-rpc-service

0 comments on commit 9247879

Please sign in to comment.