コード例 #1
0
 public function initializeContext($injector)
 {
     $this->context = new haxe_remoting_Context();
     if (null == $this->apiContexts) {
         throw new HException('null iterable');
     }
     $__hx__it = $this->apiContexts->iterator();
     while ($__hx__it->hasNext()) {
         unset($apiContextClass);
         $apiContextClass = $__hx__it->next();
         $apiContext = $injector->_instantiate($apiContextClass);
         $_g = 0;
         $_g1 = Reflect::fields($apiContext);
         while ($_g < $_g1->length) {
             $fieldName = $_g1[$_g];
             ++$_g;
             $api = Reflect::field($apiContext, $fieldName);
             if (Reflect::isObject($api)) {
                 $this->context->addObject($fieldName, $api, false);
             }
             unset($fieldName, $api);
         }
         unset($_g1, $_g);
         unset($apiContext);
     }
     if (null == $this->apis) {
         throw new HException('null iterable');
     }
     $__hx__it = $this->apis->iterator();
     while ($__hx__it->hasNext()) {
         unset($apiClass);
         $apiClass = $__hx__it->next();
         $className = Type::getClassName($apiClass);
         $api1 = $injector->_instantiate($apiClass);
         $this->context->addObject($className, $api1, false);
         unset($className, $api1);
     }
 }
コード例 #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;
 }