[interchange-docs] xmldocs - docelic modified refs/Database
docs at icdevgroup.org
docs at icdevgroup.org
Tue Jan 29 14:47:56 EST 2008
User: docelic
Date: 2008-01-29 19:47:56 GMT
Modified: refs Database
Log:
* Add postgres database definition example
Revision Changes Path
1.10 +57 -3 xmldocs/refs/Database
rev 1.10, prev_rev 1.9
Index: Database
===================================================================
RCS file: /var/cvs/xmldocs/refs/Database,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Database 13 Dec 2006 22:48:11 -0000 1.9
+++ Database 29 Jan 2008 19:47:56 -0000 1.10
@@ -28,8 +28,8 @@
of alphanumeric characters including underscore, and we recommend they're in
all lower- or upper-case.
</para><para>
-<literal>source_file</literal> specifies the initial database
-source file, and <literal>type</literal> specifies its format.
+<literal>source_file</literal> specifies the initial database text
+source file, and <literal>type</literal> specifies database format.
</para><para>
For more about &IC; and databases, and supported formats, see &glos-database;
glossary entry.
@@ -57,7 +57,61 @@
</programlisting>
__END__
+__NAME__ example: Definition of a Postgres database table
+<programlisting>
+#
+# Required for PostgreSQL
+#
+Require module DBI
+Require module DBD::Pg
+
+Variable SQLDSN dbi:Pg:dbname=database_name
+Variable SQLUSER username
+Variable SQLPASS password
+Variable SOME_DATABASE 1
+
+<ParseVariables Yes>
+
+DatabaseDefault USER __SQLUSER__
+DatabaseDefault PASS __SQLPASS__
+DatabaseDefault NO_ASCII_INDEX 1
+
+Message -i -n Using PostgreSQL, DSN=__SQLDSN__...
+
+#
+# Individual database table definitions
+#
+
+Database table_name table_name.txt __SQLDSN__
+
+</ParseVariables>
+
+#
+# Optional table descriptions
+#
+
+Database table_name LENGTH_EXCEPTION_DEFAULT truncate_log
+Database table_name DEFAULT_TYPE varchar(255)
+
+Database table_name KEY sku
+Database table_name HIDE_FIELD inactive
+
+Database table_name COLUMN_DEF "sku=varchar(64) NOT NULL PRIMARY KEY"
+Database table_name COLUMN_DEF "description=varchar(128)"
+Database table_name COLUMN_DEF "price=varchar(12)"
+
+Database table_name INDEX description
+Database table_name INDEX price
+
+</programlisting>
+
+For the above example to work, you will need file <literal><replaceable>table_name.txt</replaceable></literal> present within &conf-ProductDir;, containing the initial data set for the table. If there's no initial data set and the table should be empty, the file still needs to contain a single line with three column names, separated by a TAB:
+<programlisting>
+sku description price
+</programlisting>
+__END__
+
__NAME__ missing
-Examples for each DB type supported (Oracle, Pg, Mys,... )
+Examples for each DB type supported (Oracle, Mys,... )
List of all keys that can occur in a specification
__END__
More information about the docs
mailing list