[interchange-cvs] interchange - heins modified lib/Vend/Table/DBI.pm

interchange-core@icdevgroup.org interchange-core@icdevgroup.org
Mon Apr 21 15:27:01 2003


User:      heins
Date:      2003-04-21 19:27:00 GMT
Modified:  lib/Vend/Table DBI.pm
Log:
* Allow setting of table type in MySQL (or others if HAS_TABLE_TYPE
  is put in capabilities). This allows setting the table type to
  something besides the default -- in particular allows InnoDB type
  setting for userdb/transactions/orderline.

       Database  userdb   TABLE_TYPE  InnoDB

Revision  Changes    Path
2.45      +8 -2      interchange/lib/Vend/Table/DBI.pm


rev 2.45, prev_rev 2.44
Index: DBI.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Table/DBI.pm,v
retrieving revision 2.44
retrieving revision 2.45
diff -u -r2.44 -r2.45
--- DBI.pm	21 Apr 2003 13:35:31 -0000	2.44
+++ DBI.pm	21 Apr 2003 19:27:00 -0000	2.45
@@ -1,6 +1,6 @@
 # Vend::Table::DBI - Access a table stored in an DBI/DBD database
 #
-# $Id: DBI.pm,v 2.44 2003/04/21 13:35:31 mheins Exp $
+# $Id: DBI.pm,v 2.45 2003/04/21 19:27:00 mheins Exp $
 #
 # Copyright (C) 1996-2002 Red Hat, Inc. <interchange@redhat.com>
 #
@@ -20,7 +20,7 @@
 # MA  02111-1307  USA.
 
 package Vend::Table::DBI;
-$VERSION = substr(q$Revision: 2.44 $, 10);
+$VERSION = substr(q$Revision: 2.45 $, 10);
 
 use strict;
 
@@ -178,6 +178,9 @@
 		Oracle => "CREATE SEQUENCE _SEQUENCE_NAME_",
 		Pg => "CREATE SEQUENCE _SEQUENCE_NAME_",
 	},
+	HAS_TABLE_TYPE	 => { 
+		mysql => 1,
+	},
 	SEQUENCE_QUERY	 => { 
 		Oracle => "SELECT _SEQUENCE_NAME_.nextval FROM dual",
 		Pg => "SELECT nextval('_SEQUENCE_NAME_')",
@@ -286,6 +289,9 @@
 	my $query = "create table $tablename ( \n";
 	$query .= join ",\n", @cols;
 	$query .= "\n)\n";
+	if($config->{HAS_TABLE_TYPE} and $config->{TABLE_TYPE} ) {
+		$query =~ s/\s*$/ type=$config->{TABLE_TYPE}\n/;
+	}
 	return $query;
 }