diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-03-09 22:31:34 +0000 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2010-03-09 22:31:34 +0000 |
commit | 150f2f64e4e580c0d6ab75d4bee150a4369cc4f1 (patch) | |
tree | 8fdccbaafe764302ff42d9657dd0170d4d2c7e3f /scm | |
parent | 7968cb70a5dcbf57af5884f28dafe188fc6415c5 (diff) | |
download | ellinika-150f2f64e4e580c0d6ab75d4bee150a4369cc4f1.tar.gz ellinika-150f2f64e4e580c0d6ab75d4bee150a4369cc4f1.tar.bz2 |
Update for newer Gamma.
* scm/dictrans.scm: Use Gamma 1.99 syntax.
* scm/neatrans.scm: Likewise.
* src/ellinika/dico.scm: Likewise.
* src/cgi-bin/dict.scm4: Likewise.
* src/cgi-bin/nea.scm4: Likewise.
* src/ellinika/cgi.scm4 (sql-iface)
(sql-host,sql-port,sql-database)
(sql-username,sql-password): Remove reexports.
(ellinika-sql-connection): New reexport.
* src/ellinika/config.scm4 (sql-iface)
(sql-host,sql-port,sql-database)
(sql-username,sql-password): Remove variables.
(ellinika-sql-connection): New variable.
git-svn-id: file:///home/puszcza/svnroot/ellinika/trunk@541 941c8c0f-9102-463b-b60b-cd22ce0e6858
Diffstat (limited to 'scm')
-rw-r--r-- | scm/dictrans.scm | 34 | ||||
-rw-r--r-- | scm/neatrans.scm | 32 |
2 files changed, 31 insertions, 35 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) diff --git a/scm/neatrans.scm b/scm/neatrans.scm index 4888cf7..e92e585 100644 --- a/scm/neatrans.scm +++ b/scm/neatrans.scm @@ -2,7 +2,7 @@ =AUTOGENERATED= !# ;;;; This file is part of Ellinika -;;;; Copyright (C) 2006, 2007 Sergey Poznyakoff +;;;; Copyright (C) 2006, 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 @@ -26,7 +26,7 @@ ;;;; [<L>string</L>] ; Language ;;;; [<D>string</D>] ; Date ;;;; <H>string</H> ; Header -;;;; <T>string</H> ; Text +;;;; <T>string</T> ; Text ;;;; </NODE> ;;; Tailor this statement to your needs if necessary. @@ -42,12 +42,6 @@ (define compile-only #f) (define cleanup-option #f) (define force-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 verbose-option #f) (define debug-level 0) (define input-files '()) @@ -57,6 +51,11 @@ (define dict-cgi-path #f) +(define ellinika-sql-connection '()) + +(define (add-conn-param key val) + (set! ellinika-sql-connection (cons (cons key val) ellinika-sql-connection))) + ;;; Load the site defaults (let ((rc-file (string-append sysconf-dir "/" config-file-name))) (if (file-exists? rc-file) @@ -397,17 +396,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) @@ -437,8 +436,7 @@ Informational options: (if compile-only (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)) @@ -456,7 +454,7 @@ Informational options: (db-insert-node conn node))) (reverse node-list)) - (sql-connect-close conn)) + (sql-close-connection conn)) (exit (if (= error-count 0) 0 1)) |