source: project/release/4/jbogenturfahi/trunk/db.scm @ 22198

Last change on this file since 22198 was 22198, checked in by Alan Post, 10 years ago

jbogenturfa'i: add program-specific database routines.

All of the database handling for jbogenturfa'i will be kept here.

This file currently holds the cmavo-related table code, which is the
only thing I've tested.

File size: 1.6 KB
Line 
1;;;;
2;;;; jbogenturfahi - lo lojbo ke pe'a jajgau ratcu ke'e genturfa'i
3;;;;               `-> A Lojban grammar parser
4;;;;
5;;;; Copyright (c) 2010 ".alyn.post." <alyn.post@lodockikumazvati.org>
6;;;;
7;;;; Permission to use, copy, modify, and/or distribute this software for any
8;;;; purpose with or without fee is hereby granted, provided that the above
9;;;; copyright notice and this permission notice appear in all copies.
10;;;;
11;;;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12;;;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13;;;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14;;;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15;;;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16;;;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17;;;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18;;;;
19
20(define jbogenturfahi-db (sql:open (jbogenturfahi-db-path)))
21
22(define (cmavo:drop-table)
23  (sql:drop-table jbogenturfahi-db #<<EOS
24drop table if exists cmavo;
25EOS
26))
27
28(define (cmavo:create-table)
29  (sql:create-table jbogenturfahi-db #<<EOS
30create table if not exists
31cmavo(valsi varchar(9) primary key,
32      selmaho varchar(6) not null,
33      series int);
34EOS
35))
36
37(define (cmavo:gen-insert)
38  (sql:gen-insert jbogenturfahi-db #<<EOS
39insert into cmavo('valsi', 'selmaho', 'series')
40values(?, ?, ?);
41EOS
42))
43
44(define (cmavo:gen-select-list)
45  (sql:gen-select-list jbogenturfahi-db #<<EOS
46select   selmaho,
47         valsi
48from     cmavo
49order by valsi
50EOS
51))
Note: See TracBrowser for help on using the repository browser.