? sites/default/files ? sites/default/settings.php Index: includes/database/mysql/schema.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database/mysql/schema.inc,v retrieving revision 1.1 diff -u -p -r1.1 schema.inc --- includes/database/mysql/schema.inc 21 Aug 2008 19:36:36 -0000 1.1 +++ includes/database/mysql/schema.inc 25 Aug 2008 16:38:00 -0000 @@ -131,6 +131,10 @@ class DatabaseSchema_mysql extends Datab return $field; } + /** + * This maps a generic data type in combination with its data size + * to the engine-specific data type. + */ public function getFieldTypeMap() { // Put :normal last so it gets preserved by array_flip. This makes // it much easier for modules (such as schema.module) to map @@ -139,6 +143,14 @@ class DatabaseSchema_mysql extends Datab 'varchar:normal' => 'VARCHAR', 'char:normal' => 'CHAR', + // Based on maximum cross database compatibility concern, some rules + // for using Drupal text type: + // - Always assume text:big storage capacity as maximum 4000 characters + // only. + // - Text type should function with the following SQL command: + // "ORDER BY", "GROUP BY", "SELECT ... DISTINCT" and + // "SELECT ... UNIQUE". + // - For storage capacity greater than 4000, use blob instead. 'text:tiny' => 'TINYTEXT', 'text:small' => 'TINYTEXT', 'text:medium' => 'MEDIUMTEXT', @@ -165,6 +177,14 @@ class DatabaseSchema_mysql extends Datab 'numeric:normal' => 'DECIMAL', + // Based on maximum cross database compatibility concern, some rules + // for using Drupal blob type: + // - Usually support GB-scale storage capacity. + // - Blob type should NOT function with the following SQL command: + // "ORDER BY", "GROUP BY", "SELECT ... DISTINCT" and + // "SELECT ... UNIQUE". + // - Always utilize drupal_write_record(), db_insert() and db_update() + // for blob operation. 'blob:big' => 'LONGBLOB', 'blob:normal' => 'BLOB', Index: includes/database/pgsql/schema.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/database/pgsql/schema.inc,v retrieving revision 1.1 diff -u -p -r1.1 schema.inc --- includes/database/pgsql/schema.inc 21 Aug 2008 19:36:36 -0000 1.1 +++ includes/database/pgsql/schema.inc 25 Aug 2008 16:38:00 -0000 @@ -131,50 +131,65 @@ class DatabaseSchema_pgsql extends Datab return $field; } - /** * This maps a generic data type in combination with its data size * to the engine-specific data type. */ - function getFieldTypeMap() { + public function getFieldTypeMap() { // Put :normal last so it gets preserved by array_flip. This makes // it much easier for modules (such as schema.module) to map // database types back into schema types. - $map = array( - 'varchar:normal' => 'varchar', - 'char:normal' => 'character', - - 'text:tiny' => 'text', - 'text:small' => 'text', - 'text:medium' => 'text', - 'text:big' => 'text', - 'text:normal' => 'text', - - 'int:tiny' => 'smallint', - 'int:small' => 'smallint', - 'int:medium' => 'int', - 'int:big' => 'bigint', - 'int:normal' => 'int', - - 'float:tiny' => 'real', - 'float:small' => 'real', - 'float:medium' => 'real', - 'float:big' => 'double precision', - 'float:normal' => 'real', - - 'numeric:normal' => 'numeric', - - 'blob:big' => 'bytea', - 'blob:normal' => 'bytea', - - 'datetime:normal' => 'timestamp', - - 'serial:tiny' => 'serial', - 'serial:small' => 'serial', - 'serial:medium' => 'serial', - 'serial:big' => 'bigserial', - 'serial:normal' => 'serial', - ); + static $map = array( + 'varchar:normal' => 'VARCHAR', + 'char:normal' => 'CHARACTER', + + // Based on maximum cross database compatibility concern, some rules + // for using Drupal text type: + // - Always assume text:big storage capacity as maximum 4000 characters + // only. + // - Text type should function with the following SQL command: + // "ORDER BY", "GROUP BY", "SELECT ... DISTINCT" and + // "SELECT ... UNIQUE". + // - For storage capacity greater than 4000, use blob instead. + 'text:tiny' => 'TEXT', + 'text:small' => 'TEXT', + 'text:medium' => 'TEXT', + 'text:big' => 'TEXT', + 'text:normal' => 'TEXT', + + 'serial:tiny' => 'SERIAL', + 'serial:small' => 'SERIAL', + 'serial:medium' => 'SERIAL', + 'serial:big' => 'BIGSERIAL', + 'serial:normal' => 'SERIAL', + + 'int:tiny' => 'SMALLINT', + 'int:small' => 'SMALLINT', + 'int:medium' => 'INT', + 'int:big' => 'BIGINT', + 'int:normal' => 'INT', + + 'float:tiny' => 'REAL', + 'float:small' => 'REAL', + 'float:medium' => 'REAL', + 'float:big' => 'DOUBLE PRECISION', + 'float:normal' => 'REAL', + + 'numeric:normal' => 'NUMERIC', + + // Based on maximum cross database compatibility concern, some rules + // for using Drupal blob type: + // - Usually support GB-scale storage capacity. + // - Blob type should NOT function with the following SQL command: + // "ORDER BY", "GROUP BY", "SELECT ... DISTINCT" and + // "SELECT ... UNIQUE". + // - Always utilize drupal_write_record(), db_insert() and db_update() + // for blob operation. + 'blob:big' => 'BYTEA', + 'blob:normal' => 'BYTEA', + + 'datetime:normal' => 'TIMESTAMP', + ); return $map; }