[fdo-commits] r635 - in trunk/Providers/GenericRdbms: Nls Src/Fdo Src/MySQL Src/MySQL/Driver Src/MySQL/SchemaMgr Src/MySQL/SchemaMgr/Ph Src/MySQL/SchemaMgr/Ph/Rd Src/ODBC Src/Rdbi Src/SchemaMgr Src/SchemaMgr/Ph Src/UnitTest/Common Src/UnitTest/MySql com

svn_fdo at osgeo.org svn_fdo at osgeo.org
Tue Jan 16 09:41:27 EST 2007


Author: brentrobinson
Date: 2007-01-16 09:41:27 -0500 (Tue, 16 Jan 2007)
New Revision: 635

Added:
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/CharacterSet.cpp
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/CharacterSet.h
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Collation.cpp
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Collation.h
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/CharacterSetReader.cpp
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/CharacterSetReader.h
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/CollationReader.cpp
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/CollationReader.h
Modified:
   trunk/Providers/GenericRdbms/Nls/fdordbmsmsg.mc
   trunk/Providers/GenericRdbms/Src/Fdo/Fdo.vcproj
   trunk/Providers/GenericRdbms/Src/MySQL/Driver/connect.c
   trunk/Providers/GenericRdbms/Src/MySQL/Driver/local.h
   trunk/Providers/GenericRdbms/Src/MySQL/Driver/rdbi_init.c
   trunk/Providers/GenericRdbms/Src/MySQL/Driver/set_schema.c
   trunk/Providers/GenericRdbms/Src/MySQL/Driver/xlt_status.c
   trunk/Providers/GenericRdbms/Src/MySQL/MySql.vcproj
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/MySqlSchemaMgr.vcproj
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Column.cpp
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Column.h
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnChar.cpp
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnChar.h
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnInt64.h
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Database.cpp
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Database.h
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/DbObject.cpp
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/DbObject.h
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Makefile.am
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.cpp
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.h
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/ColumnReader.cpp
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/DbObjectReader.cpp
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/Makefile.am
   trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/OwnerReader.cpp
   trunk/Providers/GenericRdbms/Src/ODBC/Odbc.vcproj
   trunk/Providers/GenericRdbms/Src/Rdbi/Rdbi.vcproj
   trunk/Providers/GenericRdbms/Src/SchemaMgr/GrdSchemaMgr.vcproj
   trunk/Providers/GenericRdbms/Src/SchemaMgr/Ph/Owner.cpp
   trunk/Providers/GenericRdbms/Src/UnitTest/Common/DataTypeTests.cpp
   trunk/Providers/GenericRdbms/Src/UnitTest/Common/DataTypeTests.h
   trunk/Providers/GenericRdbms/Src/UnitTest/Common/SelectTests.cpp
   trunk/Providers/GenericRdbms/Src/UnitTest/Common/SelectTests.h
   trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDataTypeTests.cpp
   trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDataTypeTests.h
   trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoUpdateTest.cpp
   trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoUpdateTest.h
   trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaMgrTests.cpp
   trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaMgrTests.h
   trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSelectTests.h
   trunk/Providers/GenericRdbms/com/fdo_sys_idx.sql
Log:
Merged from 3.2.x branch (UTF8 connection character set from MySQL).

Modified: trunk/Providers/GenericRdbms/Nls/fdordbmsmsg.mc
===================================================================
--- trunk/Providers/GenericRdbms/Nls/fdordbmsmsg.mc	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Nls/fdordbmsmsg.mc	2007-01-16 14:41:27 UTC (rev 635)
@@ -165,6 +165,11 @@
 Language=English
 Cannot create datastore, name '%1$ls' is a reserved word
 .
+MessageId=2209
+SymbolicName=FDORDBMS_4
+Language=English
+Collations can only be retrieved from current MySQL server
+.
 MessageId=2210
 SymbolicName=FDORDBMS_5
 Language=English
@@ -180,6 +185,11 @@
 Language=English
 Cannot turn on persistent locking for table '%1$ls': it is accessed through a database link.
 .
+MessageId=2213
+SymbolicName=FDORDBMS_8
+Language=English
+Character Sets can only be retrieved from current MySQL server
+.
 MessageId=2215
 SymbolicName=FDORDBMS_10
 Language=English

Modified: trunk/Providers/GenericRdbms/Src/Fdo/Fdo.vcproj
===================================================================
--- trunk/Providers/GenericRdbms/Src/Fdo/Fdo.vcproj	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/Fdo/Fdo.vcproj	2007-01-16 14:41:27 UTC (rev 635)
@@ -40,6 +40,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				AdditionalOptions="-Zm112"
 				Optimization="0"
 				AdditionalIncludeDirectories="../../inc/rdbi;../;../../;../../inc/fdo;../../inc;./Other;./Capability;./Connection;./Custom;./FeatureCommands;./Filter;./Lock;./Lt;./Schema;./SpatialContext;$(FDO)\Unmanaged;$(FDO)\Unmanaged\inc;$(FDO)\Unmanaged/src/geometry;$(FDOUTILITIES)\SchemaMgr/inc;$(FDOUTILITIES)\Common\inc;..\Gdbi;..\LongTransactionManager;..\LockManager"
 				PreprocessorDefinitions="WIN32;_DEBUG;FDORDBMS_EXPORTS;_LIB;FULLPROTO;GISSPATIAL_STATIC;_CRT_SECURE_NO_DEPRECATE"

Modified: trunk/Providers/GenericRdbms/Src/MySQL/Driver/connect.c
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/Driver/connect.c	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/Driver/connect.c	2007-01-16 14:41:27 UTC (rev 635)
@@ -31,7 +31,13 @@
 #include "xlt_status.h"
 #include <malloc.h>
 #include <wchar.h>
+#include <locale.h>
 
+static int set_characterset (
+    mysql_context_def *context,
+    bool isDDL
+);
+
 int mysql_connect (
     mysql_context_def *context,
     char  *connect_string,
@@ -128,6 +134,8 @@
                             // delimited in SQL statements, thus allowing queries on tables
                             // and columns with special characters in their names.
                             ret = mysql_run_sql( context, "set sql_mode='ANSI_QUOTES'", false, &rows_processed );
+                            if ( ret == 0 ) 
+                                ret = set_characterset( context, false );
 						}
 						else if (context->mysql_current_connect2 == -1)
 						{
@@ -136,6 +144,8 @@
 							context->mysql_connections[index] = handle;
                             // See note 10 lines above.
                             ret = mysql_run_sql( context, "set sql_mode='ANSI_QUOTES'", true, &rows_processed );
+                            if ( ret == 0 ) 
+                                ret = set_characterset( context, true );
 							break;
 						}
 
@@ -147,3 +157,24 @@
 
     return (ret);
 }
+
+int set_characterset (
+    mysql_context_def *context,
+    bool isDDL
+)
+{
+    int ret = 0;
+    int rows_processed;
+
+    ret = mysql_run_sql( context, "set character_set_connection='utf8'", isDDL, &rows_processed );
+    if ( ret == 0 ) 
+        ret = mysql_run_sql( context, "set character_set_client='utf8'", isDDL, &rows_processed );
+    if ( ret == 0 ) 
+        ret = mysql_run_sql( context, "set character_set_results='utf8'", isDDL, &rows_processed );
+    if ( ret == 0 ) 
+        ret = mysql_run_sql( context, "set collation_connection='utf8_bin'", isDDL, &rows_processed );
+    if ( ret == 0 ) 
+        ret = mysql_run_sql( context, "set collation_database='utf8_bin'", isDDL, &rows_processed );
+
+    return ret;
+}

Modified: trunk/Providers/GenericRdbms/Src/MySQL/Driver/local.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/Driver/local.h	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/Driver/local.h	2007-01-16 14:41:27 UTC (rev 635)
@@ -35,6 +35,8 @@
 	long  mysql_current_connect2; /* 2nd connection for DDLs */
     MYSQL *mysql_connections[RDBI_MAX_CONNECTS]; /* connection objects */
     wchar_t  mysql_last_err_msg[RDBI_MSG_SIZE];
+    long mysql_char_size; // Character size in bytes as defined by current connection
+                          // character set. 
 } mysql_context_def;
 
 typedef struct _mysql_redefine_def

Modified: trunk/Providers/GenericRdbms/Src/MySQL/Driver/rdbi_init.c
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/Driver/rdbi_init.c	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/Driver/rdbi_init.c	2007-01-16 14:41:27 UTC (rev 635)
@@ -54,6 +54,7 @@
         memset (context, 0, sizeof (mysql_context_def));
         context->mysql_current_connect = -1;
 		context->mysql_current_connect2 = -1;
+        context->mysql_char_size = 3; // for UTF8 character set
         //initialized = mysql_library_init (-1, NULL, NULL); /* not embedded server */
         initialized = 1;
         if (0 == initialized)

Modified: trunk/Providers/GenericRdbms/Src/MySQL/Driver/set_schema.c
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/Driver/set_schema.c	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/Driver/set_schema.c	2007-01-16 14:41:27 UTC (rev 635)
@@ -32,7 +32,7 @@
 
     stmt = (char*)alloca( strlen(schema_name) + 10 );
 
-    sprintf( stmt, "use %s", schema_name );
+    sprintf( stmt, "use \"%s\"", schema_name );
 	
     ret = mysql_run_sql( context, stmt, 0, NULL );
 	if (ret == RDBI_SUCCESS)

