コード例 #1
0
 /**
  * Returns a string representing the SQL query corresonding to the specified Query object.
  * @param object QueryInterface $query The object from which to generate the SQL string.
  * @return mixed Either a string (this would be the case, normally) or an array of strings. 
  * Each string is corresponding to an SQL query.
  * @static
  * @access public
  */
 static function generateSQLQuery(Query $query)
 {
     switch ($query->getType()) {
         case INSERT:
             $result = MySQL_SQLGenerator::generateInsertSQLQuery($query);
             break;
         case UPDATE:
             $result = MySQL_SQLGenerator::generateUpdateSQLQuery($query);
             break;
         case DELETE:
             $result = MySQL_SQLGenerator::generateDeleteSQLQuery($query);
             break;
         case SELECT:
             $result = MySQL_SQLGenerator::generateSelectSQLQuery($query);
             break;
         case GENERIC:
             $result = MySQL_SQLGenerator::generateGenericSQLQuery($query);
             break;
         default:
             throw new DatabaseException("Unsupported query type.");
     }
     // switch
     //		echo "<pre>\n";
     //		echo $result;
     //		echo "</pre>\n";
     return $result;
 }
コード例 #2
0
 /**
  * Returns a string representing the SQL query corresonding to the specified Query object.
  * @param object QueryInterface $query The object from which to generate the SQL string.
  * @return mixed Either a string (this would be the case, normally) or an array of strings. 
  * Each string is corresponding to an SQL query.
  * @static
  * @access public
  */
 static function generateSQLQuery(Query $query)
 {
     switch ($query->getType()) {
         case INSERT:
             return PostgreSQL_SQLGenerator::generateInsertSQLQuery($query);
             break;
         case UPDATE:
             return PostgreSQL_SQLGenerator::generateUpdateSQLQuery($query);
             break;
         case DELETE:
             return PostgreSQL_SQLGenerator::generateDeleteSQLQuery($query);
             break;
         case SELECT:
             return PostgreSQL_SQLGenerator::generateSelectSQLQuery($query);
             break;
         case GENERIC:
             return MySQL_SQLGenerator::generateGenericSQLQuery($query);
             break;
         default:
             throw new DatabaseException("Unsupported query type.");
     }
     // switch
 }