mysqlimodule.java

来自「RESIN 3.2 最新源码」· Java 代码 · 共 1,441 行 · 第 1/3 页

JAVA
1,441
字号
   * Indicates if one or more result sets are available from   * a previous call to mysqli_multi_query.   */  public static boolean mysqli_more_results(@NotNull Mysqli conn)  {    if (conn == null)      return false;    return conn.more_results();  }  /**   * Prepares next result set from a previous call to   * mysqli_multi_query.   */  public static boolean mysqli_next_result(@NotNull Mysqli conn)  {    if (conn == null)      return false;    return conn.next_result();  }  /**   * Returns the error code for the prepared statement.   */  public static int mysqli_stmt_errno(Env env,                                      @NotNull MysqliStatement stmt)  {    if (stmt == null)      return 0;    return stmt.errno();  }  /**   * Returns the error message for the prepared statement.   */  public static StringValue mysqli_stmt_error(Env env,                                              @NotNull MysqliStatement stmt)  {    if (stmt == null)      return env.getEmptyString();    return stmt.error(env);  }  /**   * Returns the most recent error.   */  public static Value mysqli_error(Env env,                                    @NotNull Mysqli conn)  {    if (conn == null)      return NullValue.NULL;    return conn.error(env);  }  /**   * Returns the number of columns for the most recent query.   */  public static int mysqli_field_count(@NotNull Mysqli conn)  {    if (conn == null)      return 0;    return conn.field_count();  }  /**   * Returns a row for the result.   */  @ReturnNullAsFalse  public static ArrayValue mysqli_fetch_array(Env env,                                              @NotNull MysqliResult result,                                              @Optional("MYSQLI_BOTH") int type)  {    if (result == null)      return null;    return result.fetch_array(env, type);  }  /**   * Returns an associative array from the result.   */  @ReturnNullAsFalse  public static ArrayValue mysqli_fetch_assoc(Env env,                                              @NotNull MysqliResult result)  {    if (result == null)      return null;    return result.fetch_assoc(env);  }  /**   * Returns a row for the result. Return NULL if there are no more rows.   */  public static ArrayValue mysqli_fetch_row(Env env,                                            @NotNull MysqliResult result)  {    if (result == null)      return null;    return result.fetch_row(env);  }  /**   * Returns an object with properties that correspond   * to the fetched row and moves the data pointer ahead.   *   * @param env the PHP executing environment   * @param result the mysqli_result   * @return an object that corresponds to the fetched   * row or NULL if there are no more rows in resultset   */  public static Value mysqli_fetch_object(Env env,                                          @NotNull MysqliResult result)  {    if (result == null)      return NullValue.NULL;    return result.fetch_object(env);  }  /**   * Returns the MySQL client version.   */  public static StringValue mysqli_get_client_info(Env env)  {    return Mysqli.getClientInfo(env);  }  /**   * Returns a number that represents the MySQL client library   * version in format:   *   * main_version*10000 + minor_version*100 + sub_version.   *   * For example 4.1.0 is returned as 40100.   */   public static int mysqli_get_client_version(Env env)   {     return Mysqli.infoToVersion(       mysqli_get_client_info(env).toString());   }  /**   * Returns a string describing the type of MySQL   * connection in use.   */  public static Value mysqli_get_host_info(Env env, @NotNull Mysqli conn)  {    if (conn == null)      return NullValue.NULL;    return conn.get_host_info(env);  }  /**   * Return protocol number, for example 10.   */  public static Value mysqli_get_proto_info(@NotNull Mysqli conn)  {    if (conn == null)      return NullValue.NULL;    return LongValue.create(conn.get_proto_info());  }  /**   * Returns the MySQL server version.   */  public static Value mysqli_get_server_info(Env env, @NotNull Mysqli conn)  {    if (conn == null)      return NullValue.NULL;    if (conn.isConnected())      return conn.get_server_info(env);    else      return NullValue.NULL;  }  /**   * Returns a number that represents the MySQL server version.   */  public static Value mysqli_get_server_version(@NotNull Mysqli conn)  {    if (conn == null)      return NullValue.NULL;    return LongValue.create(conn.get_server_version());  }  /**   * Returns the number of rows in the result set.   *   * @param env the PHP executing environment   * @param result the mysqli_result   * @return the number of rows in the result set   * or NULL, if an error occurred   */  public static Value mysqli_num_rows(Env env,                                      @NotNull MysqliResult result)  {    if (result == null)      return NullValue.NULL;    return result.num_rows();  }  /**   * Sets the options for a connection.   */  public static boolean mysqli_options(@NotNull Mysqli mysqli,                                       int option,                                       Value value)  {    if (mysqli == null)      return false;    return mysqli.options(option, value);  }  /**   * Alias of {@link #mysqli_options}.   */  public static boolean mysqli_set_opt(@NotNull Mysqli mysqli,                                       int option,                                       Value value)  {    return mysqli_options(mysqli, option, value);  }  /**   * Alias of {@link #mysqli_stmt_param_count}.   */  public static int mysqli_param_count(Env env,                                       @NotNull MysqliStatement stmt)  {    return mysqli_stmt_param_count(env, stmt);  }  /**   * Rolls back the current transaction for the  * connection.   *   * @return true on success or false on failure.   */  public static boolean mysqli_rollback(@NotNull Mysqli conn)  {    if (conn == null)      return false;    return conn.rollback();  }  /**   * Sets the character set for a conneciton.   */  public static boolean mysqli_set_charset(@NotNull Mysqli mysqli,             String charset)  {    if (mysqli == null)      return false;    return mysqli.set_charset(charset);  }  /**   * Returns the number of rows.   */  public static Value mysqli_stmt_num_rows(Env env,                                           @NotNull MysqliStatement stmt)  {    if (stmt == null)      return BooleanValue.FALSE;    return stmt.num_rows(env);  }  /**   * Returns an integer representing the number of parameters   * or -1 if no query has been prepared.   */  public static int mysqli_stmt_param_count(Env env,                                            @NotNull MysqliStatement stmt)  {    if (stmt == null)      return -1;    return stmt.param_count(env);  }  /**   * Prepares a statment with a query.   */  public static boolean mysqli_stmt_prepare(Env env,                                            @NotNull MysqliStatement stmt,                                            StringValue query)  {    if (stmt == null)      return false;    return stmt.prepare(env, query);  }  /**   * Resets a statment.   */  public static boolean mysqli_stmt_reset(Env env,                                          @NotNull MysqliStatement stmt)  {    if (stmt == null)      return false;    return stmt.reset(env);  }  /**   * Returns result information for metadata   */  @ReturnNullAsFalse  public static JdbcResultResource    mysqli_stmt_result_metadata(Env env,                                @NotNull MysqliStatement stmt)  {    if (stmt == null)      return null;    return stmt.result_metadata(env);  }  /**   * Returns an error string.   */  public static Value mysqli_sqlstate(Env env,                                      @NotNull Mysqli conn)  {    if (conn == null)      return NullValue.NULL;    return conn.sqlstate(env);  }  /**   * Returns an error string.   */  public static Value mysqli_stmt_sqlstate(Env env,                                           @NotNull MysqliStatement stmt)  {    if (stmt == null)      return NullValue.NULL;    return stmt.sqlstate(env);  }  /**   * Saves the result.   */  public static boolean mysqli_stmt_store_result(Env env,                                                 @NotNull MysqliStatement stmt)  {    if (stmt == null)      return false;    return stmt.store_result(env);  }  /**   * Transfers the result set from the last query on the   * database connection represented by conn.   *   * Used in conjunction with {@link #mysqli_multi_query}   */  @ReturnNullAsFalse  public static JdbcResultResource mysqli_store_result(Env env,                                                       @NotNull Mysqli conn)  {    if (conn == null)      return null;    return conn.store_result(env);  }  /**   * Initiate a result set retrieval. This method is useful when   * dealing with multiple results from a multi-query. Currently,   * unbuffered results are not supported so this method always   * uses buffered results.   */  @ReturnNullAsFalse  public static JdbcResultResource mysqli_use_result(Env env,                                                     @NotNull Mysqli conn)  {    if (conn == null)      return null;    return conn.use_result(env);  }  /**   * Returns the number of warnings from the last query   * in the connection object.   *   * @return number of warnings   */  public static int mysqli_warning_count(Env env,                                         @NotNull Mysqli conn)  {    if (conn == null)      return 0;    return conn.warning_count(env);  }  /**   * Checks if the connection is still valid   */  public static boolean mysqli_ping(Env env,                                    @NotNull Mysqli conn)  {    if (conn == null)      return false;    return conn.ping(env);  }  /**   * Executes a query and returns the result.   *   */  public static Value mysqli_query(Env env,                                   @NotNull Mysqli conn,                                   StringValue sql,                                   @Optional("MYSQLI_STORE_RESULT") int resultMode)  {    // ERRATUM: <i>resultMode</i> is ignored, MYSQLI_USE_RESULT would represent    //  an unbuffered query, but that is not supported.    Value value = query(env, conn, sql);    if (value == null) {      return BooleanValue.FALSE;    }    return value;  }  private static Value query(Env env,                             Mysqli conn,                             StringValue sql)  {    Value value = null;    try {      value = conn.query(env, sql, MYSQLI_STORE_RESULT);    } catch (Exception e) {      log.log(Level.FINE, e.toString(), e);    }    if (value == null) {      return BooleanValue.FALSE;    }    return value;  }  /**   * Connects to the database.   */  public static boolean mysqli_real_connect(Env env,                                            @NotNull Mysqli mysqli,                                            @Optional("localhost") StringValue host,                                            @Optional StringValue userName,                                            @Optional StringValue password,

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?