phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] [18544] clean up code a little and drop support for m


From: Dave Hall
Subject: [Phpgroupware-cvs] [18544] clean up code a little and drop support for mysql < 4.1
Date: Mon, 26 May 2008 14:32:36 +0000

Revision: 18544
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=phpgroupware&revision=18544
Author:   skwashd
Date:     2008-05-26 14:32:35 +0000 (Mon, 26 May 2008)

Log Message:
-----------
clean up code a little and drop support for mysql < 4.1

Modified Paths:
--------------
    trunk/phpgwapi/inc/class.schema_proc_mysql.inc.php

Modified: trunk/phpgwapi/inc/class.schema_proc_mysql.inc.php
===================================================================
--- trunk/phpgwapi/inc/class.schema_proc_mysql.inc.php  2008-05-26 14:32:02 UTC 
(rev 18543)
+++ trunk/phpgwapi/inc/class.schema_proc_mysql.inc.php  2008-05-26 14:32:35 UTC 
(rev 18544)
@@ -17,7 +17,7 @@
        * @package phpgwapi
        * @subpackage database
        */
-       class schema_proc_mysql
+       class phpgwapi_schema_proc_mysql
        {
                var $m_sStatementTerminator;
                /* Following added to convert sql to array */
@@ -27,7 +27,7 @@
                var $ix = array();
                var $uc = array();
 
-               function schema_proc_mysql()
+               function __construct()
                {
                        $this->m_sStatementTerminator = ';';
                        /* The use of a temp_db is to allow this process to be 
run from other than setup*/
@@ -52,19 +52,6 @@
                                $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 */
@@ -150,7 +137,7 @@
                        {
                                case 'current_date':
                                case 'current_timestamp':
-                                       return $this->now_statement;
+                                       return 'now()';
 
                        }
                        return "'" . $sDefault . "'";
@@ -253,22 +240,22 @@
                        }
                }
 
-                          // foreign key supports needs MySQL 3.23.44 and up 
with InnoDB or MySQL 5.1
-                          // or other versions the syntax is parsed in table 
create commands
-                          // see chapter 1.8.4.5
+               // foreign key supports needs MySQL 3.23.44 and up with InnoDB 
or MySQL 5.1
+               // or other versions the syntax is parsed in table create 
commands
+               // see chapter 1.8.4.5
 
                function GetFKSQL($reftable, $sFields)
-                          {
+               {
                        if(is_array($sFields))
-                                {
+                       {
                                $ret = "FOREIGN KEY 
(".implode(',',array_keys($sFields)).")\n" .
                                        "  REFERENCES 
$reftable(".implode(',',array_values($sFields)).")";
-                                  return $ret;
+                               return $ret;
                        }
                        else
                        {
-                                  return ""; // incorrect FK declaration found
-                          }
+                               return ""; // incorrect FK declaration found
+                       }
                }
 
 






reply via email to

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