aboutsummaryrefslogtreecommitdiff
path: root/scm/dictrans.scm
diff options
context:
space:
mode:
Diffstat (limited to 'scm/dictrans.scm')
-rw-r--r--scm/dictrans.scm34
1 files changed, 16 insertions, 18 deletions
diff --git a/scm/dictrans.scm b/scm/dictrans.scm
index ae9b3f5..d76479e 100644
--- a/scm/dictrans.scm
+++ b/scm/dictrans.scm
@@ -2,7 +2,7 @@
=AUTOGENERATED=
!#
;;;; This file is part of Ellinika
-;;;; Copyright (C) 2004, 2005, 2007 Sergey Poznyakoff
+;;;; Copyright (C) 2004, 2005, 2007, 2010 Sergey Poznyakoff
;;;;
;;;; Ellinika is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
@@ -96,12 +96,7 @@
(define cleanup-option #f)
(define preserve-option #f)
-(define sql-iface "mysql")
-(define sql-host "localhost")
-(define sql-database "ellinika")
-(define sql-port 3306)
-(define sql-password #f)
-(define sql-username #f)
+(define ellinika-sql-connection '())
(define verbose-option #f)
(define debug-level 0)
(define input-files '())
@@ -125,6 +120,9 @@
rest)
(newline))))
+(define (add-conn-param key val)
+ (set! ellinika-sql-connection (cons (cons key val) ellinika-sql-connection)))
+
(define pos-xlat #f)
@@ -669,7 +667,8 @@
WHERE p.word = d.word AND p.type != 'CLOSED'")
(run-query
conn
- (if (string=? sql-iface "mysql")
+ (if (string=? (let ((x (assoc #:iface ellinika-sql-connection)))
+ (if x (cdr x) "")) "mysql")
"UPDATE pending_links p, dict d SET p.type='CLOSED' WHERE p.word = d.word"
;; Else assume SQL92
"UPDATE pending_links SET type='CLOSED' \
@@ -967,17 +966,17 @@ Informational options:
((cleanup)
(set! cleanup-option #t))
((database)
- (set! sql-database (cdr x)))
+ (add-conn-param #:db (cdr x)))
((host)
- (set! sql-host (cdr x)))
+ (add-conn-param #:host (cdr x)))
((port)
- (set! sql-port (string->number (cdr x))))
+ (add-conn-param #:port (string->number (cdr x))))
((password)
- (set! sql-password (cdr x)))
+ (add-conn-param #:pass (cdr x)))
((user)
- (set! sql-username (cdr x)))
+ (add-conn-param #:user (cdr x)))
((interface)
- (set! sql-iface (cdr x)))
+ (add-conn-param #:iface (cdr x)))
((verbose)
(set! verbose-option #t))
((preserve)
@@ -1006,8 +1005,7 @@ Informational options:
input-files)
(exit 0)))
-(let ((conn (sql-connect sql-iface sql-host sql-port sql-database
- sql-username sql-password)))
+(let ((conn (sql-open-connection ellinika-sql-connection)))
(if (not conn)
(begin
(display "Cannot connect to the database\n" (current-error-port))
@@ -1029,7 +1027,7 @@ Informational options:
(if (null? input-files)
(begin
- (sql-connect-close conn)
+ (sql-close-connection conn)
(exit 0)))
(get-dict-index conn)
@@ -1054,7 +1052,7 @@ Informational options:
(pending-fixup conn)
(update-stat conn)
- (sql-connect-close conn))
+ (sql-close-connection conn))
(exit 0)

Return to:

Send suggestions and report system problems to the System administrator.