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/dictrans.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/dictrans.scm')
-rw-r--r-- | scm/dictrans.scm | 34 |
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 @@ | |||
2 | =AUTOGENERATED= | 2 | =AUTOGENERATED= |
3 | !# | 3 | !# |
4 | ;;;; This file is part of Ellinika | 4 | ;;;; This file is part of Ellinika |
5 | ;;;; Copyright (C) 2004, 2005, 2007 Sergey Poznyakoff | 5 | ;;;; Copyright (C) 2004, 2005, 2007, 2010 Sergey Poznyakoff |
6 | ;;;; | 6 | ;;;; |
7 | ;;;; Ellinika is free software; you can redistribute it and/or modify | 7 | ;;;; Ellinika is free software; you can redistribute it and/or modify |
8 | ;;;; it under the terms of the GNU General Public License as published by | 8 | ;;;; it under the terms of the GNU General Public License as published by |
@@ -96,12 +96,7 @@ | |||
96 | (define cleanup-option #f) | 96 | (define cleanup-option #f) |
97 | (define preserve-option #f) | 97 | (define preserve-option #f) |
98 | 98 | ||
99 | (define sql-iface "mysql") | 99 | (define ellinika-sql-connection '()) |
100 | (define sql-host "localhost") | ||
101 | (define sql-database "ellinika") | ||
102 | (define sql-port 3306) | ||
103 | (define sql-password #f) | ||
104 | (define sql-username #f) | ||
105 | (define verbose-option #f) | 100 | (define verbose-option #f) |
106 | (define debug-level 0) | 101 | (define debug-level 0) |
107 | (define input-files '()) | 102 | (define input-files '()) |
@@ -125,6 +120,9 @@ | |||
125 | rest) | 120 | rest) |
126 | (newline)))) | 121 | (newline)))) |
127 | 122 | ||
123 | (define (add-conn-param key val) | ||
124 | (set! ellinika-sql-connection (cons (cons key val) ellinika-sql-connection))) | ||
125 | |||
128 | 126 | ||
129 | (define pos-xlat #f) | 127 | (define pos-xlat #f) |
130 | 128 | ||
@@ -669,7 +667,8 @@ | |||
669 | WHERE p.word = d.word AND p.type != 'CLOSED'") | 667 | WHERE p.word = d.word AND p.type != 'CLOSED'") |
670 | (run-query | 668 | (run-query |
671 | conn | 669 | conn |
672 | (if (string=? sql-iface "mysql") | 670 | (if (string=? (let ((x (assoc #:iface ellinika-sql-connection))) |
671 | (if x (cdr x) "")) "mysql") | ||
673 | "UPDATE pending_links p, dict d SET p.type='CLOSED' WHERE p.word = d.word" | 672 | "UPDATE pending_links p, dict d SET p.type='CLOSED' WHERE p.word = d.word" |
674 | ;; Else assume SQL92 | 673 | ;; Else assume SQL92 |
675 | "UPDATE pending_links SET type='CLOSED' \ | 674 | "UPDATE pending_links SET type='CLOSED' \ |
@@ -967,17 +966,17 @@ Informational options: | |||
967 | ((cleanup) | 966 | ((cleanup) |
968 | (set! cleanup-option #t)) | 967 | (set! cleanup-option #t)) |
969 | ((database) | 968 | ((database) |
970 | (set! sql-database (cdr x))) | 969 | (add-conn-param #:db (cdr x))) |
971 | ((host) | 970 | ((host) |
972 | (set! sql-host (cdr x))) | 971 | (add-conn-param #:host (cdr x))) |
973 | ((port) | 972 | ((port) |
974 | (set! sql-port (string->number (cdr x)))) | 973 | (add-conn-param #:port (string->number (cdr x)))) |
975 | ((password) | 974 | ((password) |
976 | (set! sql-password (cdr x))) | 975 | (add-conn-param #:pass (cdr x))) |
977 | ((user) | 976 | ((user) |
978 | (set! sql-username (cdr x))) | 977 | (add-conn-param #:user (cdr x))) |
979 | ((interface) | 978 | ((interface) |
980 | (set! sql-iface (cdr x))) | 979 | (add-conn-param #:iface (cdr x))) |
981 | ((verbose) | 980 | ((verbose) |
982 | (set! verbose-option #t)) | 981 | (set! verbose-option #t)) |
983 | ((preserve) | 982 | ((preserve) |
@@ -1006,8 +1005,7 @@ Informational options: | |||
1006 | input-files) | 1005 | input-files) |
1007 | (exit 0))) | 1006 | (exit 0))) |
1008 | 1007 | ||
1009 | (let ((conn (sql-connect sql-iface sql-host sql-port sql-database | 1008 | (let ((conn (sql-open-connection ellinika-sql-connection))) |
1010 | sql-username sql-password))) | ||
1011 | (if (not conn) | 1009 | (if (not conn) |
1012 | (begin | 1010 | (begin |
1013 | (display "Cannot connect to the database\n" (current-error-port)) | 1011 | (display "Cannot connect to the database\n" (current-error-port)) |
@@ -1029,7 +1027,7 @@ Informational options: | |||
1029 | 1027 | ||
1030 | (if (null? input-files) | 1028 | (if (null? input-files) |
1031 | (begin | 1029 | (begin |
1032 | (sql-connect-close conn) | 1030 | (sql-close-connection conn) |
1033 | (exit 0))) | 1031 | (exit 0))) |
1034 | 1032 | ||
1035 | (get-dict-index conn) | 1033 | (get-dict-index conn) |
@@ -1054,7 +1052,7 @@ Informational options: | |||
1054 | (pending-fixup conn) | 1052 | (pending-fixup conn) |
1055 | (update-stat conn) | 1053 | (update-stat conn) |
1056 | 1054 | ||
1057 | (sql-connect-close conn)) | 1055 | (sql-close-connection conn)) |
1058 | 1056 | ||
1059 | (exit 0) | 1057 | (exit 0) |
1060 | 1058 | ||