Example #1
0
 /**
  * Build SQL command
  * 
  * @param Database_Query $oQuery
  * @return string
  */
 public function buildSqlCommand(Database_Query $oQuery)
 {
     $sSql = '';
     switch ($oQuery->getType()) {
         case Database_Query::T_SELECT:
             $sSql = $this->buildSqlSelect($oQuery);
             break;
         case Database_Query::T_INSERT:
             $sSql = $this->buildSqlInsert($oQuery);
             break;
         case Database_Query::T_UPDATE:
             $sSql = $this->buildSqlUpdate($oQuery);
             break;
         case Database_Query::T_DELETE:
             $sSql = $this->buildSqlDelete($oQuery);
             break;
         case Database_Query::T_CALL:
             $sSql = $this->buildSqlCall($oQuery);
             break;
         case Database_Query::T_CUSTOM:
             $sSql = $this->buildSqlCustomQuery($oQuery);
             break;
         default:
             throw new Lithium_Exception('database.uknown_sql_command_type');
     }
     return $sSql;
 }