Modified: trunk/Providers/GenericRdbms/Src/MySQL/Driver/xlt_status.c
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/Driver/xlt_status.c	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/Driver/xlt_status.c	2007-01-16 14:41:27 UTC (rev 635)
@@ -152,7 +152,7 @@
     if ( mysql ) {
         unsigned long server_version = mysql_get_server_version( mysql );
 
-        if ( server_version < 50015 ) {
+        if ( server_version < 50022 ) {
             // Also, various errors can occur when database has too old a version.
             const wchar_t* server_msg = mysql_nls_server_version( server_version );
             cat_msg( err_msg, server_msg, err_msg_left );

Modified: trunk/Providers/GenericRdbms/Src/MySQL/MySql.vcproj
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/MySql.vcproj	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/MySql.vcproj	2007-01-16 14:41:27 UTC (rev 635)
@@ -40,6 +40,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				AdditionalOptions="-Zm112"
 				Optimization="0"
 				AdditionalIncludeDirectories="../../inc/rdbi;../;../../;../../inc;../../inc/fdo;../Fdo/Connection;../Fdo/Other;../Fdo/FeatureCommands;../Fdo/Custom;../Fdo/Schema;../Fdo/Lt;../Fdo/Lock;../Fdo/SpatialContext;$(FDO)\Unmanaged;$(FDO)\Unmanaged\inc;../../../Oracle\inc\Fdo\fdo;$(FDOTHIRDPARTY)/oracle/oci/include;$(FDOUTILITIES)/SchemaMgr/inc;../../../Oracle;$(FDOUTILITIES)\Common\inc;..\Gdbi;..\LongTransactionManager;..\GenericLongTransactionManager;..\LockManager"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;FDORDBMS_EXPORTS;_USRDLL;MYSQL_EXPORTS;_LIB;_CRT_SECURE_NO_DEPRECATE"

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/MySqlSchemaMgr.vcproj
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/MySqlSchemaMgr.vcproj	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/MySqlSchemaMgr.vcproj	2007-01-16 14:41:27 UTC (rev 635)
@@ -40,6 +40,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				AdditionalOptions="-Zm110"
 				Optimization="0"
 				AdditionalIncludeDirectories="$(FDO)\Unmanaged\Inc;$(FDO)\Unmanaged;$(FDOUTILITIES)\SchemaMgr\Inc;..\..\..;..\..\..\Inc;$(FDOUTILITIES)\Common\Inc"
 				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FDORDBMS_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
@@ -234,6 +235,14 @@
 				Name="Ph"
 				>
 				<File
+					RelativePath=".\Ph\CharacterSet.cpp"
+					>
+				</File>
+				<File
+					RelativePath=".\Ph\Collation.cpp"
+					>
+				</File>
+				<File
 					RelativePath="Ph\ColTypeMapper.cpp"
 					>
 				</File>
@@ -297,6 +306,14 @@
 					Name="Rdb"
 					>
 					<File
+						RelativePath=".\Ph\Rd\CharacterSetReader.cpp"
+						>
+					</File>
+					<File
+						RelativePath=".\Ph\Rd\CollationReader.cpp"
+						>
+					</File>
+					<File
 						RelativePath="Ph\Rd\ColumnReader.cpp"
 						>
 						<FileConfiguration
@@ -395,6 +412,14 @@
 				Name="Ph"
 				>
 				<File
+					RelativePath=".\Ph\CharacterSet.h"
+					>
+				</File>
+				<File
+					RelativePath=".\Ph\Collation.h"
+					>
+				</File>
+				<File
 					RelativePath="Ph\ColTypeMapper.h"
 					>
 				</File>
@@ -494,6 +519,14 @@
 					Name="Rdb"
 					>
 					<File
+						RelativePath=".\Ph\Rd\CharacterSetReader.h"
+						>
+					</File>
+					<File
+						RelativePath=".\Ph\Rd\CollationReader.h"
+						>
+					</File>
+					<File
 						RelativePath="Ph\Rd\ColumnReader.h"
 						>
 					</File>

Copied: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/CharacterSet.cpp (from rev 617, branches/3.2.x/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/CharacterSet.cpp)

Copied: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/CharacterSet.h (from rev 617, branches/3.2.x/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/CharacterSet.h)

Copied: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Collation.cpp (from rev 617, branches/3.2.x/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Collation.cpp)

Copied: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Collation.h (from rev 617, branches/3.2.x/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Collation.h)

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Column.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Column.cpp	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Column.cpp	2007-01-16 14:41:27 UTC (rev 635)
@@ -25,7 +25,7 @@
 {
     if (NULL != reader)
     {
-        ; //TODO: read MySQL-specific column attributes from given reader
+        mCharacterSetName = reader->GetString( L"", L"character_set_name" );
     }
 }
 
@@ -35,7 +35,25 @@
 {
 }
 
+FdoSmPhCharacterSetP FdoSmPhMySqlColumn::GetCharacterSet()
+{
+    FdoSmPhCharacterSetP characterSet;
+    FdoSmPhMySqlDbObject* pDbObject = dynamic_cast<FdoSmPhMySqlDbObject*>((FdoSmSchemaElement*)(GetParent()));
 
+    if ( mCharacterSetName != L"" ) {
+        // Column has character set, retrieve it.
+        FdoSmPhDatabase* pDatabase = (FdoSmPhDatabase*)(FdoSmSchemaElement*)(pDbObject->GetParent()->GetParent());
+        characterSet = pDatabase->FindCharacterSet( mCharacterSetName );
+    }
+    else {
+        // Column does not have character set (might be new column.
+        // Get the default set (from containing object).
+        characterSet = pDbObject->GetCharacterSet();
+    }
+
+    return characterSet;
+}
+
 FdoStringP FdoSmPhMySqlColumn::GetAddSql()
 {
     // Get basic name/type/nullability SQL:

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Column.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Column.h	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Column.h	2007-01-16 14:41:27 UTC (rev 635)
@@ -30,6 +30,9 @@
     FdoSmPhMySqlColumn(FdoSmPhRdColumnReader* reader);
     virtual ~FdoSmPhMySqlColumn(void);
 
+    // Get this column's character set. 
+    FdoSmPhCharacterSetP GetCharacterSet();
+
     virtual FdoStringP GetAddSql();
 
 	virtual FdoStringP GetAutoincrementSql();
@@ -37,6 +40,9 @@
 protected:
     // NOTE: The following constructor is to satisfy the compiler, and should never actually be called:
     FdoSmPhMySqlColumn() {}
+
+private:
+    FdoStringP mCharacterSetName;
 };
 
 typedef FdoPtr<FdoSmPhMySqlColumn> FdoSmPhMySqlColumnP;

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnChar.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnChar.cpp	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnChar.cpp	2007-01-16 14:41:27 UTC (rev 635)
@@ -18,6 +18,7 @@
 
 #include "stdafx.h"
 #include "ColumnChar.h"
+#include "CharacterSet.h"
 
 FdoStringP FdoSmPhMySqlColumnChar::GetTypeSql()
 {
@@ -30,3 +31,17 @@
         return FdoSmPhColumnChar::GetTypeName();
 }
 
+FdoInt64 FdoSmPhMySqlColumnChar::GetDbBinarySize()
+{
+    FdoInt64 charCount = GetLength();
+    FdoInt64 charSize = 3; // Max character size in bytes.
+                           // Assume largest size by default. 
+
+    // Max character size is determine by column's character set. 
+    FdoSmPhMySqlCharacterSetP characterSet = GetCharacterSet().p->SmartCast<FdoSmPhMySqlCharacterSet>();
+    if ( characterSet ) 
+        charSize = characterSet->GetCharLen();
+
+    // Size is max characters X max character size. 
+    return charCount * charSize;
+}

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnChar.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnChar.h	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnChar.h	2007-01-16 14:41:27 UTC (rev 635)
@@ -66,6 +66,8 @@
     // Get SQL sub-clause for column type indicator
     virtual FdoStringP GetTypeSql();
 
+    virtual FdoInt64 GetDbBinarySize();
+
     static const FdoInt64 mVarcharMaxLen = 255;
     static const FdoInt64 mTextMaxLen = 65535;
     static const FdoInt64 mMediumTextMaxLen = 16777215;

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnInt64.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnInt64.h	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/ColumnInt64.h	2007-01-16 14:41:27 UTC (rev 635)
@@ -50,7 +50,7 @@
 
     virtual int GetRdbType()
     {
-        return RDBI_DOUBLE;
+        return RDBI_LONGLONG;
     }
 };
 

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Database.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Database.cpp	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Database.cpp	2007-01-16 14:41:27 UTC (rev 635)
@@ -19,8 +19,12 @@
 #include "stdafx.h"
 #include "Database.h"
 #include "Owner.h"
+#include "CharacterSet.h"
+#include "Collation.h"
 #include "Mgr.h"
 #include "Rd/OwnerReader.h"
+#include "Rd/CharacterSetReader.h"
+#include "Rd/CollationReader.h"
 
 FdoSmPhMySqlDatabase::FdoSmPhMySqlDatabase(
     FdoStringP name,
@@ -42,6 +46,20 @@
     return new FdoSmPhRdMySqlOwnerReader( FDO_SAFE_ADDREF(pDatabase), owner );
 }
 
+FdoPtr<FdoSmPhRdCharacterSetReader> FdoSmPhMySqlDatabase::CreateCharacterSetReader( FdoStringP characterSetName ) const
+{
+    FdoSmPhMySqlDatabase* pDatabase = (FdoSmPhMySqlDatabase*) this;
+
+    return new FdoSmPhRdMySqlCharacterSetReader( FDO_SAFE_ADDREF(pDatabase), characterSetName );
+}
+
+FdoPtr<FdoSmPhRdCollationReader> FdoSmPhMySqlDatabase::CreateCollationReader( FdoStringP collationName ) const
+{
+    FdoSmPhMySqlDatabase* pDatabase = (FdoSmPhMySqlDatabase*) this;
+
+    return new FdoSmPhRdMySqlCollationReader( FDO_SAFE_ADDREF(pDatabase), collationName );
+}
+
 FdoSmPhOwnerP FdoSmPhMySqlDatabase::NewOwner(
     FdoStringP owner,
     bool hasMetaSchema,
@@ -59,3 +77,27 @@
     );
 }
 
+FdoSmPhCharacterSetP FdoSmPhMySqlDatabase::NewCharacterSet(
+    FdoStringP characterSetName,
+    FdoSmPhRdCharacterSetReader* reader
+)
+{
+    return new FdoSmPhMySqlCharacterSet(
+        characterSetName,
+        this,
+        reader
+    );
+}
+
+FdoSmPhCollationP FdoSmPhMySqlDatabase::NewCollation(
+    FdoStringP collationName,
+    FdoSmPhRdCollationReader* reader
+)
+{
+    return new FdoSmPhMySqlCollation(
+        collationName,
+        this,
+        reader
+    );
+}
+

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Database.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Database.h	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Database.h	2007-01-16 14:41:27 UTC (rev 635)
@@ -43,17 +43,35 @@
 
     ~FdoSmPhMySqlDatabase(void);
 
-    // Create a reader to get all owner objects for this database.
-    // TODO: add flag to cache owners
+    /// Create a reader to get owner objects for this database.
     virtual FdoPtr<FdoSmPhRdOwnerReader> CreateOwnerReader( FdoStringP owner = L"") const;
 
+    /// Create a reader to get character sets for this database.
+    virtual FdoPtr<FdoSmPhRdCharacterSetReader> CreateCharacterSetReader( FdoStringP characterSetName = L"") const;
+
+    /// Create a reader to get collations for this database.
+    virtual FdoPtr<FdoSmPhRdCollationReader> CreateCollationReader( FdoStringP collationName = L"") const;
+
 protected:
+    /// Instantiate an owner (can be new or existing).
     virtual FdoSmPhOwnerP NewOwner(
         FdoStringP owner,
         bool hasMetaSchema,
         FdoSchemaElementState elementState
     );
 
+    // Instantiate a character set (must exist in RDBMS).
+    virtual FdoSmPhCharacterSetP NewCharacterSet(
+        FdoStringP characterSetName,
+        FdoSmPhRdCharacterSetReader* reader
+    );
+
+    // Instantiate a collation (must exist in RDBMS).
+    virtual FdoSmPhCollationP NewCollation(
+        FdoStringP collationName,
+        FdoSmPhRdCollationReader* reader
+    );
+
     virtual bool Add() {return true;}
     virtual bool Modify() {return true;}
     virtual bool Delete() {return true;}

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/DbObject.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/DbObject.cpp	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/DbObject.cpp	2007-01-16 14:41:27 UTC (rev 635)
@@ -56,6 +56,7 @@
         mStorageEngine = StorageEngineStringToEnum(reader->GetString(L"", L"storage_engine"));
         mDataDirectory = reader->GetString(L"", L"data_directory");
         mIndexDirectory = reader->GetString(L"", L"index_directory");
+        mCollationName = reader->GetString(L"", L"table_collation");
 
         // TEMPORARY WORKAROUNDS - BEGIN:
         // Need to add a FdoSmPhRdDbObjectReader::IsNull() method to detect NULL values for column seed:
@@ -87,6 +88,30 @@
     return true;
 }
 
