db: make debugging easier

This commit is contained in:
Ryan Culpepper 2011-12-13 23:51:31 -07:00
parent b355abfdb3
commit d312744aae
6 changed files with 17 additions and 9 deletions

View File

@ -219,7 +219,8 @@
#:allow-cleartext-password? boolean?
#:ssl (or/c 'yes 'optional 'no)
#:notice-handler (or/c 'output 'error)
#:notification-handler (or/c 'output 'error))
#:notification-handler (or/c 'output 'error)
#:debug? any/c)
data-source?)]
[mysql-data-source
(->* ()
@ -229,7 +230,8 @@
#:port exact-positive-integer?
#:socket (or/c string? 'guess)
#:password (or/c string? #f)
#:notice-handler (or/c 'output 'error))
#:notice-handler (or/c 'output 'error)
#:debug? any/c)
data-source?)]
[sqlite3-data-source
(->* ()

View File

@ -37,7 +37,8 @@
#:ssl (or/c 'yes 'no 'optional)
#:ssl-context ssl-client-context?
#:notice-handler (or/c 'output 'error output-port? procedure?)
#:notification-handler (or/c 'output 'error output-port? procedure?))
#:notification-handler (or/c 'output 'error output-port? procedure?)
#:debug? any/c)
connection?)]
[postgresql-guess-socket-path
(-> path-string?)]
@ -54,7 +55,8 @@
#:socket (or/c path-string? 'guess #f)
#:ssl (or/c 'yes 'no 'optional)
#:ssl-context ssl-client-context?
#:notice-handler (or/c 'output 'error output-port? procedure?))
#:notice-handler (or/c 'output 'error output-port? procedure?)
#:debug? any/c)
connection?)]
[mysql-guess-socket-path
(-> path-string?)]

View File

@ -15,7 +15,8 @@
#:socket (or/c path-string? 'guess #f)
#:ssl (or/c 'yes 'no 'optional)
#:ssl-context ssl-client-context?
#:notice-handler (or/c 'output 'error output-port? procedure?))
#:notice-handler (or/c 'output 'error output-port? procedure?)
#:debug? any/c)
connection?)]
[mysql-guess-socket-path
(-> path-string?)]

View File

@ -17,7 +17,8 @@
#:ssl (or/c 'yes 'no 'optional)
#:ssl-context ssl-client-context?
#:notice-handler (or/c 'output 'error output-port? procedure?)
#:notification-handler (or/c 'output 'error output-port? procedure?))
#:notification-handler (or/c 'output 'error output-port? procedure?)
#:debug? any/c)
connection?)]
[postgresql-guess-socket-path
(-> path-string?)]

View File

@ -186,12 +186,12 @@ considered important.
(mk-specialized 'postgresql-data-source 'postgresql 0
'(#:user #:database #:password #:server #:port #:socket
#:allow-cleartext-password? #:ssl
#:notice-handler #:notification-handler)))
#:notice-handler #:notification-handler #:debug?)))
(define mysql-data-source
(mk-specialized 'mysql-data-source 'mysql 0
'(#:user #:database #:password #:server #:port #:socket #:ssl
#:notice-handler)))
#:notice-handler #:debug?)))
(define sqlite3-data-source
(mk-specialized 'sqlite3-data-source 'sqlite3 0

View File

@ -22,7 +22,8 @@
((no) #f)
(else (ssl-make-client-context 'sslv3)))]
#:notice-handler [notice-handler void]
#:notification-handler [notification-handler void])
#:notification-handler [notification-handler void]
#:debug? [debug? #f])
(let ([connection-options
(+ (if (or server port) 1 0)
(if socket 1 0))]
@ -41,6 +42,7 @@
(notice-handler notice-handler)
(notification-handler notification-handler)
(allow-cleartext-password? allow-cleartext-password?))])
(when debug? (send c debug #t))
(let-values ([(in out)
(cond [socket (unix-socket-connect socket)]
[else (let ([server (or server "localhost")]