diff options
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | scm/dictrans.scm | 34 | ||||
-rw-r--r-- | scm/neatrans.scm | 32 | ||||
-rw-r--r-- | src/cgi-bin/dict.scm4 | 9 | ||||
-rw-r--r-- | src/cgi-bin/nea.scm4 | 8 | ||||
-rw-r--r-- | src/ellinika/cgi.scm4 | 5 | ||||
-rw-r--r-- | src/ellinika/config.scm4 | 12 | ||||
-rw-r--r-- | src/ellinika/dico.scm | 9 |
8 files changed, 64 insertions, 63 deletions
@@ -1,3 +1,21 @@ +2010-03-10 Sergey Poznyakoff <gray@gnu.org.ua> + + 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. + 2010-03-02 Sergey Poznyakoff <gray@gnu.org.ua> * style.css (a.external, a.sound): New selectors. 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)) diff --git a/src/cgi-bin/dict.scm4 b/src/cgi-bin/dict.scm4 index c9f895b..4d301fb 100644 --- a/src/cgi-bin/dict.scm4 +++ b/src/cgi-bin/dict.scm4 @@ -1,5 +1,5 @@ ;;;; Greek Dictionary Web Engine -;;;; Copyright (C) 2004, 2005, 2006, 2007 Sergey Poznyakoff +;;;; Copyright (C) 2004, 2005, 2006, 2007, 2010 Sergey Poznyakoff ;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -51,14 +51,13 @@ ifelse(IFACE,[CGI],(cgi:init)) (if (not db-connection) (begin (set! db-connection - (sql-connect - sql-iface sql-host sql-port sql-database - sql-username sql-password)) + (sql-open-connection + ellinika-sql-connection)) (sql-query db-connection "SET NAMES utf8") ))) (else (if db-connection - (sql-connect-close db-connection)) + (sql-close-connection db-connection)) (set! db-connection #f))) db-connection))) diff --git a/src/cgi-bin/nea.scm4 b/src/cgi-bin/nea.scm4 index e490a59..b5a9af0 100644 --- a/src/cgi-bin/nea.scm4 +++ b/src/cgi-bin/nea.scm4 @@ -1,5 +1,5 @@ ;;;; News page for Ellinika -;;;; Copyright (C) 2004, 2005, 2006, 2007 Sergey Poznyakoff +;;;; Copyright (C) 2004, 2005, 2006, 2007, 2010 Sergey Poznyakoff ;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -380,9 +380,7 @@ ifelse(IFACE,[CGI],(cgi:init)) </rss>")) (define (nea-sql-connect) - (let ((conn (sql-connect - sql-iface sql-host sql-port sql-database - sql-username sql-password))) + (let ((conn (sql-open-connection ellinika-sql-connection))) (sql-query conn "SET NAMES utf8") conn)) @@ -507,7 +505,7 @@ ifelse(IFACE,[CGI],(cgi:init)) (template-file target-language tmpl) nea-html) - (sql-connect-close conn)) + (sql-close-connection conn)) (lambda (key err descr) (with-input-from-file diff --git a/src/ellinika/cgi.scm4 b/src/ellinika/cgi.scm4 index 38fd3de..c7fbdb6 100644 --- a/src/ellinika/cgi.scm4 +++ b/src/ellinika/cgi.scm4 @@ -1,6 +1,6 @@ ;;;; -*- scheme -*- ;;;; Greek Dictionary Web Engine -;;;; Copyright (C) 2005, 2007 Sergey Poznyakoff +;;;; Copyright (C) 2005, 2007, 2010 Sergey Poznyakoff ;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -20,8 +20,7 @@ #:use-module (ellinika i18n) #:use-module ifelse(IFACE,[CGI],(www cgi),(guile-user)) #:re-export (base-dir html-dir sysconf-dir locale-path - sql-iface sql-host sql-port sql-database - sql-username sql-password + ellinika-sql-connection config-file-name )) diff --git a/src/ellinika/config.scm4 b/src/ellinika/config.scm4 index 8032409..3b2bcbe 100644 --- a/src/ellinika/config.scm4 +++ b/src/ellinika/config.scm4 @@ -1,6 +1,6 @@ ;;;; -*- scheme -*- ;;;; Greek Dictionary Web Engine -;;;; Copyright (C) 2005, 2007, 2008 Sergey Poznyakoff +;;;; Copyright (C) 2005, 2007, 2008, 2010 Sergey Poznyakoff ;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -22,15 +22,7 @@ (define-public html-dir "HTMLDIR") (define-public sysconf-dir "SYSCONFDIR") (define-public locale-path "LOCALEDIR:/usr/share/locale:/usr/local/share/locale") -(define-public sql-iface "mysql") ;; SQL interface ("mysql" or "postgres") -;; SQL server hostname or a path to the UNIX socket -(define-public sql-host "localhost") -(define-public sql-port 3306) ;; SQL port number (0 for sockaddr_un - ;; connection) -(define-public sql-database "ellinika") ;; Name of the database -(define-public sql-username "gray") ;; Database user name -(define-public sql-password "") ;; Password for that user name - +(define-public ellinika-sql-connection '()) (define-public config-file-name "ellinika.conf") (define-public (ellinika-config-setup) diff --git a/src/ellinika/dico.scm b/src/ellinika/dico.scm index de564c2..7c04db2 100644 --- a/src/ellinika/dico.scm +++ b/src/ellinika/dico.scm @@ -1,5 +1,5 @@ ;;;; A Dico module for Greek Dictionary Web Engine -*- scheme -*- -;;;; Copyright (C) 2008 Sergey Poznyakoff +;;;; Copyright (C) 2008, 2010 Sergey Poznyakoff ;;;; ;;;; This program is free software; you can redistribute it and/or modify ;;;; it under the terms of the GNU General Public License as published by @@ -75,9 +75,8 @@ (else (dico-error "Unknown option " (car av)))))) rest) - (let ((db-connection (sql-connect - sql-iface sql-host sql-port sql-database - sql-username sql-password))) + (let ((db-connection (sql-open-connection + ellinika-sql-connection))) (sql-query db-connection "SET NAMES utf8") (list db-connection target-language type)))) @@ -86,7 +85,7 @@ (defmacro dbh:type (dbh) `(list-ref ,dbh 2)) (define (close-module dbh) - (sql-connect-close (dbh:conn dbh))) + (sql-close-connection (dbh:conn dbh))) (define descr-list '(("pl" . "Słownik grecko-polski") |