[docs] docs - heins modified 2 files

docs at icdevgroup.org docs at icdevgroup.org
Sun Apr 11 14:08:45 EDT 2004


User:      heins
Date:      2004-04-11 18:08:45 GMT
Modified:  .        icdatabase.sdf ictemplates.sdf
Log:
* Add docs for COMPOSITE_KEY tables.

Revision  Changes    Path
1.61      +26 -3     docs/icdatabase.sdf


rev 1.61, prev_rev 1.60
Index: icdatabase.sdf
===================================================================
RCS file: /anon_cvs/repository/docs/icdatabase.sdf,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- icdatabase.sdf	6 Dec 2003 04:46:41 -0000	1.60
+++ icdatabase.sdf	11 Apr 2004 18:08:45 -0000	1.61
@@ -1,10 +1,10 @@
 !init OPT_LOOK="icdevgroup"; OPT_STYLE="manual"
-# $Id: icdatabase.sdf,v 1.60 2003/12/06 04:46:41 mheins Exp $
+# $Id: icdatabase.sdf,v 1.61 2004/04/11 18:08:45 mheins Exp $
 
 !define DOC_NAME "Interchange Databases"
 !define DOC_TYPE ""
 !define DOC_CODE "icdatabase"
-!define DOC_VERSION substr('$Revision: 1.60 $',11, -2)
+!define DOC_VERSION substr('$Revision: 1.61 $',11, -2)
 !define DOC_STATUS "Draft"
 !define DOC_PROJECT "Interchange"
 !define DOC_URL "http://www.icdevgroup.org/doc/icdatabase.html"
@@ -27,7 +27,13 @@
 cound use Interchange's internal database. However, the order
 management functions of Interchange will be slower and not as robust
 without an SQL database. SQL is strongly recommended for at least the
-orderline, transactions, and userdb tables. 
+C<state>, C<country>, C<orderline>, C<transactions>, and C<userdb> tables. Any other
+tables that will have programmatic updates, such as C<inventory>, will
+be best placed in SQL.
+
+If you plan on using Interchange Admin UI, you should make the move
+to SQL. It provides easy import routines for text files that should
+replace text-file uploads.
 
 Keeping a database in an SQL manager makes it easier to integrate
 Interchange with other tools. Interchange can be used to maintain a
@@ -533,6 +539,23 @@
 >	Database country_memory country_memory.txt TAB
 >	Database country_memory MIRROR          country
 >	Database country_memory MEMORY          1
+
+H2: COMPOSITE_KEY
+
+If you are using a DBI table with composite keys, where two or more
+fields combine to make the unique identifier for a record, you must
+tell Interchange so it can request data in the right way. To do
+this, set:
+
+	Database  product_spec product_spec.asc dbi:mysql:foobase
+	Database  product_spec COMPOSITE_KEY sku feature
+	Database  product_spec COLUMN_DEF    "sku=varchar(32)"
+	Database  product_spec COLUMN_DEF    "feature=varchar(128)"
+
+If you want to create a custom index for the table, do so. If you
+don't specify a POSTCREATE or INDEX parameter for the table, Interchange
+will create a unique index with all composite key elements at table
+creation time.
 
 H2: Importing in a Page
 



1.52      +19 -3     docs/ictemplates.sdf


rev 1.52, prev_rev 1.51
Index: ictemplates.sdf
===================================================================
RCS file: /anon_cvs/repository/docs/ictemplates.sdf,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- ictemplates.sdf	26 Nov 2003 04:56:53 -0000	1.51
+++ ictemplates.sdf	11 Apr 2004 18:08:45 -0000	1.52
@@ -1,10 +1,10 @@
 !init OPT_LOOK="icdevgroup"; OPT_STYLE="manual"
-# $Id: ictemplates.sdf,v 1.51 2003/11/26 04:56:53 mheins Exp $
+# $Id: ictemplates.sdf,v 1.52 2004/04/11 18:08:45 mheins Exp $
 
 !define DOC_NAME "Template Guide"
 !define DOC_TYPE ""
 !define DOC_CODE "ictemplates"
-!define DOC_VERSION substr('$Revision: 1.51 $',11, -2)
+!define DOC_VERSION substr('$Revision: 1.52 $',11, -2)
 !define DOC_STATUS "Draft"
 !define DOC_PROJECT "Interchange"
 !define DOC_URL "http://www.icdevgroup.org/doc/ictemplates.html"
@@ -1095,6 +1095,22 @@
 .The available methods are:
 
 !block example; listitem=2
+
+	# Key for a normal table with one primary key
+	$key = 'foo';
+
+	# Array reference key for a COMPOSITE_KEY table
+	$composite_ary_key = ['foo','bar','buz'];
+
+	# Alternate hash reference key for a COMPOSITE_KEY table
+	$composite_hash_key = { key1 => 'foo', key2 => 'bar', key3 => 'buz'};
+
+	# Alternate null-separated key for a COMPOSITE_KEY table
+	$composite_nullsep_key = join "\0", 'foo','bar','buz'; 
+
+	### Any of the composite key types may be substitued
+	### when COMPOSITE_KEY table
+
     # access an element of the table
     $field = $db->field($key, $column);
 
@@ -1109,7 +1125,7 @@
 
     # Return some fields from a row
     my @fields = qw/sku price description/;
-    $array_ref = $db->get_slice($key, \@fields);
+    @values = $db->get_slice($key, \@fields);
 
     # Set some fields in a row (slice)
     my $key = 'os28004';








More information about the docs mailing list