phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] phpgwapi inc/class.schema_proc.inc.php inc/clas...


From: Sigurd Nes
Subject: [Phpgroupware-cvs] phpgwapi inc/class.schema_proc.inc.php inc/clas...
Date: Sat, 22 Apr 2006 18:41:49 +0000

CVSROOT:        /sources/phpgwapi
Module name:    phpgwapi
Branch:         
Changes by:     Sigurd Nes <address@hidden>     06/04/22 18:41:49

Modified files:
        inc            : class.schema_proc.inc.php 
                         class.schema_proc_mysql.inc.php 
        setup          : tables_current.inc.php 

Log message:
        handling of collate for creating columns in tables (custom character 
set)

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/phpgwapi/inc/class.schema_proc.inc.php.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/phpgwapi/inc/class.schema_proc_mysql.inc.php.diff?tr1=1.12&tr2=1.13&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/phpgwapi/phpgwapi/setup/tables_current.inc.php.diff?tr1=1.60&tr2=1.61&r1=text&r2=text

Patches:
Index: phpgwapi/inc/class.schema_proc.inc.php
diff -u phpgwapi/inc/class.schema_proc.inc.php:1.12 
phpgwapi/inc/class.schema_proc.inc.php:1.13
--- phpgwapi/inc/class.schema_proc.inc.php:1.12 Thu Apr 28 18:20:15 2005
+++ phpgwapi/inc/class.schema_proc.inc.php      Sat Apr 22 18:41:49 2006
@@ -8,7 +8,7 @@
        * @license http://www.fsf.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage database
-       * @version $Id: class.schema_proc.inc.php,v 1.12 2005/04/28 18:20:15 
fipsfuchs Exp $
+       * @version $Id: class.schema_proc.inc.php,v 1.13 2006/04/22 18:41:49 
sigurdne Exp $
        */
 
        /**
@@ -434,6 +434,7 @@
                        $iScale = 0;
                        $sDefault = '';
                        $bNullable = true;
+                       $sCollate = '';
 
                        reset($aField);
                        while(list($sAttr, $vAttrVal) = each($aField))
@@ -456,13 +457,16 @@
                                        case 'nullable':
                                                $bNullable = $vAttrVal;
                                                break;
+                                       case 'collate':
+                                               $sCollate = $vAttrVal;
+                                               break;
                                }
                        }
 
                        // Translate the type for the DBMS
                        $sBufNullable = '';
                        $sBufDefault = '';
-                       if($sFieldSQL = 
$this->m_oTranslator->TranslateType($sType, $iPrecision, $iScale))
+                       if($sFieldSQL = 
$this->m_oTranslator->TranslateType($sType, $iPrecision, $iScale, $sCollate))
                        {
                                if($bNullable == False)
                                {
Index: phpgwapi/inc/class.schema_proc_mysql.inc.php
diff -u phpgwapi/inc/class.schema_proc_mysql.inc.php:1.12 
phpgwapi/inc/class.schema_proc_mysql.inc.php:1.13
--- phpgwapi/inc/class.schema_proc_mysql.inc.php:1.12   Mon Mar 13 14:25:06 2006
+++ phpgwapi/inc/class.schema_proc_mysql.inc.php        Sat Apr 22 18:41:49 2006
@@ -8,7 +8,7 @@
        * @license http://www.fsf.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage database
-       * @version $Id: class.schema_proc_mysql.inc.php,v 1.12 2006/03/13 
14:25:06 sigurdne Exp $
+       * @version $Id: class.schema_proc_mysql.inc.php,v 1.13 2006/04/22 
18:41:49 sigurdne Exp $
        */
  
        /**
@@ -30,44 +30,45 @@
                function schema_proc_mysql()
                {
                        $this->m_sStatementTerminator = ';';
-                       /* The use of a temp_db is to allow this process to be 
run from other than setup*/
-                       $temp_db = CreateObject('phpgwapi.db');
-                       if($GLOBALS['phpgw_info']['server']['db_name'])
-                       {
-                               $temp_db->Host = 
$GLOBALS['phpgw_info']['server']['db_host'];
-                               $temp_db->Type = 
$GLOBALS['phpgw_info']['server']['db_type'];
-                               $temp_db->Database = 
$GLOBALS['phpgw_info']['server']['db_name'];
-                               $temp_db->User = 
$GLOBALS['phpgw_info']['server']['db_user'];
-                               $temp_db->Password = 
$GLOBALS['phpgw_info']['server']['db_pass'];
-                       }
-                       else
-                       {
-                               $ConfigDomain = 
get_var('ConfigDomain',array('COOKIE','POST'));
-                               $phpgw_domain = $GLOBALS['phpgw_domain'];
-       
-                               $temp_db->Host     = 
$phpgw_domain[$ConfigDomain]['db_host'];
-                               $temp_db->Database = 
$phpgw_domain[$ConfigDomain]['db_name'];
-                               $temp_db->User     = 
$phpgw_domain[$ConfigDomain]['db_user'];
-                               $temp_db->Password = 
$phpgw_domain[$ConfigDomain]['db_pass'];
-                       }
-
-                       $temp_db->query("SELECT version() as 
version",__LINE__,__FILE__);
-                       $temp_db->next_record();
-                       $version = $temp_db->f('version');
-                       $parts   = explode('.',$version);
-                       if($parts[0] == 5 || ($parts[0] == 4 && $parts[1] == 1))
-                       {
-                               $this->now_statement =  "now()";                
                
-                       }
-                       else
-                       {
-                               $this->now_statement =  "'now()'";              
                
-                       }
-
+                       /* The use of a temp_db is to allow this process to be 
run from other than setup*/
+
+                       $temp_db = CreateObject('phpgwapi.db');
+
+                       if($GLOBALS['phpgw_info']['server']['db_name'])
+                       {
+                               $temp_db->Host = 
$GLOBALS['phpgw_info']['server']['db_host'];
+                               $temp_db->Type = 
$GLOBALS['phpgw_info']['server']['db_type'];
+                               $temp_db->Database = 
$GLOBALS['phpgw_info']['server']['db_name'];
+                               $temp_db->User = 
$GLOBALS['phpgw_info']['server']['db_user'];
+                               $temp_db->Password = 
$GLOBALS['phpgw_info']['server']['db_pass'];
+                       }
+                       else
+                       {
+                               $ConfigDomain = 
get_var('ConfigDomain',array('COOKIE','POST'));
+                               $phpgw_domain = $GLOBALS['phpgw_domain'];       
+
+                               $temp_db->Host     = 
$phpgw_domain[$ConfigDomain]['db_host'];
+                               $temp_db->Database = 
$phpgw_domain[$ConfigDomain]['db_name'];
+                               $temp_db->User     = 
$phpgw_domain[$ConfigDomain]['db_user'];
+                               $temp_db->Password = 
$phpgw_domain[$ConfigDomain]['db_pass'];
+                       }
+
+                       $temp_db->query("SELECT version() as 
version",__LINE__,__FILE__);
+                       $temp_db->next_record();
+                       $version = $temp_db->f('version');
+                       $parts   = explode('.',$version);
+                       if($parts[0] == 5 || ($parts[0] == 4 && $parts[1] == 1))
+                       {
+                               $this->now_statement =  "now()";                
                
+                       }
+                       else
+                       {
+                               $this->now_statement =  "'now()'";              
                
+                       }
                }
 
                /* Return a type suitable for DDL */
-               function TranslateType($sType, $iPrecision = 0, $iScale = 0)
+               function TranslateType($sType, $iPrecision = 0, $iScale = 0, 
$sCollate = '')
                {
                        $sTranslated = '';
                        switch($sType)
@@ -139,6 +140,14 @@
                                        }
                                        break;
                        }
