Example #1
0
 protected function formatValue(Database_Query $oQuery, $sColumn, $mValue)
 {
     $aTableInfo = $oQuery->tableInfo();
     if (empty($aTableInfo[$sColumn])) {
         throw new Lithium_Exception_Database('database.missing_column_info', $sColumn);
     }
     switch (strtolower($aTableInfo[$sColumn])) {
         case 'int':
         case 'integer':
             return $this->formatValueInt($mValue);
             break;
         case 'text':
         case 'varchar':
             return $this->formatValueVarchar($mValue);
         case 'decimal':
             return $this->formatValueDecimal($mValue);
         case 'date':
             return $this->formatValueVarchar($mValue);
         default:
             throw new Lithium_Exception_Database('database.model_unknown_column_type', $aTableInfo[$sColumn]);
     }
 }