some quick-hack prototypes for sql

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@2244 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Linas Vepstas
2000-04-30 23:25:36 +00:00
parent e3f1eec9ed
commit bf0d4f0aaf
3 changed files with 63 additions and 0 deletions

20
src/engine/sql/README Normal file
View File

@@ -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
--

5
src/engine/sql/gnc-init.sh Executable file
View File

@@ -0,0 +1,5 @@
#! /bin/sh
# create teh initial database
createdb "gnc_bogus"
psql gnc_bogus < gnc-init.sql

View File

@@ -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)
);