mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-02-24 12:11:18 +00:00
compiles without warning cleanup, removed logs, added exceptions * GSWDatabase/WODisplayGroup.h cleanup includes * Examples/WebBookStore1/Main.m removed create and drop tables. * Examples/WebBookStore1/WebBookStore1_main.m adapt to WO naming * Examples/WebBookStore1/Main.gswc -> Main.wo * Examples/WebBookStore1/GNUmakefile updated * Examples/WebBookStore1/Application.h * Examples/WebBookStore1/DirectAction.h * Examples/WebBookStore1/DirectAction.m * Examples/WebBookStore1/Session.h * Examples/WebBookStore1/Main.h WO naming * Examples/WebBookStore1/README new file * Examples/WebBookStore1/BookStore.eomodeld/index.eomodeld added more sample data to connection dictionary * GNUmakefile add GSWDatabase to main project makefile git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@30643 72102866-910b-0410-8b05-ffd578937521
65 lines
2.2 KiB
Text
65 lines
2.2 KiB
Text
This is how you can get started.
|
|
|
|
Create the database:
|
|
|
|
createdb BookStore
|
|
|
|
psql BookStore
|
|
|
|
copy/paste this stuff in:
|
|
|
|
CREATE TABLE BSAUTHOR (FNAME varchar(30), LNAME varchar(30), PID integer NOT NULL);
|
|
CREATE TABLE BSBOOK (FK_AUTHOR integer, PID integer NOT NULL, TITLE varchar(30));
|
|
CREATE TABLE BSCUSTOMER (FNAME varchar(30), LNAME varchar(30), PID integer NOT NULL);
|
|
CREATE TABLE BSORDER (FK_CUSTOMER integer, PID integer NOT NULL);
|
|
CREATE TABLE BSORDERPOS (FK_ORDER integer, PID integer NOT NULL);
|
|
CREATE SEQUENCE BSAUTHOR_SEQ;
|
|
CREATE SEQUENCE BSBOOK_SEQ;
|
|
CREATE SEQUENCE BSCUSTOMER_SEQ;
|
|
CREATE SEQUENCE BSORDER_SEQ;
|
|
CREATE SEQUENCE BSORDERPOS_SEQ;
|
|
ALTER TABLE BSAUTHOR ADD PRIMARY KEY (PID);
|
|
ALTER TABLE BSBOOK ADD PRIMARY KEY (PID);
|
|
ALTER TABLE BSCUSTOMER ADD PRIMARY KEY (PID);
|
|
ALTER TABLE BSORDER ADD PRIMARY KEY (PID);
|
|
ALTER TABLE BSORDERPOS ADD PRIMARY KEY (PID);
|
|
ALTER TABLE BSBOOK ADD CONSTRAINT BSBOOK_author_FK FOREIGN KEY (FK_AUTHOR) REFERENCES BSAUTHOR (PID) DEFERRABLE INITIALLY DEFERRED;
|
|
ALTER TABLE BSORDER ADD CONSTRAINT BSORDER_customer_FK FOREIGN KEY (FK_CUSTOMER) REFERENCES BSCUSTOMER (PID) DEFERRABLE INITIALLY DEFERRED;
|
|
|
|
%----------------------
|
|
|
|
check what we created:
|
|
|
|
BookStore=# \d
|
|
List of relations
|
|
Schema | Name | Type | Owner
|
|
--------+----------------+----------+-------
|
|
public | bsauthor | table | dave
|
|
public | bsauthor_seq | sequence | dave
|
|
public | bsbook | table | dave
|
|
public | bsbook_seq | sequence | dave
|
|
public | bscustomer | table | dave
|
|
public | bscustomer_seq | sequence | dave
|
|
public | bsorder | table | dave
|
|
public | bsorder_seq | sequence | dave
|
|
public | bsorderpos | table | dave
|
|
public | bsorderpos_seq | sequence | dave
|
|
(10 rows)
|
|
|
|
check .../pgsql/data/pg_hba.conf
|
|
The machine running your program should be able to access your database.
|
|
This works for me:
|
|
|
|
host all all 172.16.112.1/32 password
|
|
(you might have to change the IP)
|
|
|
|
if needed make pgsql load the new config.
|
|
|
|
adjust the connection dictionary in BookStore.eomodeld/index.eomodeld
|
|
|
|
Especially these fields. You can use any text editor or the EOModelEditor.
|
|
|
|
databaseServer = hostname;
|
|
password = pw;
|
|
userName = dave;
|
|
|