Changeset 601 for trunk

Show
Ignore:
Timestamp:
09/09/07 13:03:35 (15 months ago)
Author:
michiel
Message:

move db_quote function to common class because we are going to need it in more places

Location:
trunk/common
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/common/mvblog_admin.php

    r584 r601  
    211211                session_destroy(); 
    212212                header("Location: index.php"); 
    213         } 
    214         /* }}} */ 
    215         /* db_quote {{{ */ 
    216         /** 
    217          * Quote a fieldname with the database specific quote style 
    218          * 
    219          * @param string fieldname to quote 
    220          * @return string the quoted version 
    221          */ 
    222         public function db_quote($field) { 
    223                 /* get the db type */ 
    224                 $dbtype = $this->db->dbsyntax; 
    225                 switch ($dbtype) { 
    226                         case "mysql" : 
    227                                 $return = "`".$field."`"; 
    228                                 break; 
    229                         case "pgsql" : 
    230                                 $return = "\"".$field."\""; 
    231                                 break; 
    232                         default : 
    233                                 $return = $field; 
    234                                 break; 
    235                 } 
    236                 return $return; 
    237213        } 
    238214        /* }}} */ 
  • trunk/common/mvblog_common.php

    r592 r601  
    362362                } 
    363363                return $_data; 
     364        } 
     365        /* }}} */ 
     366        /* db_quote {{{ */ 
     367        /** 
     368         * Quote a fieldname with the database specific quote style 
     369         * 
     370         * @param string fieldname to quote 
     371         * @return string the quoted version 
     372         */ 
     373        public function db_quote($field) { 
     374                /* get the db type */ 
     375                $dbtype = $this->db->dbsyntax; 
     376                switch ($dbtype) { 
     377                        case "mysql" : 
     378                                $return = "`".$field."`"; 
     379                                break; 
     380                        case "pgsql" : 
     381                                $return = "\"".$field."\""; 
     382                                break; 
     383                        default : 
     384                                $return = $field; 
     385                                break; 
     386                } 
     387                return $return; 
    364388        } 
    365389        /* }}} */