+FdoSmPhCharacterSetP FdoSmPhMySqlDbObject::GetCharacterSet()
+{
+    FdoSmPhCharacterSetP characterSet;
+    FdoSmPhMySqlOwner* pOwner = (FdoSmPhMySqlOwner*)(FdoSmSchemaElement*)(GetParent());
+
+    if ( mCollationName != L"" ) {
+        // Object has collation so retrieve it.
+        FdoSmPhDatabase* pDatabase = (FdoSmPhDatabase*)(FdoSmSchemaElement*)(pOwner->GetParent());
+        FdoSmPhCollationP collation = pDatabase->FindCollation( mCollationName );
+        
+        // get the character set for the collation.
+        if ( collation )
+            characterSet = collation->GetCharacterSet();
+    }
+    else {
+        // Object has no collation (likely a new object)
+        // Get default character set (from owner).
+        characterSet = pOwner->GetCharacterSet();
+    }
+
+    return characterSet;
+}
+
+
 FdoStringsP FdoSmPhMySqlDbObject::GetKeyColsSql( FdoSmPhColumnCollection* columns )
 {
     FdoInt32        i;
@@ -151,10 +176,22 @@
 
         // Initially assume no truncation required.
         FdoInt32 constrColLen = 0;
+        FdoInt64 colBinarySize = column->GetDbBinarySize();
+        FdoInt32 colLen = column->GetLength();
 
-        if ( (largeColCount > 0) && (column->GetDbBinarySize() > colMaxLen) )
-            // Truncating and column needs to be truncated
-            constrColLen = colMaxLen;
+        if ( (largeColCount > 0) && (colBinarySize > colMaxLen) ) {
+            // For character type columns, length and binary size differ
+            // when the character set is not Latin1. Calculate the 
+            // size/length ratio (bytes per length unit).
+            FdoInt32 bytesPerUnit = 1;
+            if ( colLen > 0 ) 
+                bytesPerUnit = (FdoInt32)(colBinarySize / colLen);
+
+            // Truncating and column needs to be truncated.
+            // Divide by Bytes/LengthUnit to convert from truncated binary size
+            // to length.
+            constrColLen = (FdoInt32)(colMaxLen / bytesPerUnit);
+        }
         else if ( (column->GetType() == FdoSmPhColType_String) && (column->GetTypeName().ICompare(L"varchar") != 0) )
             // text key columns always need length specified since 
             // maximum length for various text types is greater

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/DbObject.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/DbObject.h	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/DbObject.h	2007-01-16 14:41:27 UTC (rev 635)
@@ -40,6 +40,7 @@
     MySQLOvStorageEngineType GetStorageEngine() const { return mStorageEngine; };
     FdoString* GetDataDirectory() const { return mDataDirectory; };
     FdoString* GetIndexDirectory() const { return mIndexDirectory; };
+    FdoSmPhCharacterSetP GetCharacterSet();
 
     // Convert storage engine between string and enumerated type:
     static FdoString* StorageEngineEnumToString(MySQLOvStorageEngineType storageEngine);
@@ -226,6 +227,7 @@
     MySQLOvStorageEngineType mStorageEngine;
     FdoStringP mDataDirectory;
     FdoStringP mIndexDirectory;
+    FdoStringP mCollationName;
 };
 
 typedef FdoPtr<FdoSmPhMySqlDbObject> FdoSmPhMySqlDbObjectP;

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Makefile.am
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Makefile.am	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Makefile.am	2007-01-16 14:41:27 UTC (rev 635)
@@ -24,6 +24,8 @@
 noinst_LTLIBRARIES = libFdoRdbmsMySQL_SchemaMgr_Ph.la
 
 libFdoRdbmsMySQL_SchemaMgr_Ph_la_SOURCES = \
+  CharacterSet.cpp \
+  Collation.cpp \
   ColTypeMapper.cpp \
   ColumnChar.cpp \
   Column.cpp \
@@ -39,6 +41,8 @@
   View.cpp
 
 noinst_HEADERS = $(libFdoRdbmsMySQL_SchemaMgr_Ph_la_SOURCES) \
+  CharacterSet.h \
+  Collation.h \
   ColTypeMapper.h \
   Column.h \
   ColumnBLOB.h \

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.cpp	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.cpp	2007-01-16 14:41:27 UTC (rev 635)
@@ -21,23 +21,16 @@
 #include "Table.h"
 #include "View.h"
 #include "Mgr.h"
+#include "CharacterSet.h"
 #include "Rd/DbObjectReader.h"
 #include "Rd/ColumnReader.h"
 #include "Rd/ConstraintReader.h"
 #include "Rd/FkeyReader.h"
 #include "Rd/IndexReader.h"
+#include "Rd/OwnerReader.h"
 #include "Rd/PkeyReader.h"
 #include "Inc/Rdbi/proto.h"
 
-struct mysql_context_def;
-
-extern "C" {
-    int mysql_run_sql (
-        mysql_context_def *context,
-        char *sql
-    );
-}
-
 FdoInt32 FdoSmPhMySqlOwner::mTempTableNum = 0;
 FdoCommonThreadMutex FdoSmPhMySqlOwner::mMutex;
 
@@ -46,16 +39,30 @@
     bool hasMetaSchema,
     const FdoSmPhDatabase* pDatabase,
     FdoSchemaElementState elementState,
-    FdoSmPhRdDbObjectReader* reader
+    FdoSmPhRdOwnerReader* reader
 ) :
     FdoSmPhGrdOwner(name, hasMetaSchema, pDatabase, elementState)
 {
+    if ( reader )
+        mCharacterSetName = reader->GetString( L"", L"default_character_set_name" );
 }
 
 FdoSmPhMySqlOwner::~FdoSmPhMySqlOwner(void)
 {
 }
 
