From bf0d4f0aafb6fe3b25823be82b8f63ba119803dd Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Sun, 30 Apr 2000 23:25:36 +0000 Subject: [PATCH] some quick-hack prototypes for sql git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2244 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/engine/sql/README | 20 +++++++++++++++++++ src/engine/sql/gnc-init.sh | 5 +++++ src/engine/sql/gnc-init.sql | 38 +++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 src/engine/sql/README create mode 100755 src/engine/sql/gnc-init.sh create mode 100644 src/engine/sql/gnc-init.sql diff --git a/src/engine/sql/README b/src/engine/sql/README new file mode 100644 index 0000000000..31de91a2e5 --- /dev/null +++ b/src/engine/sql/README @@ -0,0 +1,20 @@ + +This directory contains very broken, very experimental code +for sql support. It doesn't work. The instructions bwlow are for +developers who want to hack this code. + +1) Install postgresl server, client and devel packages. +2) if installed from redhat, then running /etc/rc.d/init.d/postgresql + will setup and initialize all first-time setup & config. +3) as root, su - postgres then run 'createuser' to add your user id + +4) run the script gnc-init.sh + + + +Development Notes +----------------- +Just about everything done in this demo is wrong. +-- primary keeys need to be built +-- + diff --git a/src/engine/sql/gnc-init.sh b/src/engine/sql/gnc-init.sh new file mode 100755 index 0000000000..e8401b01c5 --- /dev/null +++ b/src/engine/sql/gnc-init.sh @@ -0,0 +1,5 @@ +#! /bin/sh + +# create teh initial database +createdb "gnc_bogus" +psql gnc_bogus < gnc-init.sql diff --git a/src/engine/sql/gnc-init.sql b/src/engine/sql/gnc-init.sql new file mode 100644 index 0000000000..3694d9ebb5 --- /dev/null +++ b/src/engine/sql/gnc-init.sql @@ -0,0 +1,38 @@ + +-- these tables roughly mirror the c structs in TransactionP.h and +-- AccountP.h + +CREATE TABLE gncAccount ( + accountGuid CHAR(16) PRIMARY KEY, + accountName VARCHAR(40) DEFAULT 'xoxo', + accountCode VARCHAR(8), + description VARCHAR(120), + notes VARCHAR(120), + type INT2, + currency VARCHAR(8), + security VARCHAR(8) +); + + +-- a gncEntry is what we call 'Split' elsewhere in the engine + +CREATE TABLE gncEntry ( + entryGuid CHAR(16) PRIMARY KEY, + accountGuid CHAR(16), + transGuid CHAR(16), + memo VARCHAR(20), + action VARCHAR(20), + date_reconciled DATETIME, + amount FLOAT8 DEFAULT '0.0', + share_price FLOAT8 DEFAULT '0.0' +); + +CREATE TABLE gncTransaction ( + transGuid CHAR(16) PRIMARY KEY, + date_entered DATETIME, + date_posted DATETIME, + num VARCHAR(8), + description VARCHAR(32) +); + +