+
+                       switch($sCollate)
+                       {
+                               case 'latin1':
+                                       $sTranslated .= ' CHARACTER SET latin1 
COLLATE latin1_general_ci';
+                                       break;
+                       }
+
                        return $sTranslated;
                }
 
@@ -148,7 +157,8 @@
                        {
                                case 'current_date':
                                case 'current_timestamp':
-                                       return $this->now_statement;
+                                       return $this->now_statement;
+
                        }
                        return "'" . $sDefault . "'";
                }
Index: phpgwapi/setup/tables_current.inc.php
diff -u phpgwapi/setup/tables_current.inc.php:1.60 
phpgwapi/setup/tables_current.inc.php:1.61
--- phpgwapi/setup/tables_current.inc.php:1.60  Thu Mar 30 01:11:27 2006
+++ phpgwapi/setup/tables_current.inc.php       Sat Apr 22 18:41:49 2006
@@ -5,7 +5,7 @@
        * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
        * @package phpgwapi
        * @subpackage setup
-       * @version $Id: tables_current.inc.php,v 1.60 2006/03/30 01:11:27 
skwashd Exp $
+       * @version $Id: tables_current.inc.php,v 1.61 2006/04/22 18:41:49 
sigurdne Exp $
        * @internal $Source: 
/sources/phpgwapi/phpgwapi/setup/tables_current.inc.php,v $
        */
 
@@ -163,9 +163,9 @@
                ),
                'phpgw_lang' => array(
                        'fd' => array(
-                               'message_id' => array('type' => 
'varchar','precision' => '255','nullable' => False,'default' => ''),
-                               'app_name' => array('type' => 
'varchar','precision' => '100','nullable' => False,'default' => 'common'),
-                               'lang' => array('type' => 'varchar','precision' 
=> '5','nullable' => False,'default' => ''),
+                               'message_id' => array('type' => 
'varchar','precision' => '255','nullable' => False,'default' => '','collate' => 
'latin1'),
+                               'app_name' => array('type' => 
'varchar','precision' => '100','nullable' => False,'default' => 
'common','collate' => 'latin1'),
+                               'lang' => array('type' => 'varchar','precision' 
=> '5','nullable' => False,'default' => '','collate' => 'latin1'),
                                'content' => array('type' => 'text')
                        ),
                        'pk' => array('message_id','app_name','lang'),




reply via email to

[Prev in Thread] Current Thread [Next in Thread]