+FdoSmPhCharacterSetP FdoSmPhMySqlOwner::GetCharacterSet()
+{
+    FdoSmPhCharacterSetP characterSet;
+
+    if ( mCharacterSetName != L"" ) {
+        FdoSmPhDatabase* pDatabase = (FdoSmPhDatabase*)(FdoSmSchemaElement*)GetParent();
+        characterSet = pDatabase->FindCharacterSet( mCharacterSetName );
+    }
+
+    return characterSet;
+}
+
 FdoStringP FdoSmPhMySqlOwner::GetKeyColumnUsageTable()
 {
     if ( mKeyColumnUsageTable == L"" ) {
@@ -73,7 +80,7 @@
         // Create the temporary table from the key_column_usage table.
         // Make all string fields case sensitive
         FdoStringP sqlStmt = FdoStringP::Format( 
-            L"create temporary table %ls.%ls ( "
+            L"create temporary table \"%ls\".\"%ls\" ( "
             L" constraint_schema varchar(64) not null collate utf8_bin,"
             L" constraint_name varchar(64) not null collate utf8_bin,"
             L" table_schema varchar(64) not null collate utf8_bin,"
@@ -93,7 +100,7 @@
 
         // Populate the temporary table from key_column_usage. Just need rows for this owner.
         sqlStmt = FdoStringP::Format( 
-            L"insert into  %ls.%ls ( "
+            L"insert into  \"%ls\".\"%ls\" ( "
             L" constraint_schema,"
             L" constraint_name,"
             L" table_schema,"
@@ -114,7 +121,7 @@
             L" referenced_table_schema,"
             L" referenced_table_name,"
             L" referenced_column_name"
-            L" from information_schema.key_column_usage where table_catalog is null and table_schema = %ls",
+            L" from information_schema.key_column_usage where table_catalog is null and table_schema collate utf8_bin = %ls",
             GetName(),
             (FdoString*) mKeyColumnUsageTable,
             (FdoString*) GetManager()->FormatSQLVal( GetName(), FdoSmPhColType_String )
@@ -143,7 +150,7 @@
         // Create the temporary table from the table_constraints table.
         // Make all string fields case sensitive
         FdoStringP sqlStmt = FdoStringP::Format( 
-            L"create temporary table %ls.%ls ( "
+            L"create temporary table \"%ls\".\"%ls\" ( "
             L" constraint_schema varchar(64) not null collate utf8_bin,"
             L" constraint_name varchar(64) not null collate utf8_bin,"
             L" table_schema varchar(64) not null collate utf8_bin,"
@@ -159,7 +166,7 @@
 
         // Populate the temporary table from table_constraints. Just need rows for this owner.
         sqlStmt = FdoStringP::Format( 
-            L"insert into  %ls.%ls ( "
+            L"insert into  \"%ls\".\"%ls\" ( "
             L" constraint_schema,"
             L" constraint_name,"
             L" table_schema,"
@@ -172,7 +179,7 @@
             L" table_schema,"
             L" table_name,"
             L" constraint_type"
-            L" from information_schema.table_constraints where constraint_catalog is null and table_schema = %ls",
+            L" from information_schema.table_constraints where constraint_catalog is null and table_schema collate utf8_bin = %ls",
             GetName(),
             (FdoString*) mTableConstraintsTable,
             (FdoString*) GetManager()->FormatSQLVal( GetName(), FdoSmPhColType_String )
@@ -203,12 +210,13 @@
         // Create the temporary table from the tables table.
         // Make all string fields case sensitive
         FdoStringP sqlStmt = FdoStringP::Format( 
-            L"create temporary table %ls.%ls ( "
+            L"create temporary table \"%ls\".\"%ls\" ( "
             L" table_schema varchar(64) not null collate utf8_bin,"
             L" table_name varchar(64) not null collate utf8_bin,"
             L" table_type varchar(64) not null collate utf8_bin,"
             L" engine varchar(64) null collate utf8_bin,"
             L" auto_increment bigint null,"
+            L" table_collation varchar(64) null collate utf8_bin,"
             L" primary key ( table_name )"
             L")",
             GetName(),
@@ -219,20 +227,22 @@
 
         // Populate the temporary table from information_schema.tables. Just need rows for this owner.
         sqlStmt = FdoStringP::Format( 
-            L"insert into  %ls.%ls ( "
+            L"insert into  \"%ls\".\"%ls\" ( "
             L" table_schema,"
             L" table_name,"
             L" table_type,"
             L" engine,"
-            L" auto_increment"
+            L" auto_increment,"
+            L" table_collation"
             L")"
             L" select "
             L" table_schema,"
             L" table_name,"
             L" table_type,"
             L" engine,"
-            L" auto_increment"
-            L" from information_schema.tables where table_catalog is null and table_schema = %ls",
+            L" auto_increment,"
+            L" table_collation"
+            L" from information_schema.tables where table_catalog is null and table_schema collate utf8_bin = %ls",
             GetName(),
             (FdoString*) mTablesTable,
             (FdoString*) GetManager()->FormatSQLVal( GetName(), FdoSmPhColType_String )
@@ -266,7 +276,7 @@
         // Create the temporary table from the tables table.
         // Make all string fields case sensitive
         FdoStringP sqlStmt = FdoStringP::Format( 
-            L"create temporary table %ls.%ls ( "
+            L"create temporary table \"%ls\".\"%ls\" ( "
             L" table_schema varchar(64) not null collate utf8_bin,"
             L" table_name varchar(64) not null collate utf8_bin,"
             L" column_name varchar(64) not null collate utf8_bin,"
@@ -278,6 +288,7 @@
             L" numeric_scale bigint null,"
             L" column_type longtext not null,"
             L" extra varchar(20) not null collate utf8_bin,"
+            L" character_set_name varchar(64) null collate utf8_bin,"
             L" primary key ( table_name, ordinal_position )"
             L")",
             GetName(),
@@ -288,7 +299,7 @@
 
         // Populate the temporary table from information_schema.columns. Just need rows for this owner.
         sqlStmt = FdoStringP::Format( 
-            L"insert into  %ls.%ls ( "
+            L"insert into  \"%ls\".\"%ls\" ( "
             L" table_schema,"
             L" table_name,"
             L" column_name,"
@@ -299,7 +310,8 @@
             L" numeric_precision,"
             L" numeric_scale,"
             L" column_type,"
-            L" extra"
+            L" extra,"
+            L" character_set_name"
             L")"
             L" select "
             L" table_schema,"
@@ -312,8 +324,9 @@
             L" numeric_precision,"
             L" numeric_scale,"
             L" column_type,"
-            L" extra"
-            L" from information_schema.columns where table_catalog is null and table_schema = %ls",
+            L" extra,"
+            L" character_set_name"
+            L" from information_schema.columns where table_catalog is null and table_schema collate utf8_bin = %ls",
             GetName(),
             (FdoString*) mColumnsTable,
             (FdoString*) GetManager()->FormatSQLVal( GetName(), FdoSmPhColType_String )
@@ -466,21 +479,46 @@
     FdoSmPhMySqlMgrP mgr = GetManager()->SmartCast<FdoSmPhMySqlMgr>();
     GdbiConnection* gdbiConn = mgr->GetGdbiConnection();
 
-    // TODO: Always latin1 ok for now since data is always utf8.
-    // Need to revisit this issue at some point.
     FdoStringP sqlStmt = FdoStringP::Format(
-        L"create database %ls character set latin1 collate latin1_bin",
+        L"create database %ls",
         (FdoString*) GetDbName()
     );
 
     // Create the owner (datastore)
     gdbiConn->ExecuteNonQuery( (const char*) sqlStmt );
 
+    // Now that owner exists, retrieve its character set name.
+    FdoSmPhDatabase* pDatabase = (FdoSmPhDatabase*)(FdoSmSchemaElement*)GetParent();
+    FdoSmPhRdOwnerReaderP ownerReader = pDatabase->CreateOwnerReader( GetName() );
+    if ( ownerReader->ReadNext() ) {
+        mCharacterSetName = ownerReader->GetString( L"", L"default_character_set_name" );
+    }
+    else {
+        // If owner not found, name may have been converted by lower case by MySQL.
+        ownerReader = pDatabase->CreateOwnerReader( GetManager()->GetDcOwnerName(GetName()) );
+        if ( ownerReader->ReadNext() )
+            mCharacterSetName = ownerReader->GetString( L"", L"default_character_set_name" );
+    }
+
     if ( GetHasMetaSchema() ) {
+        FdoSmPhMySqlCharacterSetP characterSet = GetCharacterSet().p->SmartCast<FdoSmPhMySqlCharacterSet>();
+
         FdoStringsP keywords = FdoStringCollection::Create();
         keywords->Add( rdbi_vndr_name(mgr->GetRdbiContext()) );
         keywords->Add( L"MySQL" );
 
+        // MySql has a 1000 byte limit on index widths.
+        // Some MetaSchema indexes require truncation when the max character size
+        // for the owner's character set is > 1. Pass the character size down to the 
+        // script so that the right amount of truncation can be performed.
+        if ( characterSet && (characterSet->GetCharLen() == 1) ) 
+            keywords->Add( L"Char1Byte" );
+        else if ( characterSet && (characterSet->GetCharLen() == 2) ) 
+            keywords->Add( L"Char2Byte" );
+        else
+            keywords->Add( L"Char3Byte" );
+        // char length is at most 3 bytes for factory character sets.
+
         // Switch to newly created owner and add the MetaSchema
 
         SetCurrent();
@@ -586,7 +624,7 @@
         GdbiConnection* gdbiConn = mgr->GetGdbiConnection();
 
         FdoStringP sqlStmt = FdoStringP::Format( 
-            L"drop temporary table if exists %ls.%ls",
+            L"drop temporary table if exists \"%ls\".\"%ls\"",
             GetName(),
             (FdoString*) tableName
             );

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.h	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Owner.h	2007-01-16 14:41:27 UTC (rev 635)
@@ -41,11 +41,14 @@
         bool hasMetaSchema,
         const FdoSmPhDatabase* pDatabase,
         FdoSchemaElementState elementState = FdoSchemaElementState_Added,
-        FdoSmPhRdDbObjectReader* reader = NULL
+        FdoSmPhRdOwnerReader* reader = NULL
     );
 
     ~FdoSmPhMySqlOwner(void);
 
+    // Gets this owner's default character set.
+    FdoSmPhCharacterSetP GetCharacterSet();
+
     // The following two functions support a performance enhancement. Queries that join two 
     // information_schema tables are slow. The Schema Manager currently runs queries that 
     // join table_constraints and key_column_usage. These functions create temporary indexed
@@ -145,6 +148,8 @@
     // Generate next unique number for temporary table name.
     FdoInt32 NextTempTableNum();
 
+    FdoStringP mCharacterSetName;
+
     FdoStringP mKeyColumnUsageTable;
     FdoStringP mTableConstraintsTable;
     FdoStringP mTablesTable;

Copied: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/CharacterSetReader.cpp (from rev 617, branches/3.2.x/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/CharacterSetReader.cpp)

Copied: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/CharacterSetReader.h (from rev 617, branches/3.2.x/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/CharacterSetReader.h)

Copied: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/CollationReader.cpp (from rev 617, branches/3.2.x/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/CollationReader.cpp)

Copied: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/CollationReader.h (from rev 617, branches/3.2.x/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/CollationReader.h)

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/ColumnReader.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/ColumnReader.cpp	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/ColumnReader.cpp	2007-01-16 14:41:27 UTC (rev 635)
@@ -162,7 +162,8 @@
               L" if(is_nullable='YES',1,0) as nullable,\n"
               L" lower(data_type) as type_string,\n"
               L" instr(column_type,'unsigned') as isunsigned,\n"
-			  L" if(extra='auto_increment',1,0) as is_autoincremented\n"
+			  L" if(extra='auto_increment',1,0) as is_autoincremented,\n"
+              L" character_set_name\n"
               L" from %ls%ls\n"
               L" where table_schema collate utf8_bin = ? \n"
               L" %ls"
@@ -190,6 +191,12 @@
             row->CreateColumnInt64(L"isunsigned",false)
         );
 
+        field = new FdoSmPhField(
+            row, 
+            L"character_set_name",
+            row->CreateColumnDbObject(L"character_set_name",true)
+        );
+
         reader = new FdoSmPhRdGrdQueryReader (row, sql, mgr, MakeBinds (mgr, ownerName, objectName));
 
     }

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/DbObjectReader.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/DbObjectReader.cpp	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/DbObjectReader.cpp	2007-01-16 14:41:27 UTC (rev 635)
@@ -154,7 +154,8 @@
             L"  ist.auto_increment as autoincrement_column_seed, \n"
             L"  ist.engine as storage_engine, \n"
             L"  ' ' as data_directory, \n"
-            L"  ' ' as index_directory \n"
+            L"  ' ' as index_directory, \n"
+            L"  table_collation \n"
             L"  from %ls ist%ls \n"
             L"  where ist.table_schema collate utf8_bin = ?\n"
             L"  %ls\n"
@@ -232,6 +233,7 @@
     pField = new FdoSmPhField(row, L"storage_engine", row->CreateColumnChar(L"storage_engine",true, 64)); // can be NULL (e.g. for views)
     pField = new FdoSmPhField(row, L"data_directory", row->CreateColumnChar(L"data_directory",true, 256));
     pField = new FdoSmPhField(row, L"index_directory", row->CreateColumnChar(L"index_directory",true, 256));
+    pField = new FdoSmPhField(row, L"table_collation", row->CreateColumnDbObject(L"table_collation",true));
 
     return rows;
 }

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/Makefile.am
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/Makefile.am	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/Makefile.am	2007-01-16 14:41:27 UTC (rev 635)
@@ -20,6 +20,8 @@
 noinst_LTLIBRARIES = libFdoRdbmsMySQL_SchemaMgr_Ph_Rd.la
 
 libFdoRdbmsMySQL_SchemaMgr_Ph_Rd_la_SOURCES = \
+  CharacterSetReader.cpp \
+  CollationReader.cpp \
   ColumnReader.cpp \
   ConstraintReader.cpp \
   DbObjectReader.cpp \
@@ -29,6 +31,8 @@
   PkeyReader.cpp
 
 noinst_HEADERS = $(libFdoRdbmsMySQL_SchemaMgr_Ph_Rd_la_SOURCES) \
+  CharacterSetReader.h \
+  CollationReader.h \
   ColumnReader.h \
   ConstraintReader.h \
   DbObjectReader.h \

Modified: trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/OwnerReader.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/OwnerReader.cpp	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/MySQL/SchemaMgr/Ph/Rd/OwnerReader.cpp	2007-01-16 14:41:27 UTC (rev 635)
@@ -67,7 +67,8 @@
 
         sqlString = FdoStringP::Format(
               L"select schema_name as name, \n"
-              L" (select table_name from information_schema.tables T where S.schema_name = T.table_schema and T.table_name = 'F_SCHEMAINFO') as schemas_table\n"
+              L" (select table_name from information_schema.tables T where S.schema_name = T.table_schema and T.table_name = 'F_SCHEMAINFO') as schemas_table,\n"
+              L" default_character_set_name \n"
               L" from information_schema.schemata S\n"
               L" %ls\n"
               L" order by schema_name asc",
@@ -77,6 +78,12 @@
         FdoSmPhRowsP rows = MakeRows( mgr );
         FdoSmPhRowP row = rows->GetItem(0);
 
+        FdoSmPhFieldP field = new FdoSmPhField(
+            row, 
+            L"default_character_set_name",
+            row->CreateColumnInt64(L"default_character_set_name",false)
+        );
+
         reader = new FdoSmPhRdGrdQueryReader(row, sqlString, mgr, MakeBinds(mgr,ownerName) );
 /*
         if ( object_set ) 

Modified: trunk/Providers/GenericRdbms/Src/ODBC/Odbc.vcproj
===================================================================
--- trunk/Providers/GenericRdbms/Src/ODBC/Odbc.vcproj	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/ODBC/Odbc.vcproj	2007-01-16 14:41:27 UTC (rev 635)
@@ -40,6 +40,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				AdditionalOptions="-Zm112"
 				Optimization="0"
 				AdditionalIncludeDirectories=".\;..\LongTransactionManager;..\GenericLongTransactionManager;..\..\inc\fdo;../../inc/rdbi;../;../../;../../inc;../Fdo/Connection;../Fdo/Other;../Fdo/FeatureCommands;../Fdo/Custom;../Fdo/Schema;..\Fdo\Capability;../Fdo/Lt;../Fdo/Lock;..\Fdo\FeatureCommands;../Fdo/SpatialContext;$(FDO)\Unmanaged;$(FDO)\Unmanaged\inc;$(FDOUTILITIES)/SchemaMgr/inc;$(FDOUTILITIES)\Common\inc;../../../Oracle\inc\Fdo\fdo;../../../Oracle;..\Gdbi;..\LockManager"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;ODBC_EXPORTS;FDORDBMS_EXPORTS;_LIB;_CRT_SECURE_NO_DEPRECATE"

Modified: trunk/Providers/GenericRdbms/Src/Rdbi/Rdbi.vcproj
===================================================================
--- trunk/Providers/GenericRdbms/Src/Rdbi/Rdbi.vcproj	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/Rdbi/Rdbi.vcproj	2007-01-16 14:41:27 UTC (rev 635)
@@ -40,6 +40,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				AdditionalOptions="-Zm112"
 				Optimization="0"
 				AdditionalIncludeDirectories="../..;$(FDO)/Unmanaged/inc;$(FDOTHIRDPARTY)/oracle/oci/include"
 				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;_CRT_NON_CONFORMING_SWPRINTFS"

Modified: trunk/Providers/GenericRdbms/Src/SchemaMgr/GrdSchemaMgr.vcproj
===================================================================
--- trunk/Providers/GenericRdbms/Src/SchemaMgr/GrdSchemaMgr.vcproj	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/SchemaMgr/GrdSchemaMgr.vcproj	2007-01-16 14:41:27 UTC (rev 635)
@@ -40,6 +40,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				AdditionalOptions="-Zm110"
 				Optimization="0"
 				AdditionalIncludeDirectories="$(FDO)\Unmanaged\inc;$(FDO)\Unmanaged;$(FDOUTILITIES)\SchemaMgr\inc;..\..;..\..\inc;..\..\inc\fdo;$(FDOUTILITIES)\Common\inc"
 				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FDORDBMS_EXPORTS;_CRT_SECURE_NO_DEPRECATE"
@@ -177,6 +178,7 @@
 			/>
 			<Tool
 				Name="VCCLCompilerTool"
+				AdditionalOptions="-Zm110"
 				Optimization="0"
 				AdditionalIncludeDirectories="..\..\..\Oracle;$(FDO)\Unmanaged\inc;$(FDO)\Unmanaged;$(FDOUTILITIES)\SchemaMgr\inc;..\..;..\..\inc;..\..\inc\fdo;$(FDOUTILITIES)\Common\inc"
 				PreprocessorDefinitions="WIN32;_DEBUG;_LIB;FDORDBMS_EXPORTS;_CRT_SECURE_NO_DEPRECATE"

Modified: trunk/Providers/GenericRdbms/Src/SchemaMgr/Ph/Owner.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/SchemaMgr/Ph/Owner.cpp	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/SchemaMgr/Ph/Owner.cpp	2007-01-16 14:41:27 UTC (rev 635)
@@ -45,9 +45,9 @@
 		mgr->ExecSchemaFile( L"fdo_sys_idx.sql", keywords );
 
         FdoStringP sqlStmt = FdoStringP::Format(
-            L"update f_schemainfo set description = '%ls' where upper(schemaname) = upper('%ls')",
+            L"update f_schemainfo set description = '%ls' where upper(schemaname) = '%ls'",
             GetDescription(),
-            GetName()
+            (FdoString*) FdoStringP(GetName()).Upper()
         );
   
         gdbiConn->ExecuteNonQuery( (const char*) sqlStmt );

Modified: trunk/Providers/GenericRdbms/Src/UnitTest/Common/DataTypeTests.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/Common/DataTypeTests.cpp	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/Common/DataTypeTests.cpp	2007-01-16 14:41:27 UTC (rev 635)
@@ -162,7 +162,8 @@
     void *variable,
     int size,
     double tolerance,
-    bool is_ora_int64_test)
+    bool is_ora_int64_test,
+    int out_rdbi_type)
 {
     int cursor;
     char statement[1024];
@@ -175,6 +176,7 @@
     long null_ind2 = 0;
     int rows;
 	long *variable2 = 0; // NOTE: for geometries, we need null data.
+    int desc_rdbi_type = (out_rdbi_type == -1) ? rdbi_type : out_rdbi_type;
 
     cursor = -1;
     try
@@ -214,7 +216,7 @@
         CPPUNIT_ASSERT_MESSAGE ("rdbi_sql failed", RDBI_SUCCESS == rdbi_sql_Ex (mRdbiContext, cursor, statement));
         CPPUNIT_ASSERT_MESSAGE ("rdbi_desc_slct failed", RDBI_SUCCESS == rdbi_desc_slct_Ex (mRdbiContext, cursor, 1, sizeof (statement), statement, &type, &bytes, &null_ok));
 		CPPUNIT_ASSERT_MESSAGE ("column wrong name", 0 == FdoCommonOSUtil::stricmp ("xyz1", statement));
-        CPPUNIT_ASSERT_MESSAGE ("column wrong type", is_datatype_equal(rdbi_type, type) );
+        CPPUNIT_ASSERT_MESSAGE ("column wrong type", is_datatype_equal(desc_rdbi_type, type) );
         // CPPUNIT_ASSERT_MESSAGE ("column wrong size", rdbi_scale == bytes);
         // CPPUNIT_ASSERT_MESSAGE ("column not nullable", 0 != null_ok);
 
@@ -304,7 +306,8 @@
     void *variable,
     int size,
     double tolerance,
-    bool is_ora_int64_test)
+    bool is_ora_int64_test,
+    int out_rdbi_type)
 {
     int cursor;
     char statement[1024];
@@ -317,6 +320,7 @@
     long null_ind2 = 0;
     int rows;
 	long *variable2 = 0; // NOTE: for geometries, we need null data.
+    int desc_rdbi_type = (out_rdbi_type == -1) ? rdbi_type : out_rdbi_type;
 
     cursor = -1;
     try
@@ -345,7 +349,7 @@
         CPPUNIT_ASSERT_MESSAGE ("rdbi_sql failed", RDBI_SUCCESS == rdbi_sql_Ex (mRdbiContext, cursor, statement));
         CPPUNIT_ASSERT_MESSAGE ("rdbi_desc_slct failed", RDBI_SUCCESS == rdbi_desc_slct_Ex (mRdbiContext, cursor, 1, sizeof (statement), statement, &type, &bytes, &null_ok));
 		CPPUNIT_ASSERT_MESSAGE ("column wrong name", 0 == FdoCommonOSUtil::stricmp ("xyz1", statement));
-        CPPUNIT_ASSERT_MESSAGE ("column wrong type", is_datatype_equal(rdbi_type, type) );
+        CPPUNIT_ASSERT_MESSAGE ("column wrong type", is_datatype_equal(desc_rdbi_type, type) );
         // CPPUNIT_ASSERT_MESSAGE ("column wrong size", rdbi_scale == bytes);
         // CPPUNIT_ASSERT_MESSAGE ("column not nullable", 0 != null_ok);
 

Modified: trunk/Providers/GenericRdbms/Src/UnitTest/Common/DataTypeTests.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/Common/DataTypeTests.h	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/Common/DataTypeTests.h	2007-01-16 14:41:27 UTC (rev 635)
@@ -74,19 +74,21 @@
         char *sql_type,
         int rdbi_type, int rdbi_scale, int rdbi_precision,
         void *variable, int size, double tolerance = 0.0,
-        bool is_ora_int64_test = false);
+        bool is_ora_int64_test = false,
+        int out_rdbi_type = -1);
 
 	   void roundtrip_update (
         char *sql_type,
         int rdbi_type, int rdbi_scale, int rdbi_precision,
         void *variable, int size, double tolerance = 0.0,
-        bool is_ora_int64_test = false);
+        bool is_ora_int64_test = false,
+        int out_rdbi_type = -1);
 
 protected:
     virtual void set_provider() {  CPPUNIT_FAIL ("naked set_provider() called"); };
 	void geometry();
-    void single_char ();
-    void single_character ();
+    virtual void single_char ();
+    virtual void single_character ();
     void dozen_char ();
     void dozen_character ();
     void char_varying ();

Modified: trunk/Providers/GenericRdbms/Src/UnitTest/Common/SelectTests.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/Common/SelectTests.cpp	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/Common/SelectTests.cpp	2007-01-16 14:41:27 UTC (rev 635)
@@ -573,12 +573,12 @@
         CPPUNIT_ASSERT_MESSAGE ("rdbi_desc_slct failed", RDBI_SUCCESS == rdbi_desc_slct_Ex (mRdbiContext, cursor, 1, sizeof (name), name, &type, &size, &null_ok));
         CPPUNIT_ASSERT_MESSAGE ("name wrong name", 0 == FdoCommonOSUtil::stricmp ("name", name));
         CPPUNIT_ASSERT_MESSAGE ("name wrong type", RDBI_STRING == type);
-        CPPUNIT_ASSERT_MESSAGE ("name wrong size", 200 == size);
+        CPPUNIT_ASSERT_MESSAGE ("name wrong size", 200 == (size / get_char_size()));
 
         CPPUNIT_ASSERT_MESSAGE ("rdbi_desc_slct failed", RDBI_SUCCESS == rdbi_desc_slct_Ex (mRdbiContext, cursor, 2, sizeof (name), name, &type, &size, &null_ok));
         CPPUNIT_ASSERT_MESSAGE ("initials wrong name", 0 == FdoCommonOSUtil::stricmp ("initials", name));
-        CPPUNIT_ASSERT_MESSAGE ("initials wrong type", RDBI_CHAR == type);
-        CPPUNIT_ASSERT_MESSAGE ("initials wrong size", get_char_size() == size);
+        CPPUNIT_ASSERT_MESSAGE ("initials wrong type", ((get_char_size() == 1) ? RDBI_CHAR : RDBI_FIXED_CHAR) == type);
+        CPPUNIT_ASSERT_MESSAGE ("initials wrong size", get_single_char_size() == size);
 
         CPPUNIT_ASSERT_MESSAGE ("rdbi_desc_slct failed", RDBI_SUCCESS == rdbi_desc_slct_Ex (mRdbiContext, cursor, 3, sizeof (name), name, &type, &size, &null_ok));
         CPPUNIT_ASSERT_MESSAGE ("grade wrong name", 0 == FdoCommonOSUtil::stricmp ("grade", name));
@@ -590,7 +590,7 @@
         CPPUNIT_ASSERT_MESSAGE ("salutation wrong name", 0 == FdoCommonOSUtil::stricmp ("salutation", name));
 #pragma message ("ToDo: fix MySql so it doesn't alter the coloumn type")
         CPPUNIT_ASSERT_MESSAGE ("salutation wrong type", (RDBI_FIXED_CHAR == type) || (RDBI_STRING == type));
-        CPPUNIT_ASSERT_MESSAGE ("salutation wrong size", 4 == size);
+        CPPUNIT_ASSERT_MESSAGE ("salutation wrong size", 4 == (size/get_char_size()));
 
         CPPUNIT_ASSERT_MESSAGE ("rdbi_desc_slct failed", RDBI_SUCCESS == rdbi_desc_slct_Ex (mRdbiContext, cursor, 5, sizeof (name), name, &type, &size, &null_ok));
         CPPUNIT_ASSERT_MESSAGE ("employee wrong name", 0 == FdoCommonOSUtil::stricmp ("employee", name));

Modified: trunk/Providers/GenericRdbms/Src/UnitTest/Common/SelectTests.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/Common/SelectTests.h	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/Common/SelectTests.h	2007-01-16 14:41:27 UTC (rev 635)
@@ -57,6 +57,7 @@
     virtual void  set_timestamp_nnull ( char *nullind ) { rdbi_set_nnull( mRdbiContext, nullind, 0, 0); }
     virtual bool allow_timestamp_notnull() { return true;};
     virtual int get_char_size() { return 1; };
+    virtual int get_single_char_size() { return get_char_size(); };
 };
 
 #endif // SELECTTESTS_H

Modified: trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDataTypeTests.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDataTypeTests.cpp	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDataTypeTests.cpp	2007-01-16 14:41:27 UTC (rev 635)
@@ -24,6 +24,25 @@
 CPPUNIT_TEST_SUITE_REGISTRATION (MySqlDataTypeTests);
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION (MySqlDataTypeTests, "DataTypeTests");
 
+void MySqlDataTypeTests::single_char ()
+{
+    char ch[2];
+
+    ch[0] = 'K'; ch[1] = '\0'; // Null terminator
+    roundtrip_insert ("CHAR", RDBI_CHAR, 1, 0, &ch, 1, 0.0, false, RDBI_FIXED_CHAR);
+	ch[0] = 'F';
+	roundtrip_update ("CHAR", RDBI_CHAR, 1, 0, &ch, 1, 0.0, false, RDBI_FIXED_CHAR);
+}
+
+void MySqlDataTypeTests::single_character ()
+{
+    char ch[2];
+
+    ch[0] = 'S'; ch[1] = '\0'; // Null terminator
+    roundtrip_insert ("CHARACTER", RDBI_CHAR, 1, 0, &ch, 1, 0.0, false, RDBI_FIXED_CHAR);
+}
+
+
 void MySqlDataTypeTests::set_provider()
 {
 	UnitTestUtil::SetProvider( "MySql" );

Modified: trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDataTypeTests.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDataTypeTests.h	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlDataTypeTests.h	2007-01-16 14:41:27 UTC (rev 635)
@@ -26,6 +26,9 @@
     CPPUNIT_TEST_SUB_SUITE (MySqlDataTypeTests, DataTypeTests);
     CPPUNIT_TEST_SUITE_END ();
 
+    virtual void single_char ();
+    virtual void single_character ();
+
     void set_provider();
     int do_rdbi_init ();
     int do_rdbi_connect (const char* dataStoreName, const char* userName, const char* userPassword);

Modified: trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoUpdateTest.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoUpdateTest.cpp	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoUpdateTest.cpp	2007-01-16 14:41:27 UTC (rev 635)
@@ -183,35 +183,47 @@
     }
 }
 
-const wchar_t* MySqlFdoUpdateTest::mForeignPolygonTest[] = {
-    L"CREATE TABLE foreignpolygon",
-    L"(GEOMETRY POLYGON,",
-    L"ENTITYID INT AUTO_INCREMENT PRIMARY KEY,",
-    L"VERSIONNUMBER SMALLINT,",
-    L"LOCKID TINYINT,",
-    L"FSBLOCKNAME TEXT(255),",
-    L"DESCR TEXT(50),",
-    L"FSCLOSED CHAR(1),",
-    L"FSCOLOR INT,",
-    L"FSENTITYTYPE CHAR(30),",
-    L"FSHYPERLINK DATETIME,",
-    L"FSJUSTIFICATION DECIMAL(5,2),",
-    L"FSLAYER VARCHAR(255),",
-    L"FSLINETYPE TINYTEXT,",
-    L"FSGEOMETRYTYPE SET('1','2','3','4','5','6','7','8','9','10','11','12'),",
-    L"FSLINEWEIGHT DECIMAL(38,8),",
-    L"FSOLYPATCOLOR BIGINT,",
-    L"FSOLYPATTYPE VARCHAR(100),",
-    L"FSPLOTSTYLE MEDIUMTEXT,",
-    L"FSROTATION DECIMAL,",
-    L"FSTEXTCONTENT LONGTEXT,",
-    L"FSTEXTHEIGHT MEDIUMINT,",
-    L"FSTHICKNESS DECIMAL(35),",
-    L"FSWIDTH DOUBLE,",
-    L"FSBLOB MEDIUMBLOB,",
-    L"FSGEOMETRICTYPE ENUM('one', 'two', 'three', 'four'),",
-    L"FSTIME TIME,",
-    L"FSYEAR YEAR,",
+const wchar_t* MySqlFdoUpdateTest::mForeignPolygonTest[] = {
+    L"CREATE TABLE foreignpolygon",
+    L"(GEOMETRY POLYGON,",
+    L"ENTITYID INT AUTO_INCREMENT PRIMARY KEY,",
+    L"VERSIONNUMBER SMALLINT,",
+    L"LOCKID TINYINT,",
+    L"FSBLOCKNAME TEXT(255),",
+    L"DESCR TEXT(50),",
+    L"FSCLOSED CHAR(1),",
+    L"FSCOLOR INT,",
+    L"FSENTITYTYPE CHAR(30),",
+    L"FSHYPERLINK DATETIME,",
+    L"FSJUSTIFICATION DECIMAL(5,2),",
+    L"FSLAYER VARCHAR(255),",
+    L"FSLINETYPE TINYTEXT,",
+    L"FSGEOMETRYTYPE SET('1','2','3','4','5','6','7','8','9','10','11','12'),",
+    L"FSLINEWEIGHT DECIMAL(38,8),",
+    L"FSOLYPATCOLOR BIGINT,",
+    L"FSOLYPATTYPE VARCHAR(100),",
+    L"FSPLOTSTYLE MEDIUMTEXT,",
+    L"FSROTATION DECIMAL,",
+    L"FSTEXTCONTENT LONGTEXT,",
+    L"FSTEXTHEIGHT MEDIUMINT,",
+    L"FSTHICKNESS DECIMAL(35),",
+    L"FSWIDTH DOUBLE,",
+    L"FSBLOB MEDIUMBLOB,",
+    L"FSGEOMETRICTYPE ENUM('one', 'two', 'three', 'four'),",
+    L"FSTIME TIME,",
+    L"FSYEAR YEAR,",
     L"FSDATE DATE) ENGINE=MyISAM;",
     NULL
-};
+};
+
+const char* MySqlFdoUpdateTest::NoMetaSuffix()
+{
+#ifdef _WIN32
+    static const char* noMetaSuffix = "_no_meta\xe4\xe5";
+#else
+    static const char* noMetaSuffix = "_no_meta";
+#endif
+
+    return noMetaSuffix;
+}
+

Modified: trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoUpdateTest.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoUpdateTest.h	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlFdoUpdateTest.h	2007-01-16 14:41:27 UTC (rev 635)
@@ -28,13 +28,14 @@
     CPPUNIT_TEST_SUITE_END ();
 
     void  set_provider();
-	virtual FdoStringP TableIdGeomName() { return L"table id geom"; };
+    virtual FdoStringP TableIdGeomName() {return L"t\xe4ble id geom";}
 
 public:
 	virtual void ConditionalUpdate () { }
     void testForeignDataStore();
 
 protected:
+    virtual const char* NoMetaSuffix();
 	static const wchar_t* mForeignPolygonTest[];
 };
 

Modified: trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaMgrTests.cpp
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaMgrTests.cpp	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaMgrTests.cpp	2007-01-16 14:41:27 UTC (rev 635)
@@ -22,6 +22,8 @@
 #include "ConnectionUtil.h"
 #include "MySqlConnectionUtil.h"
 #include "../MySQL/SchemaMgr/Ph/Table.h"
+#include "../MySQL/SchemaMgr/Ph/Owner.h"
+#include "../MySQL/SchemaMgr/Ph/CharacterSet.h"
 
 CPPUNIT_TEST_SUITE_REGISTRATION( MySqlSchemaMgrTests );
 CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( MySqlSchemaMgrTests, "SchemaMgrTests");
@@ -104,6 +106,9 @@
         );
         owner->SetPassword( L"test" );
 
+        owner->Commit();
+        FdoInt32 charLen = (FdoInt32)(owner->SmartCast<FdoSmPhMySqlOwner>()->GetCharacterSet()->SmartCast<FdoSmPhMySqlCharacterSet>()->GetCharLen());
+
         // Table1 tests various column types and constraints 
         // with various numbers and sizes of columns.
         // Primary Keys, indexes and unique constraints are tested.
@@ -193,6 +198,8 @@
         table->AddUkeyCol( table->GetUkeyColumns()->GetCount() - 1, L"STRING700_1" );
         table->AddUkeyCol( table->GetUkeyColumns()->GetCount() - 1, L"STRING300_1" );
 
+        table->Commit();
+
         // Three large, two small
         ukeyColumns = new FdoSmPhColumnCollection();
 	    table->GetUkeyColumns()->Add( ukeyColumns );
@@ -250,14 +257,20 @@
 
         FdoStringP pkeyClause = table->GetAddPkeySql();
 
+        FdoStringP expectedClause = FdoStringP::Format(
+            L"constraint \"pk_table1\" primary key ( \"ID\", \"BLOB_COLUMN\"(%d), \"STRING_COLUMN\", \"SINGLE_COLUMN\", \"DOUBLE_COLUMN\", \"DECIMAL_COLUMN\", \"BOOL_COLUMN\", \"BYTE_COLUMN\", \"INT16_COLUMN\", \"INT32_COLUMN\", \"INT64_COLUMN\", \"DATE_COLUMN\", \"BINARY_COLUMN\", \"VARBINARY_COLUMN\", \"DATE2_COLUMN\", \"TIMESTAMP_COLUMN\" )",
+            ( 680 - (charLen * 50))
+        );
+
         // Verify that blob column got truncated to expected amount
         // (1000 - total size of other columns).
-        CPPUNIT_ASSERT( pkeyClause == L"constraint \"pk_table1\" primary key ( \"ID\", \"BLOB_COLUMN\"(630), \"STRING_COLUMN\", \"SINGLE_COLUMN\", \"DOUBLE_COLUMN\", \"DECIMAL_COLUMN\", \"BOOL_COLUMN\", \"BYTE_COLUMN\", \"INT16_COLUMN\", \"INT32_COLUMN\", \"INT64_COLUMN\", \"DATE_COLUMN\", \"BINARY_COLUMN\", \"VARBINARY_COLUMN\", \"DATE2_COLUMN\", \"TIMESTAMP_COLUMN\" )" );
+        CPPUNIT_ASSERT( pkeyClause ==  expectedClause );
 
         FdoStringP ukeyClause = table->GetAddUkeysSql();
 
         // Verify that all unique key columns got truncate to expected amounts.
-        CPPUNIT_ASSERT( ukeyClause == L"UNIQUE (\"AUTOINCREMENT_COLUMN\"), UNIQUE (\"STRING100000\"(760), \"STRING100_1\"), UNIQUE (\"STRING2000\"(350), \"STRING700_1\"(350), \"STRING300_1\"(300)), UNIQUE (\"STRING100000\"(266), \"STRING2000\"(266), \"STRING700_1\"(266), \"STRING100_3\", \"STRING100_4\"), UNIQUE (\"STRING2000\"(64), \"STRING300_1\"(64), \"STRING300_2\"(64), \"STRING300_3\"(64), \"STRING300_4\"(64), \"STRING300_5\"(64), \"STRING300_6\"(64), \"STRING300_7\"(64), \"STRING300_8\"(64), \"STRING300_9\"(64), \"STRING300_10\"(64), \"STRING100_1\"(64), \"STRING100_2\"(64), \"STRING100_3\"(64), \"STRING100_4\"(64), \"STRING40_1\"), UNIQUE (\"STRING100_3\", \"STRING100_4\"), UNIQUE (\"STRING40_3\", \"STRING40_4\")" );
+        if ( charLen == 1 ) 
+            CPPUNIT_ASSERT( ukeyClause == L"UNIQUE (\"AUTOINCREMENT_COLUMN\"), UNIQUE (\"STRING100000\"(760), \"STRING100_1\"), UNIQUE (\"STRING2000\"(350), \"STRING700_1\"(350), \"STRING300_1\"(300)), UNIQUE (\"STRING100000\"(266), \"STRING2000\"(266), \"STRING700_1\"(266), \"STRING100_3\", \"STRING100_4\"), UNIQUE (\"STRING2000\"(64), \"STRING300_1\"(64), \"STRING300_2\"(64), \"STRING300_3\"(64), \"STRING300_4\"(64), \"STRING300_5\"(64), \"STRING300_6\"(64), \"STRING300_7\"(64), \"STRING300_8\"(64), \"STRING300_9\"(64), \"STRING300_10\"(64), \"STRING100_1\"(64), \"STRING100_2\"(64), \"STRING100_3\"(64), \"STRING100_4\"(64), \"STRING40_1\"), UNIQUE (\"STRING100_3\", \"STRING100_4\"), UNIQUE (\"STRING40_3\", \"STRING40_4\")" );
 
         // Table 2 tests a case where 3 constraint columns are 
         // over initial truncation limit, 2 are over the next limit
@@ -272,9 +285,10 @@
         table->AddPkeyCol( column->GetName() );
 
         pkeyClause = table->GetAddPkeySql();
-        
-        CPPUNIT_ASSERT( pkeyClause == L"constraint \"pk_table2\" primary key ( \"STRING2000\"(500), \"STRING400\"(400), \"STRING100\" )" );
 
+        if ( charLen == 1 ) 
+            CPPUNIT_ASSERT( pkeyClause == L"constraint \"pk_table2\" primary key ( \"STRING2000\"(500), \"STRING400\"(400), \"STRING100\" )" );
+
         // Calculating the size of MySql decimal columns is 
         // complicated. Table3 tests creating constraints
         // with decimal columns of various sizes
@@ -309,97 +323,199 @@
         table->AddPkeyCol( column->GetName() );
 
         pkeyClause = table->GetAddPkeySql();
+    
+        if ( charLen == 1 ) 
+            CPPUNIT_ASSERT( pkeyClause == L"constraint \"pk_table3\" primary key ( \"STRING1\"(440), \"STRING2\"(440), \"DECIMAL1\", \"DECIMAL2\", \"DECIMAL3\", \"DECIMAL4\", \"DECIMAL5\", \"DECIMAL6\", \"DECIMAL7\", \"DECIMAL8\" )" );
         
-        CPPUNIT_ASSERT( pkeyClause == L"constraint \"pk_table3\" primary key ( \"STRING1\"(440), \"STRING2\"(440), \"DECIMAL1\", \"DECIMAL2\", \"DECIMAL3\", \"DECIMAL4\", \"DECIMAL5\", \"DECIMAL6\", \"DECIMAL7\", \"DECIMAL8\" )" );
-        
         database->Commit();
 
-        // Test column truncation by inserting some data values.
-        wchar_t prefix500[500];
-        wchar_t prefix400[400];
-        wchar_t prefix100[100];
+        if ( charLen == 1 ) {
+            // Test column truncation by inserting some data values.
+            wchar_t prefix500[500];
+            wchar_t prefix400[400];
+            wchar_t prefix100[100];
 
-        // Fill in every character except the last 
-        // non-truncated one for each constraint column.
-        for ( ix = 0; ix < 499; ix++ ) 
-            prefix500[ix] = 'a';
-        for ( ix = 0; ix < 399; ix++ ) 
-            prefix400[ix] = 'a';
-        for ( ix = 0; ix < 99; ix++ ) 
-            prefix100[ix] = 'a';
+            // Fill in every character except the last 
+            // non-truncated one for each constraint column.
+            for ( ix = 0; ix < 499; ix++ ) 
+                prefix500[ix] = 'a';
+            for ( ix = 0; ix < 399; ix++ ) 
+                prefix400[ix] = 'a';
+            for ( ix = 0; ix < 99; ix++ ) 
+                prefix100[ix] = 'a';
 
-        prefix500[499] = 0;
-        prefix400[399] = 0;
-        prefix100[99] = 0;
+            prefix500[499] = 0;
+            prefix400[399] = 0;
+            prefix100[99] = 0;
 
-        GdbiConnection* gdbiConn = phMgr->GetGdbiConnection();
+            GdbiConnection* gdbiConn = phMgr->GetGdbiConnection();
 
-        // Insert first object 
-        gdbiConn->ExecuteNonQuery(
-            (FdoString*) FdoStringP::Format( 
-                L"insert into table2 ( STRING2000, STRING400, STRING100 ) values ( '%ls', '%ls', '%ls' )",
-                (FdoString*) (FdoStringP(prefix500) + L"a"),
-                (FdoString*) (FdoStringP(prefix400) + L"a"),
-                (FdoString*) (FdoStringP(prefix100) + L"a")
-            )
-        );
+            // Insert first object 
+            gdbiConn->ExecuteNonQuery(
+                (FdoString*) FdoStringP::Format( 
+                    L"insert into table2 ( STRING2000, STRING400, STRING100 ) values ( '%ls', '%ls', '%ls' )",
+                    (FdoString*) (FdoStringP(prefix500) + L"a"),
+                    (FdoString*) (FdoStringP(prefix400) + L"a"),
+                    (FdoString*) (FdoStringP(prefix100) + L"a")
+                )
+            );
 
-        // Insert three more objects. In each case the truncated
-        // key column values are identical exception for the 
-        // last character of one of the columns.
-        gdbiConn->ExecuteNonQuery(
-            (FdoString*) FdoStringP::Format( 
-                L"insert into table2 ( STRING2000, STRING400, STRING100 ) values ( '%ls', '%ls', '%ls' )",
-                (FdoString*) (FdoStringP(prefix500) + L"b"),
-                (FdoString*) (FdoStringP(prefix400) + L"a"),
-                (FdoString*) (FdoStringP(prefix100) + L"a")
-            )
-        );
+            // Insert three more objects. In each case the truncated
+            // key column values are identical exception for the 
+            // last character of one of the columns.
+            gdbiConn->ExecuteNonQuery(
+                (FdoString*) FdoStringP::Format( 
+                    L"insert into table2 ( STRING2000, STRING400, STRING100 ) values ( '%ls', '%ls', '%ls' )",
+                    (FdoString*) (FdoStringP(prefix500) + L"b"),
+                    (FdoString*) (FdoStringP(prefix400) + L"a"),
+                    (FdoString*) (FdoStringP(prefix100) + L"a")
+                )
+            );
 
-        gdbiConn->ExecuteNonQuery(
-            (FdoString*) FdoStringP::Format( 
-                L"insert into table2 ( STRING2000, STRING400, STRING100 ) values ( '%ls', '%ls', '%ls' )",
-                (FdoString*) (FdoStringP(prefix500) + L"a"),
-                (FdoString*) (FdoStringP(prefix400) + L"b"),
-                (FdoString*) (FdoStringP(prefix100) + L"a")
-            )
-        );
+            gdbiConn->ExecuteNonQuery(
+                (FdoString*) FdoStringP::Format( 
+                    L"insert into table2 ( STRING2000, STRING400, STRING100 ) values ( '%ls', '%ls', '%ls' )",
+                    (FdoString*) (FdoStringP(prefix500) + L"a"),
+                    (FdoString*) (FdoStringP(prefix400) + L"b"),
+                    (FdoString*) (FdoStringP(prefix100) + L"a")
+                )
+            );
 
-        gdbiConn->ExecuteNonQuery(
-            (FdoString*) FdoStringP::Format( 
-                L"insert into table2 ( STRING2000, STRING400, STRING100 ) values ( '%ls', '%ls', '%ls' )",
-                (FdoString*) (FdoStringP(prefix500) + L"a"),
-                (FdoString*) (FdoStringP(prefix400) + L"a"),
-                (FdoString*) (FdoStringP(prefix100) + L"b")
-            )
-        );
-
-        bool duplicate = true;
-
-        try {
-            // try inserting a duplicate. The key column values are not duplicate
-            // but the truncated values are.
             gdbiConn->ExecuteNonQuery(
                 (FdoString*) FdoStringP::Format( 
                     L"insert into table2 ( STRING2000, STRING400, STRING100 ) values ( '%ls', '%ls', '%ls' )",
-                    (FdoString*) (FdoStringP(prefix500) + L"ab"),
-                    (FdoString*) (FdoStringP(prefix400) + L"ab"),
-                    (FdoString*) (FdoStringP(prefix100) + L"ab")
+                    (FdoString*) (FdoStringP(prefix500) + L"a"),
+                    (FdoString*) (FdoStringP(prefix400) + L"a"),
+                    (FdoString*) (FdoStringP(prefix100) + L"b")
                 )
             );
+
+            bool duplicate = true;
+
+            try {
+                // try inserting a duplicate. The key column values are not duplicate
+                // but the truncated values are.
+                gdbiConn->ExecuteNonQuery(
+                    (FdoString*) FdoStringP::Format( 
+                        L"insert into table2 ( STRING2000, STRING400, STRING100 ) values ( '%ls', '%ls', '%ls' )",
+                        (FdoString*) (FdoStringP(prefix500) + L"ab"),
+                        (FdoString*) (FdoStringP(prefix400) + L"ab"),
+                        (FdoString*) (FdoStringP(prefix100) + L"ab")
+                    )
+                );
+            }
+            catch ( FdoException* exc ) 
+            {
+                exc->Release();
+                duplicate = false;
+            }
+            catch ( ... ) 
+            {
+                duplicate = false;
+            }
+
+            CPPUNIT_ASSERT( !duplicate );
         }
+
+        conn->disconnect();
+
+        delete conn;
+
+        if ( charLen != 1 ) 
+            CPPUNIT_FAIL ("Test appears to be Ok; However database character set is not Latin1 so truncation validation was skipped");
+
+        printf( "Done\n" );
+    }
+    catch (FdoException* e ) 
+    {
+        UnitTestUtil::FailOnException(e);
+    }
+    catch (CppUnit::Exception exception)
+    {
+        throw exception;
+    }
+    catch (...)
+    {
+        CPPUNIT_FAIL ("unexpected exception encountered");
+    }
+}
+
+// Tests character set and collation retrieval
+void MySqlSchemaMgrTests::testCharacterSets ()
+{
+    StaticConnection* conn = CreateStaticConnection();
+    FdoInt32 idx;
+
+    try
+    {
+        char prvenv[100];
+        FdoStringP providerName = conn->GetServiceName();
+        sprintf( prvenv, "provider=%ls", (FdoString*) providerName );
+#ifdef _WIN32
+        _putenv( prvenv );
+#else
+        putenv( prvenv );
+#endif
+
+        // Sets the other env.
+        UnitTestUtil::SetProvider( conn->GetServiceName() ); 
+
+        printf( "\nOpening Connection ...\n" );
+
+        conn->connect();
+
+        FdoSchemaManagerP mgr = conn->CreateSchemaManager();
+
+        FdoSmPhGrdMgrP phMgr = mgr->GetPhysicalSchema()->SmartCast<FdoSmPhGrdMgr>();
+
+        FdoSmPhDatabaseP database = phMgr->GetDatabase();
+
+        for ( idx = 0; idx < 1; idx++ ) {
+            FdoSmPhCharacterSetP charSet = database->FindCharacterSet( L"latin1" );
+            CPPUNIT_ASSERT( charSet != NULL );
+            FdoSmPhMySqlCharacterSetP mySqlCharSet = charSet->SmartCast<FdoSmPhMySqlCharacterSet>();
+            CPPUNIT_ASSERT( mySqlCharSet->GetCharLen() == 1 );
+
+            charSet = database->GetCharacterSet( L"utf8" );
+            mySqlCharSet = charSet->SmartCast<FdoSmPhMySqlCharacterSet>();
+            CPPUNIT_ASSERT( mySqlCharSet->GetCharLen() == 3 );
+
+            FdoSmPhCollationP collation = database->FindCollation( L"latin1_bin" );
+            CPPUNIT_ASSERT( collation != NULL );
+            charSet = collation->GetCharacterSet();
+            CPPUNIT_ASSERT( wcscmp(charSet->GetName(), L"latin1") == 0 );
+
+            collation = database->GetCollation( L"utf8_bin" );
+            charSet = collation->GetCharacterSet();
+            CPPUNIT_ASSERT( wcscmp(charSet->GetName(), L"utf8") == 0 );
+        }
+
+
+        CPPUNIT_ASSERT( database->FindCharacterSet(L"noexist") == NULL );
+        CPPUNIT_ASSERT( database->FindCollation(L"noexist") == NULL );
+
+        bool succeeded = true;
+        try {
+            FdoSmPhCharacterSetP charSet = database->GetCharacterSet( L"noexist" );
+        }
         catch ( FdoException* exc ) 
         {
             exc->Release();
-            duplicate = false;
+            succeeded = false;
         }
-        catch ( ... ) 
+        CPPUNIT_ASSERT( !succeeded );
+
+        succeeded = true;
+        try {
+            FdoSmPhCollationP collation = database->GetCollation( L"noexist" );
+        }
+        catch ( FdoException* exc ) 
         {
-            duplicate = false;
+            exc->Release();
+            succeeded = false;
         }
+        CPPUNIT_ASSERT( !succeeded );
 
-        CPPUNIT_ASSERT( !duplicate );
-
         conn->disconnect();
 
         delete conn;

Modified: trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaMgrTests.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaMgrTests.h	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSchemaMgrTests.h	2007-01-16 14:41:27 UTC (rev 635)
@@ -25,9 +25,11 @@
 {
     CPPUNIT_TEST_SUB_SUITE (MySqlSchemaMgrTests, SchemaMgrTests);
     CPPUNIT_TEST (testWideConstraint);
+    CPPUNIT_TEST (testCharacterSets);
     CPPUNIT_TEST_SUITE_END ();
 
     void testWideConstraint();
+    void testCharacterSets();
     
 	virtual StaticConnection* CreateStaticConnection();
     virtual FdoIoStream* OverrideBend( FdoIoStream* stream1, FdoStringP oldOwnerPrefix, FdoStringP newOwnerPrefix );

Modified: trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSelectTests.h
===================================================================
--- trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSelectTests.h	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/Src/UnitTest/MySql/MySqlSelectTests.h	2007-01-16 14:41:27 UTC (rev 635)
@@ -32,6 +32,7 @@
     int do_rdbi_connect (const char* dataStoreName, const char* userName, const char* userPassword);
     virtual char *get_date_time (const struct tm *when);
     char *get_bind_var (int n){ return ("?"); }
+    virtual int get_char_size() { return 3; };
 };
 
 #endif // MYSQL_SELECTTESTS_H

Modified: trunk/Providers/GenericRdbms/com/fdo_sys_idx.sql
===================================================================
--- trunk/Providers/GenericRdbms/com/fdo_sys_idx.sql	2007-01-15 22:55:29 UTC (rev 634)
+++ trunk/Providers/GenericRdbms/com/fdo_sys_idx.sql	2007-01-16 14:41:27 UTC (rev 635)
@@ -95,7 +95,15 @@
 #endif
 ;
 
+#ifdef MySQL
+#ifdef Char3Byte
+create unique index f_classdef_schnm_idx on f_classdefinition(classname(150), schemaname(150))
+#else
 create unique index f_classdef_schnm_idx on f_classdefinition(classname, schemaname)
+#endif
+#else
+create unique index f_classdef_schnm_idx on f_classdefinition(classname, schemaname)
+#endif
 #ifdef Oracle
     pctfree 5
     storage (initial     4K
@@ -139,7 +147,19 @@
 #endif
 ;
              
+#ifdef MySQL
+#ifdef Char1Byte
 create unique index f_sad_pk_idx on f_sad(ownername, elementname, elementtype, name) 
+#endif
+#ifdef Char2Byte
+create unique index f_sad_pk_idx on f_sad(ownername(150), elementname(150), elementtype, name(150)) 
+#endif
+#ifdef Char3Byte
+create unique index f_sad_pk_idx on f_sad(ownername(100), elementname(100), elementtype, name(100)) 
+#endif
+#else
+create unique index f_sad_pk_idx on f_sad(ownername, elementname, elementtype, name) 
+#endif
 #ifdef Oracle           
     pctfree 5
     storage (initial     4K
@@ -150,7 +170,19 @@
 #endif
 ;
 
+#ifdef MySQL
+#ifdef Char1Byte
 create unique index f_schemaoptions_pk_idx on f_schemaoptions(ownername, elementname, elementtype, name) 
+#endif
+#ifdef Char2Byte
+create unique index f_schemaoptions_pk_idx on f_schemaoptions(ownername(150), elementname(150), elementtype, name(150)) 
+#endif
+#ifdef Char3Byte
+create unique index f_schemaoptions_pk_idx on f_schemaoptions(ownername(100), elementname(100), elementtype, name(100)) 
+#endif
+#else
+create unique index f_schemaoptions_pk_idx on f_schemaoptions(ownername, elementname, elementtype, name) 
+#endif
 #ifdef Oracle           
     pctfree 5
     storage (initial     4K



More information about the fdo-commits mailing list