Index: openacs-4/packages/acs-core-docs/www/tutorial-database.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-core-docs/www/tutorial-database.html,v diff -u -r1.1.2.3 -r1.1.2.4 --- openacs-4/packages/acs-core-docs/www/tutorial-database.html 15 Apr 2003 17:03:03 -0000 1.1.2.3 +++ openacs-4/packages/acs-core-docs/www/tutorial-database.html 19 Apr 2003 20:39:33 -0000 1.1.2.4 @@ -1,9 +1,9 @@ -Setting Up Database Objects

Setting Up Database Objects

+Setting Up Database Objects

Setting Up Database Objects

by Joel Aufrecht
OpenACS docs are written by the named authors, but may be edited by OpenACS documentation staff. -

Code the data model

We create all database objects with scripts in the +

Code the data model

We create all database objects with scripts in the samplenote/sql/ directory. All database scripts are database-specific and are thus in either the samplenote/sql/oracle or @@ -40,7 +40,7 @@ @author which will be picked up by the API browser. The string $Id$ will automatically be - expanded when the file is checked in to cvs.

[service0@yourserver postgresql]$ emacs samplenote-create.sql

Paste this into the file and save and close.

Figure�8.1.�Database Creation Script - master create file

--
+      expanded when the file is checked in to cvs.

[service0@yourserver postgresql]$ emacs samplenote-create.sql

Paste this into the file and save and close.

Figure�8.2.�Database Creation Script - master create file

--
 -- packages/samplenote/sql/postgresql/samplenote-create.sql
 --
 -- @author rhs@mit.edu
@@ -50,7 +50,7 @@
 --
 
 \i samplenote-table-create.sql
-\i samplenote-functions-create.sql

Create the file to create the database table.

[service0@yourserver postgresql]$ emacs samplenote-table-create.sql

Paste this into the file and save and close.

Figure�8.2.�Database Creation Script - table

--
+\i samplenote-functions-create.sql

Create the file to create the database table.

[service0@yourserver postgresql]$ emacs samplenote-table-create.sql

Paste this into the file and save and close.

Figure�8.3.�Database Creation Script - table

--
 -- packages/samplenote/sql/postgresql/samplenote-table-create.sql
 --
 -- @author rhs@mit.edu
@@ -101,7 +101,7 @@
 end;' language 'plpgsql';
 select inline_0 ();
 drop function inline_0 ();
-

Create the file to create the functions used to manipulate records.

[service0@yourserver postgresql]$ emacs samplenote-functions-create.sql

Paste this into the file and save and close.

Figure�8.3.�Database Creation Script - functions

--
+

Create the file to create the functions used to manipulate records.

[service0@yourserver postgresql]$ emacs samplenote-functions-create.sql

Paste this into the file and save and close.

Figure�8.4.�Database Creation Script - functions

--
 -- packages/samplenote/sql/postgresql/samplenote-functions-create.sql
 --
 -- @author rhs@mit.edu
@@ -123,7 +123,7 @@
 "package-aware." 
 define_function_args prepares the function to be used by a tcl wrapper function. */
 
-select define_function_args(samplenote__new,'note_id,title,creation_date,creation_user,creation_ip,context_id'); 
+select define_function_args('samplenote__new','note_id,title,creation_date,creation_user,creation_ip,context_id'); 
 
 create or replace function samplenote__new (integer,varchar,varchar,timestamptz,integer,varchar,integer)
 returns integer as '
@@ -196,7 +196,7 @@
 end;
 ' language 'plpgsql';
 

Create a database file to drop everything if the package - is uninstalled.

[service0@yourserver postgresql]$ emacs samplenote-drop.sql

Figure�8.4.�Database deletion script

-- packages/samplenote/sql/samplenote-drop.sql
+        is uninstalled.

[service0@yourserver postgresql]$ emacs samplenote-drop.sql

Figure�8.5.�Database deletion script

-- packages/samplenote/sql/samplenote-drop.sql
 -- drop script
 --
 -- @author rhs@mit.edu
@@ -310,4 +310,4 @@
                           0
 (1 row)
 
-[service0@yourserver postgresql]$

Once both scripts are working without errors, run the create script one last time and proceed.

View comments on this page at openacs.org
+[service0@yourserver postgresql]$

Once both scripts are working without errors, run the create script one last time and proceed.

View comments on this page at openacs.org