예제 #1
0
 public function __construct($e, $sql = null)
 {
     if (!php_Boot::$skip_constructor) {
         parent::__construct(null, _hx_anonymous(array("fileName" => "Error.hx", "lineNumber" => 78, "className" => "system.base.BadSQLException", "methodName" => "new")));
         $strings = null;
         $strings = _hx_string_call($e, "split", array(";"));
         haxe_Log::trace(system_base_Sql_colour::pretify($sql), _hx_anonymous(array("fileName" => "Error.hx", "lineNumber" => 81, "className" => "system.base.BadSQLException", "methodName" => "new")));
         haxe_Log::trace(system_base_Sql_colour::pretify($strings[0]), _hx_anonymous(array("fileName" => "Error.hx", "lineNumber" => 82, "className" => "system.base.BadSQLException", "methodName" => "new")));
         system_base_Error::wipe("SQL said: " . _hx_string_or_null($strings[1]));
     }
 }
예제 #2
0
 static function parse_query($sql_cmd, $args = null, $explain = null)
 {
     $i = null;
     $usr_sql = null;
     $strings = null;
     $strings = _hx_explode("?", $sql_cmd);
     $usr_sql = "";
     if (system_base_Database::$cnx === null) {
         throw new HException(new system_base_Dbexception());
     }
     if ($args !== null) {
         if ($strings->length - 1 !== $args->length) {
             throw new HException("Number of SQL arguments supplied must match the number of placeholders");
         }
         $_g1 = 0;
         $_g = $args->length;
         while ($_g1 < $_g) {
             $i1 = $_g1++;
             if (Reflect::isObject($args[$i1])) {
                 $usr_sql .= _hx_string_or_null($strings[$i1]) . "\"" . _hx_string_or_null(system_base_Database::$cnx->escape($args[$i1])) . "\"";
             } else {
                 $usr_sql .= _hx_string_or_null($strings[$i1]) . _hx_string_or_null($args[$i1]);
             }
             unset($i1);
         }
         if ($strings->length > 0) {
             $usr_sql .= _hx_string_or_null($strings[$strings->length - 1]);
         }
     } else {
         $usr_sql = $sql_cmd;
     }
     if ($explain) {
         system_base_Sql_colour::pretify($usr_sql);
     }
     return $usr_sql;
 }