diff options
author | David M <davidmj@users.sourceforge.net> | 2006-04-24 22:13:52 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2006-04-24 22:13:52 +0000 |
commit | a279978718c6d21523b5603fde6cf67a91d5ca8c (patch) | |
tree | 1a0e1925c57fca440ed8d6ab6decb2cdcef8c067 /phpBB/includes/acp/acp_profile.php | |
parent | b622c0f31a67b76aa6c97ba5ccad9ae221c0c033 (diff) | |
download | forums-a279978718c6d21523b5603fde6cf67a91d5ca8c.tar forums-a279978718c6d21523b5603fde6cf67a91d5ca8c.tar.gz forums-a279978718c6d21523b5603fde6cf67a91d5ca8c.tar.bz2 forums-a279978718c6d21523b5603fde6cf67a91d5ca8c.tar.xz forums-a279978718c6d21523b5603fde6cf67a91d5ca8c.zip |
- Tuples? Nah,
- Install works w/ Oracle
- Got the queries in the database acp to conform to the CS
- profile acp now creates the proper alter column statement depending on the dbal
git-svn-id: file:///svn/phpbb/trunk@5842 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/acp/acp_profile.php')
-rw-r--r-- | phpBB/includes/acp/acp_profile.php | 222 |
1 files changed, 200 insertions, 22 deletions
diff --git a/phpBB/includes/acp/acp_profile.php b/phpBB/includes/acp/acp_profile.php index db9b78b1fc..16b51f681d 100644 --- a/phpBB/includes/acp/acp_profile.php +++ b/phpBB/includes/acp/acp_profile.php @@ -959,39 +959,217 @@ class acp_profile if ($action == 'create') { - /** - * @todo Adjust for every database - */ + switch (SQL_LAYER) + { + case 'mysql': + case 'mysql4': + case 'mysqli': - // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. - $sql = 'ALTER TABLE ' . PROFILE_DATA_TABLE . " ADD $field_ident "; + // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. + $sql = 'ALTER TABLE ' . PROFILE_DATA_TABLE . " ADD $field_ident "; + switch ($field_type) + { + case FIELD_STRING: + $sql .= ' VARCHAR(255) '; + break; + + case FIELD_DATE: + $sql .= 'VARCHAR(10) '; + break; + + case FIELD_TEXT: + $sql .= "TEXT"; + // ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL, + // ADD {$field_ident}_bbcode_bitfield INT(11) UNSIGNED"; + break; + + case FIELD_BOOL: + $sql .= 'TINYINT(2) '; + break; + + case FIELD_DROPDOWN: + $sql .= 'MEDIUMINT(8) '; + break; + + case FIELD_INT: + $sql .= 'BIGINT(20) '; + break; + } - switch ($field_type) - { - case FIELD_STRING: - $sql .= ' VARCHAR(255) '; break; - case FIELD_DATE: - $sql .= 'VARCHAR(10) '; + case 'sqlite': + + // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. + $sql = 'ALTER TABLE ' . PROFILE_DATA_TABLE . " ADD $field_ident "; + + switch ($field_type) + { + case FIELD_STRING: + $sql .= ' VARCHAR(255) '; + break; + + case FIELD_DATE: + $sql .= 'VARCHAR(10) '; + break; + + case FIELD_TEXT: + $sql .= "TEXT(65535)"; + // ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL, + // ADD {$field_ident}_bbcode_bitfield INT(11) UNSIGNED"; + break; + + case FIELD_BOOL: + $sql .= 'TINYINT(2) '; + break; + + case FIELD_DROPDOWN: + $sql .= 'MEDIUMINT(8) '; + break; + + case FIELD_INT: + $sql .= 'BIGINT(20) '; + break; + } + break; - case FIELD_TEXT: - $sql .= "TEXT"; -// ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL, -// ADD {$field_ident}_bbcode_bitfield INT(11) UNSIGNED"; + case 'mssql': + case 'mssql_odbc': + + // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. + $sql = 'ALTER TABLE [' . PROFILE_DATA_TABLE . "] ADD $field_ident "; + + switch ($field_type) + { + case FIELD_STRING: + $sql .= ' [VARCHAR] (255) '; + break; + + case FIELD_DATE: + $sql .= '[VARCHAR] (10) '; + break; + + case FIELD_TEXT: + $sql .= "[TEXT]"; + // ADD {$field_ident}_bbcode_uid [VARCHAR] (5) NOT NULL, + // ADD {$field_ident}_bbcode_bitfield [INT] UNSIGNED"; + break; + + case FIELD_BOOL: + case FIELD_DROPDOWN: + $sql .= '[INT] '; + break; + + case FIELD_INT: + $sql .= '[FLOAT] '; + break; + } + break; - case FIELD_BOOL: - $sql .= 'TINYINT(2) '; + case 'postgres': + + // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. + $sql = 'ALTER TABLE ' . PROFILE_DATA_TABLE . " ADD COLUMN $field_ident "; + + switch ($field_type) + { + case FIELD_STRING: + $sql .= ' VARCHAR(255) '; + break; + + case FIELD_DATE: + $sql .= 'VARCHAR(10) '; + break; + + case FIELD_TEXT: + $sql .= "TEXT"; + // ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL, + // ADD {$field_ident}_bbcode_bitfield INT4 UNSIGNED"; + break; + + case FIELD_BOOL: + $sql .= 'INT2 '; + break; + + case FIELD_DROPDOWN: + $sql .= 'INT4 '; + break; + + case FIELD_INT: + $sql .= 'INT8 '; + break; + } + break; - - case FIELD_DROPDOWN: - $sql .= 'MEDIUMINT(8) '; + + case 'firebird': + + // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. + $sql = 'ALTER TABLE ' . PROFILE_DATA_TABLE . " ADD $field_ident "; + + switch ($field_type) + { + case FIELD_STRING: + $sql .= ' VARCHAR(255) '; + break; + + case FIELD_DATE: + $sql .= 'VARCHAR(10) '; + break; + + case FIELD_TEXT: + $sql .= "BLOB SUB_TYPE TEXT"; + // ADD {$field_ident}_bbcode_uid VARCHAR(5) NOT NULL, + // ADD {$field_ident}_bbcode_bitfield INTEGER UNSIGNED"; + break; + + case FIELD_BOOL: + case FIELD_DROPDOWN: + $sql .= 'INTEGER '; + break; + + case FIELD_INT: + $sql .= 'DOUBLE PRECISION '; + break; + } + break; - case FIELD_INT: - $sql .= 'BIGINT(20) '; + case 'oracle': + + // We are defining the biggest common value, because of the possibility to edit the min/max values of each field. + $sql = 'ALTER TABLE ' . PROFILE_DATA_TABLE . " ADD $field_ident "; + switch ($field_type) + { + case FIELD_STRING: + $sql .= ' VARCHAR2(255) '; + break; + + case FIELD_DATE: + $sql .= 'VARCHAR2(10) '; + break; + + case FIELD_TEXT: + $sql .= "CLOB"; + // ADD {$field_ident}_bbcode_uid VARCHAR2(5) NOT NULL, + // ADD {$field_ident}_bbcode_bitfield NUMBER(11) UNSIGNED"; + break; + + case FIELD_BOOL: + $sql .= 'NUMBER(2) '; + break; + + case FIELD_DROPDOWN: + $sql .= 'NUMBER(8) '; + break; + + case FIELD_INT: + $sql .= 'NUMBER(20) '; + break; + } + break; } |