Module
Module documentation.
modulenet.mysql
Classes
Classes and inheritance.
classnet.mysql::QueryResult
@brief`QueryResult` type.
@details`QueryResult` encapsulates state and operations exported by the system module. It commonly stores runtime handles, protocol state, buffers, configuration, or collection data. Its methods define the primary behavior for the type. If the type owns external resources, prefer `dispose` or `close` for deterministic release.
class QueryResult {
/*
@brief `is_result_set` field.classnet.mysql::MultiResult
@brief`MultiResult` type.
@details`MultiResult` encapsulates state and operations exported by the system module. It commonly stores runtime handles, protocol state, buffers, configuration, or collection data. Its methods define the primary behavior for the type. If the type owns external resources, prefer `dispose` or `close` for deterministic release.
class MultiResult {
/*
@brief `results` field.classnet.mysql::Pool
@brief`Pool` type.
@details`Pool` encapsulates state and operations exported by the system module. It commonly stores runtime handles, protocol state, buffers, configuration, or collection data. Its methods define the primary behavior for the type. If the type owns external resources, prefer `dispose` or `close` for deterministic release.
class Pool {
/*
@brief `cfg` field.classnet.mysql::Conn
@brief`Conn` type.
@details`Conn` encapsulates state and operations exported by the system module. It commonly stores runtime handles, protocol state, buffers, configuration, or collection data. Its methods define the primary behavior for the type. If the type owns external resources, prefer `dispose` or `close` for deterministic release.
class Conn {
/*
@brief `fd` field.Functions
Free functions and class methods.
functionnet.mysql::QueryResult.init
Signature
func init(self: net.mysql.QueryResult) -> Void func init(self: net.mysql.QueryResult) -> Void {
self.is_result_set = false;
self.ok = new protocol.mysql.OkPacket();@briefInitializes a `QueryResult` instance.
@detailsEstablishes the initial field state for `QueryResult` so other methods can be called safely. Constructor logic should keep fields consistent and avoid leaking partially initialized resources.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionnet.mysql::QueryResult.error_code
Signature
func error_code(self: net.mysql.QueryResult) -> Int func error_code(self: net.mysql.QueryResult) -> Int {
return self.err.code;
}@briefProvides the system library operation `QueryResult.error_code`.
@detailsExecutes the `error_code` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns the operation result as `Int`.
functionnet.mysql::QueryResult.sql_state
Signature
func sql_state(self: net.mysql.QueryResult) -> String func sql_state(self: net.mysql.QueryResult) -> String {
return self.err.sql_state;
}@briefProvides the system library operation `QueryResult.sql_state`.
@detailsExecutes the `sql_state` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns the operation result as `String`.
functionnet.mysql::QueryResult.error_message
Signature
func error_message(self: net.mysql.QueryResult) -> String func error_message(self: net.mysql.QueryResult) -> String {
return self.err.message;
}@briefProvides the system library operation `QueryResult.error_message`.
@detailsExecutes the `error_message` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns the operation result as `String`.
functionnet.mysql::QueryResult.deinit
Signature
func deinit(self: net.mysql.QueryResult) -> Void func deinit(self: net.mysql.QueryResult) -> Void {
}
}@briefReleases fallback resources at the end of the `QueryResult` lifetime.
@detailsThis destructor hook is called by object lifetime management to clean up underlying resources that were not released explicitly. Normal application code should prefer `dispose`, `close`, or the module-specific close function to release resources at a deterministic time.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionnet.mysql::MultiResult.init
Signature
func init(self: net.mysql.MultiResult) -> Void func init(self: net.mysql.MultiResult) -> Void {
self.results = new collections.Vector<net.mysql.QueryResult>();
}@briefInitializes a `MultiResult` instance.
@detailsEstablishes the initial field state for `MultiResult` so other methods can be called safely. Constructor logic should keep fields consistent and avoid leaking partially initialized resources.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionnet.mysql::MultiResult.len
Signature
func len(self: net.mysql.MultiResult) -> Int func len(self: net.mysql.MultiResult) -> Int {
return self.results.len();
}@briefReturns the element count or byte length with `MultiResult.len`.
@detailsExecutes the `len` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns the operation result as `Int`.
functionnet.mysql::MultiResult.get
Signature
func get(self: net.mysql.MultiResult, idx: Int) -> net.mysql.QueryResult func get(self: net.mysql.MultiResult, idx: Int) -> net.mysql.QueryResult {
return self.results.get_unchecked(idx);
}@briefReads the element for `MultiResult.get`.
@detailsExecutes the `get` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- idxZero-based index.
@returnReturns the operation result as `net.mysql.QueryResult`.
functionnet.mysql::MultiResult.deinit
Signature
func deinit(self: net.mysql.MultiResult) -> Void func deinit(self: net.mysql.MultiResult) -> Void {
}
}@briefReleases fallback resources at the end of the `MultiResult` lifetime.
@detailsThis destructor hook is called by object lifetime management to clean up underlying resources that were not released explicitly. Normal application code should prefer `dispose`, `close`, or the module-specific close function to release resources at a deterministic time.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionnet.mysql::Pool.init
Signature
func init(self: net.mysql.Pool, cfg: protocol.mysql.Config, max_size: Int = 8) -> Void func init(self: net.mysql.Pool, cfg: protocol.mysql.Config, max_size: Int = 8) -> Void {
self.cfg = cfg;
self.max_size = max_size;@briefInitializes a `Pool` instance.
@detailsEstablishes the initial field state for `Pool` so other methods can be called safely. Constructor logic should keep fields consistent and avoid leaking partially initialized resources.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- cfgConfiguration value or pointer used to initialize or control the operation.
- max_sizeMaximum allowed count or byte size.
@returnVoid
functionnet.mysql::Pool.configure
Signature
func configure(self: net.mysql.Pool, acquire_timeout_ms: Int = 15000, max_idle_ms: Int = 300000, max_lifetime_ms: Int = 1800000, validation_query: String = "SELECT 1", health_check_on_get: Bool = false, leak_threshold_ms: Int = 60000) -> Void func configure(self: net.mysql.Pool, acquire_timeout_ms: Int = 15000, max_idle_ms: Int = 300000, max_lifetime_ms: Int = 1800000, validation_query: String = "SELECT 1", health_check_on_get: Bool = false, leak_threshold_ms: Int = 60000) -> Void {
self.acquire_timeout_ms = acquire_timeout_ms;
self.max_idle_ms = max_idle_ms;@briefProvides the system library operation `Pool.configure`.
@detailsExecutes the `configure` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- acquire_timeout_msTime interval or timeout value in milliseconds.
- max_idle_msMaximum allowed count or byte size.
- max_lifetime_msMaximum allowed count or byte size.
- validation_queryValue supplied by the caller for storage, comparison, or encoding.
- health_check_on_getWhether a health check is performed when borrowing a connection.
- leak_threshold_msTime interval or timeout value in milliseconds.
@returnVoid
functionnet.mysql::Pool.should_discard
Signature
func should_discard(self: net.mysql.Pool, conn: net.mysql.Conn, now_ms: Int) -> Bool func should_discard(self: net.mysql.Pool, conn: net.mysql.Conn, now_ms: Int) -> Bool {
if conn.closed || self.max_lifetime_ms > 0 && conn.created_at_ms > 0 && now_ms - conn.created_at_ms >= self.max_lifetime_ms || self.max_idle_ms > 0 && conn.last_used_at_ms > 0 && now_ms - conn.last_used_at_ms >= self.max_idle_ms {
return true;@briefProvides the system library operation `Pool.should_discard`.
@detailsExecutes the `should_discard` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- connConnection object or native connection handle used for network I/O.
- now_msTime interval or timeout value in milliseconds.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionnet.mysql::Pool.validate_conn
Signature
func validate_conn(self: net.mysql.Pool, conn: net.mysql.Conn) -> Bool func validate_conn(self: net.mysql.Pool, conn: net.mysql.Conn) -> Bool {
if conn.closed {
return false;@briefProvides the system library operation `Pool.validate_conn`.
@detailsExecutes the `validate_conn` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- connConnection object or native connection handle used for network I/O.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionnet.mysql::Pool.mark_leak_if_needed
Signature
func mark_leak_if_needed(self: net.mysql.Pool, now_ms: Int) -> Void func mark_leak_if_needed(self: net.mysql.Pool, now_ms: Int) -> Void {
if self.leak_threshold_ms <= 0 || self.oldest_borrowed_at_ms <= 0 {
return;@briefProvides the system library operation `Pool.mark_leak_if_needed`.
@detailsExecutes the `mark_leak_if_needed` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- now_msTime interval or timeout value in milliseconds.
@returnVoid
functionnet.mysql::Pool.get_timeout
Signature
func get_timeout(self: net.mysql.Pool, timeout_ms: Int) -> net.mysql.Conn, ErrCode func get_timeout(self: net.mysql.Pool, timeout_ms: Int) -> net.mysql.Conn, ErrCode {
let deadline: Int = 0;
if timeout_ms > 0 {@briefReads the state or data for `Pool.get_timeout`.
@detailsExecutes the `get_timeout` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnReturns `net.mysql.Conn, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Pool.get
Signature
func get(self: net.mysql.Pool) -> net.mysql.Conn, ErrCode func get(self: net.mysql.Pool) -> net.mysql.Conn, ErrCode {
return self.get_timeout(self.acquire_timeout_ms);
}@briefReads the element for `Pool.get`.
@detailsExecutes the `get` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns `net.mysql.Conn, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Pool.put
Signature
func put(self: net.mysql.Pool, conn: net.mysql.Conn) -> Void func put(self: net.mysql.Pool, conn: net.mysql.Conn) -> Void {
let now_ms: Int = time.now_ms();
conn.last_used_at_ms = now_ms;@briefProvides the system library operation `Pool.put`.
@detailsExecutes the `put` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- connConnection object or native connection handle used for network I/O.
@returnVoid
functionnet.mysql::Pool.active_count
Signature
func active_count(self: net.mysql.Pool) -> Int func active_count(self: net.mysql.Pool) -> Int {
_ = self.mu.lock();
let n: Int = self.in_use;@briefProvides the system library operation `Pool.active_count`.
@detailsExecutes the `active_count` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns the operation result as `Int`.
functionnet.mysql::Pool.idle_count
Signature
func idle_count(self: net.mysql.Pool) -> Int func idle_count(self: net.mysql.Pool) -> Int {
_ = self.mu.lock();
let n: Int = self.idle.len();@briefProvides the system library operation `Pool.idle_count`.
@detailsExecutes the `idle_count` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns the operation result as `Int`.
functionnet.mysql::Pool.suspected_leaks
Signature
func suspected_leaks(self: net.mysql.Pool) -> Int func suspected_leaks(self: net.mysql.Pool) -> Int {
_ = self.mu.lock();
let n: Int = self.leak_reports;@briefProvides the system library operation `Pool.suspected_leaks`.
@detailsExecutes the `suspected_leaks` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns the operation result as `Int`.
functionnet.mysql::Pool.close
Signature
func close(self: net.mysql.Pool) -> Void func close(self: net.mysql.Pool) -> Void {
_ = self.mu.lock();
self.closed = true;@briefCloses resources and makes later operations unavailable with `Pool.close`.
@detailsExecutes the `close` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionnet.mysql::Pool.deinit
Signature
func deinit(self: net.mysql.Pool) -> Void func deinit(self: net.mysql.Pool) -> Void {
}
}@briefReleases fallback resources at the end of the `Pool` lifetime.
@detailsThis destructor hook is called by object lifetime management to clean up underlying resources that were not released explicitly. Normal application code should prefer `dispose`, `close`, or the module-specific close function to release resources at a deterministic time.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionnet.mysql::Conn.init
Signature
func init(self: net.mysql.Conn, fd: Int, timeout_ms: Int = 15000) -> Void func init(self: net.mysql.Conn, fd: Int, timeout_ms: Int = 15000) -> Void {
self.fd = fd;
self.tls_h = 0;@briefInitializes a `Conn` instance.
@detailsEstablishes the initial field state for `Conn` so other methods can be called safely. Constructor logic should keep fields consistent and avoid leaking partially initialized resources.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- fdOperating-system file descriptor or socket descriptor.
- timeout_msTimeout in milliseconds; negative values usually select blocking or default timeout behavior.
@returnVoid
functionnet.mysql::Conn.clear_error
Signature
func clear_error(self: net.mysql.Conn) -> Void func clear_error(self: net.mysql.Conn) -> Void {
self.last_error = new protocol.mysql.ErrPacket();
}@briefProvides the system library operation `Conn.clear_error`.
@detailsExecutes the `clear_error` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionnet.mysql::Conn.set_error
Signature
func set_error(self: net.mysql.Conn, err: protocol.mysql.ErrPacket) -> Void func set_error(self: net.mysql.Conn, err: protocol.mysql.ErrPacket) -> Void {
self.last_error = err;
}@briefSets state or configuration with `Conn.set_error`.
@detailsExecutes the `set_error` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- errError code or error object.
@returnVoid
functionnet.mysql::Conn.last_error_code
Signature
func last_error_code(self: net.mysql.Conn) -> Int func last_error_code(self: net.mysql.Conn) -> Int {
return self.last_error.code;
}@briefProvides the system library operation `Conn.last_error_code`.
@detailsExecutes the `last_error_code` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns the operation result as `Int`.
functionnet.mysql::Conn.last_sql_state
Signature
func last_sql_state(self: net.mysql.Conn) -> String func last_sql_state(self: net.mysql.Conn) -> String {
return self.last_error.sql_state;
}@briefProvides the system library operation `Conn.last_sql_state`.
@detailsExecutes the `last_sql_state` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns the operation result as `String`.
functionnet.mysql::Conn.last_error_message
Signature
func last_error_message(self: net.mysql.Conn) -> String func last_error_message(self: net.mysql.Conn) -> String {
return self.last_error.message;
}@briefProvides the system library operation `Conn.last_error_message`.
@detailsExecutes the `last_error_message` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns the operation result as `String`.
functionnet.mysql::Conn.last_error_text
Signature
func last_error_text(self: net.mysql.Conn) -> String func last_error_text(self: net.mysql.Conn) -> String {
if self.last_error.code == 0 && std.len(self.last_error.message) == 0 {
return "";@briefProvides the system library operation `Conn.last_error_text`.
@detailsExecutes the `last_error_text` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns the operation result as `String`.
functionnet.mysql::Conn.recv_some
Signature
func recv_some(self: net.mysql.Conn, max_bytes: Int) -> String, ErrCode func recv_some(self: net.mysql.Conn, max_bytes: Int) -> String, ErrCode {
if self.closed {
return "", std.ERR_INVALID;@briefProvides the system library operation `Conn.recv_some`.
@detailsExecutes the `recv_some` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- max_bytesMaximum number of bytes to read or process in this operation.
@returnReturns `String, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.send_some
Signature
func send_some(self: net.mysql.Conn, data: String) -> Int, ErrCode func send_some(self: net.mysql.Conn, data: String) -> Int, ErrCode {
if self.closed {
return 0, std.ERR_INVALID;@briefProvides the system library operation `Conn.send_some`.
@detailsExecutes the `send_some` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- dataInput or output data buffer.
@returnReturns `Int, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.read_exact
Signature
func read_exact(self: net.mysql.Conn, n: Int) -> String, ErrCode func read_exact(self: net.mysql.Conn, n: Int) -> String, ErrCode {
let out: String = "";
loop (; std.len(out) < n; ) {@briefReads data with `Conn.read_exact`.
@detailsExecutes the `read_exact` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- nCount, size, or limit value.
@returnReturns `String, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.send_all
Signature
func send_all(self: net.mysql.Conn, data: String) -> ErrCode func send_all(self: net.mysql.Conn, data: String) -> ErrCode {
let off: Int = 0;
loop (; off < std.len(data); ) {@briefProvides the system library operation `Conn.send_all`.
@detailsExecutes the `send_all` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- dataInput or output data buffer.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.read_packet
Signature
func read_packet(self: net.mysql.Conn) -> protocol.mysql.Packet, ErrCode func read_packet(self: net.mysql.Conn) -> protocol.mysql.Packet, ErrCode {
if self.compression_enabled {
return self.read_compressed_packet();@briefReads data with `Conn.read_packet`.
@detailsExecutes the `read_packet` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns `protocol.mysql.Packet, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.read_compressed_frame
Signature
func read_compressed_frame(self: net.mysql.Conn) -> ErrCode func read_compressed_frame(self: net.mysql.Conn) -> ErrCode {
let hdr, hdr_err = self.read_exact(7);
if hdr_err != std.OK {@briefReads data with `Conn.read_compressed_frame`.
@detailsExecutes the `read_compressed_frame` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.read_compressed_packet
Signature
func read_compressed_packet(self: net.mysql.Conn) -> protocol.mysql.Packet, ErrCode func read_compressed_packet(self: net.mysql.Conn) -> protocol.mysql.Packet, ErrCode {
let payload: String = "";
let first_seq: Int = -1;@briefReads data with `Conn.read_compressed_packet`.
@detailsExecutes the `read_compressed_packet` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns `protocol.mysql.Packet, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.write_payload
Signature
func write_payload(self: net.mysql.Conn, payload: String) -> ErrCode func write_payload(self: net.mysql.Conn, payload: String) -> ErrCode {
let wire, enc_err = protocol.mysql.encode_fragmented_packets(self.seq, payload);
if enc_err != std.OK {@briefWrites data with `Conn.write_payload`.
@detailsExecutes the `write_payload` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- payloadPayload bytes or text carried by the protocol frame, request, or response.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.write_command
Signature
func write_command(self: net.mysql.Conn, payload: String) -> ErrCode func write_command(self: net.mysql.Conn, payload: String) -> ErrCode {
self.seq = 0;
self.compressed_seq = 0;@briefWrites data with `Conn.write_command`.
@detailsExecutes the `write_command` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- payloadPayload bytes or text carried by the protocol frame, request, or response.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.start_tls
Signature
func start_tls(self: net.mysql.Conn, host: String, verify: Bool = false, ca_file: String = "") -> ErrCode func start_tls(self: net.mysql.Conn, host: String, verify: Bool = false, ca_file: String = "") -> ErrCode {
let h, err = net.tls.upgrade_client_fd_ex(self.fd, host, self.timeout_ms, verify, ca_file);
if err != std.OK {@briefProvides the system library operation `Conn.start_tls`.
@detailsExecutes the `start_tls` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- hostHost name or listen address.
- verifyWhether certificate or identity verification is required for the TLS operation.
- ca_fileFilesystem path to the certificate authority bundle used for TLS verification.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.close
Signature
func close(self: net.mysql.Conn) -> Void func close(self: net.mysql.Conn) -> Void {
if self.closed {
return;@briefCloses resources and makes later operations unavailable with `Conn.close`.
@detailsExecutes the `close` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionnet.mysql::Conn.local_infile_allowed
Signature
func local_infile_allowed(self: net.mysql.Conn, filename: String) -> Bool func local_infile_allowed(self: net.mysql.Conn, filename: String) -> Bool {
if !self.allow_local_infile || std.len(self.local_infile_root) == 0 {
return false;@briefProvides the system library operation `Conn.local_infile_allowed`.
@detailsExecutes the `local_infile_allowed` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- filenameFilesystem path or file name used by the operation.
@returnReturns a boolean result; true means the condition holds or the operation succeeded.
functionnet.mysql::Conn.send_local_infile
Signature
func send_local_infile(self: net.mysql.Conn, filename: String) -> ErrCode func send_local_infile(self: net.mysql.Conn, filename: String) -> ErrCode {
if !self.local_infile_allowed(filename) {
return std.ERR_PERMISSION;@briefProvides the system library operation `Conn.send_local_infile`.
@detailsExecutes the `send_local_infile` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- filenameFilesystem path or file name used by the operation.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.finish_auth
Signature
func finish_auth(self: net.mysql.Conn, plugin_name: String, password: String, seed: String, allow_cleartext_password: Bool, allow_public_key_retrieval: Bool) -> ErrCode func finish_auth(self: net.mysql.Conn, plugin_name: String, password: String, seed: String, allow_cleartext_password: Bool, allow_public_key_retrieval: Bool) -> ErrCode {
let plugin: String = plugin_name;
let current_seed: String = seed;@briefProvides the system library operation `Conn.finish_auth`.
@detailsExecutes the `finish_auth` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- plugin_nameAuthentication plugin name selected by the database server or client.
- passwordPassword or authentication secret supplied to the protocol login flow.
- seedSeed value used to initialize deterministic hashing or pseudo-random behavior.
- allow_cleartext_passwordWhether cleartext password authentication is permitted for the database connection.
- allow_public_key_retrievalKey name, key material, or key collection used by the operation.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.ping
Signature
func ping(self: net.mysql.Conn) -> ErrCode func ping(self: net.mysql.Conn) -> ErrCode {
if self.busy {
return std.ERR_INVALID;@briefProvides the system library operation `Conn.ping`.
@detailsExecutes the `ping` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.read_result
Signature
func read_result(self: net.mysql.Conn, binary_rows: Bool = false) -> net.mysql.QueryResult, ErrCode func read_result(self: net.mysql.Conn, binary_rows: Bool = false) -> net.mysql.QueryResult, ErrCode {
let qr: net.mysql.QueryResult = new net.mysql.QueryResult();
let first: protocol.mysql.Packet = self.read_packet()?;@briefReads data with `Conn.read_result`.
@detailsExecutes the `read_result` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- binary_rowsBinary row payloads returned by or sent to the database protocol.
@returnReturns `net.mysql.QueryResult, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.result_status_flags
Signature
func result_status_flags(self: net.mysql.Conn, qr: net.mysql.QueryResult) -> Int func result_status_flags(self: net.mysql.Conn, qr: net.mysql.QueryResult) -> Int {
if qr.is_result_set {
return qr.result_set.status_flags;@briefProvides the system library operation `Conn.result_status_flags`.
@detailsExecutes the `result_status_flags` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- qrQuery result object decoded from the database response.
@returnReturns the operation result as `Int`.
functionnet.mysql::Conn.exec_command
Signature
func exec_command(self: net.mysql.Conn, payload: String, binary_rows: Bool = false) -> net.mysql.QueryResult, ErrCode func exec_command(self: net.mysql.Conn, payload: String, binary_rows: Bool = false) -> net.mysql.QueryResult, ErrCode {
let qr: net.mysql.QueryResult = new net.mysql.QueryResult();
if self.busy {@briefProvides the system library operation `Conn.exec_command`.
@detailsExecutes the `exec_command` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- payloadPayload bytes or text carried by the protocol frame, request, or response.
- binary_rowsBinary row payloads returned by or sent to the database protocol.
@returnReturns `net.mysql.QueryResult, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.exec_command_all
Signature
func exec_command_all(self: net.mysql.Conn, payload: String, binary_rows: Bool = false) -> net.mysql.MultiResult, ErrCode func exec_command_all(self: net.mysql.Conn, payload: String, binary_rows: Bool = false) -> net.mysql.MultiResult, ErrCode {
let mr: net.mysql.MultiResult = new net.mysql.MultiResult();
if self.busy {@briefProvides the system library operation `Conn.exec_command_all`.
@detailsExecutes the `exec_command_all` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- payloadPayload bytes or text carried by the protocol frame, request, or response.
- binary_rowsBinary row payloads returned by or sent to the database protocol.
@returnReturns `net.mysql.MultiResult, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.query
Signature
func query(self: net.mysql.Conn, sql: String) -> net.mysql.QueryResult, ErrCode func query(self: net.mysql.Conn, sql: String) -> net.mysql.QueryResult, ErrCode {
return self.exec_command(protocol.mysql.encode_query(sql));
}@briefProvides the system library operation `Conn.query`.
@detailsExecutes the `query` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- sqlSQL statement text sent to the database server.
@returnReturns `net.mysql.QueryResult, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.query_all
Signature
func query_all(self: net.mysql.Conn, sql: String) -> net.mysql.MultiResult, ErrCode func query_all(self: net.mysql.Conn, sql: String) -> net.mysql.MultiResult, ErrCode {
return self.exec_command_all(protocol.mysql.encode_query(sql));
}@briefProvides the system library operation `Conn.query_all`.
@detailsExecutes the `query_all` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- sqlSQL statement text sent to the database server.
@returnReturns `net.mysql.MultiResult, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.init_db
Signature
func init_db(self: net.mysql.Conn, database: String) -> ErrCode func init_db(self: net.mysql.Conn, database: String) -> ErrCode {
let _, err = self.exec_command(protocol.mysql.encode_init_db(database));
return err;@briefProvides the system library operation `Conn.init_db`.
@detailsExecutes the `init_db` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- databaseDatabase name or database index selected for the connection or command.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.prepare
Signature
func prepare(self: net.mysql.Conn, sql: String) -> protocol.mysql.StmtPrepareOk, ErrCode func prepare(self: net.mysql.Conn, sql: String) -> protocol.mysql.StmtPrepareOk, ErrCode {
let out: protocol.mysql.StmtPrepareOk = new protocol.mysql.StmtPrepareOk();
if self.busy {@briefProvides the system library operation `Conn.prepare`.
@detailsExecutes the `prepare` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- sqlSQL statement text sent to the database server.
@returnReturns `protocol.mysql.StmtPrepareOk, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.stmt_close
Signature
func stmt_close(self: net.mysql.Conn, statement_id: Int) -> ErrCode func stmt_close(self: net.mysql.Conn, statement_id: Int) -> ErrCode {
return self.write_command(protocol.mysql.encode_stmt_close(statement_id));
}@briefProvides the system library operation `Conn.stmt_close`.
@detailsExecutes the `stmt_close` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- statement_idPrepared statement identifier assigned by the database server.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.stmt_reset
Signature
func stmt_reset(self: net.mysql.Conn, statement_id: Int) -> ErrCode func stmt_reset(self: net.mysql.Conn, statement_id: Int) -> ErrCode {
let _, err = self.exec_command(protocol.mysql.encode_stmt_reset(statement_id));
return err;@briefProvides the system library operation `Conn.stmt_reset`.
@detailsExecutes the `stmt_reset` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- statement_idPrepared statement identifier assigned by the database server.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.stmt_execute
Signature
func stmt_execute(self: net.mysql.Conn, statement_id: Int, params: collections.Vector<protocol.mysql.StmtParam>) -> net.mysql.QueryResult, ErrCode func stmt_execute(self: net.mysql.Conn, statement_id: Int, params: collections.Vector<protocol.mysql.StmtParam>) -> net.mysql.QueryResult, ErrCode {
let payload: String = protocol.mysql.encode_stmt_execute(statement_id, params, protocol.mysql.cursor_type_no_cursor())?;
return self.exec_command(payload, true);@briefProvides the system library operation `Conn.stmt_execute`.
@detailsExecutes the `stmt_execute` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- statement_idPrepared statement identifier assigned by the database server.
- paramsName/value parameter map encoded into the request or protocol message.
@returnReturns `net.mysql.QueryResult, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.read_prepared_execute_result
Signature
func read_prepared_execute_result(self: net.mysql.Conn, first: protocol.mysql.Packet, columns: collections.Vector<protocol.mysql.ColumnDefinition>) -> net.mysql.QueryResult, ErrCode func read_prepared_execute_result(self: net.mysql.Conn, first: protocol.mysql.Packet, columns: collections.Vector<protocol.mysql.ColumnDefinition>) -> net.mysql.QueryResult, ErrCode {
let qr: net.mysql.QueryResult = new net.mysql.QueryResult();
if protocol.mysql.is_ok_payload(first.payload) {@briefReads data with `Conn.read_prepared_execute_result`.
@detailsExecutes the `read_prepared_execute_result` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- firstFirst element, flag, byte, or boundary value in the operation.
- columnsColumn definitions or selected column names used by the database operation.
@returnReturns `net.mysql.QueryResult, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.stmt_execute_prepared
Signature
func stmt_execute_prepared(self: net.mysql.Conn, stmt: protocol.mysql.StmtPrepareOk, params: collections.Vector<protocol.mysql.StmtParam>) -> net.mysql.QueryResult, ErrCode func stmt_execute_prepared(self: net.mysql.Conn, stmt: protocol.mysql.StmtPrepareOk, params: collections.Vector<protocol.mysql.StmtParam>) -> net.mysql.QueryResult, ErrCode {
let qr: net.mysql.QueryResult = new net.mysql.QueryResult();
if self.busy {@briefProvides the system library operation `Conn.stmt_execute_prepared`.
@detailsExecutes the `stmt_execute_prepared` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- stmtPrepared statement object, statement handle, or statement id used by the database operation.
- paramsName/value parameter map encoded into the request or protocol message.
@returnReturns `net.mysql.QueryResult, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.read_binary_rows
Signature
func read_binary_rows(self: net.mysql.Conn, columns: collections.Vector<protocol.mysql.ColumnDefinition>) -> net.mysql.QueryResult, ErrCode func read_binary_rows(self: net.mysql.Conn, columns: collections.Vector<protocol.mysql.ColumnDefinition>) -> net.mysql.QueryResult, ErrCode {
let qr: net.mysql.QueryResult = new net.mysql.QueryResult();
let rs: protocol.mysql.ResultSet = new protocol.mysql.ResultSet();@briefReads data with `Conn.read_binary_rows`.
@detailsExecutes the `read_binary_rows` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- columnsColumn definitions or selected column names used by the database operation.
@returnReturns `net.mysql.QueryResult, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.read_binary_rows_with_first
Signature
func read_binary_rows_with_first(self: net.mysql.Conn, columns: collections.Vector<protocol.mysql.ColumnDefinition>, first: protocol.mysql.Packet) -> net.mysql.QueryResult, ErrCode func read_binary_rows_with_first(self: net.mysql.Conn, columns: collections.Vector<protocol.mysql.ColumnDefinition>, first: protocol.mysql.Packet) -> net.mysql.QueryResult, ErrCode {
let qr: net.mysql.QueryResult = new net.mysql.QueryResult();
let rs: protocol.mysql.ResultSet = new protocol.mysql.ResultSet();@briefReads data with `Conn.read_binary_rows_with_first`.
@detailsExecutes the `read_binary_rows_with_first` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- columnsColumn definitions or selected column names used by the database operation.
- firstFirst element, flag, byte, or boundary value in the operation.
@returnReturns `net.mysql.QueryResult, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.read_cursor_open_result
Signature
func read_cursor_open_result(self: net.mysql.Conn, first: protocol.mysql.Packet, columns: collections.Vector<protocol.mysql.ColumnDefinition>) -> net.mysql.QueryResult, ErrCode func read_cursor_open_result(self: net.mysql.Conn, first: protocol.mysql.Packet, columns: collections.Vector<protocol.mysql.ColumnDefinition>) -> net.mysql.QueryResult, ErrCode {
let qr: net.mysql.QueryResult = new net.mysql.QueryResult();
if protocol.mysql.is_ok_payload(first.payload) {@briefReads data with `Conn.read_cursor_open_result`.
@detailsExecutes the `read_cursor_open_result` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- firstFirst element, flag, byte, or boundary value in the operation.
- columnsColumn definitions or selected column names used by the database operation.
@returnReturns `net.mysql.QueryResult, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.stmt_execute_cursor
Signature
func stmt_execute_cursor(self: net.mysql.Conn, stmt: protocol.mysql.StmtPrepareOk, params: collections.Vector<protocol.mysql.StmtParam>, flags: Int = 1) -> net.mysql.QueryResult, ErrCode func stmt_execute_cursor(self: net.mysql.Conn, stmt: protocol.mysql.StmtPrepareOk, params: collections.Vector<protocol.mysql.StmtParam>, flags: Int = 1) -> net.mysql.QueryResult, ErrCode {
let qr: net.mysql.QueryResult = new net.mysql.QueryResult();
if self.busy {@briefProvides the system library operation `Conn.stmt_execute_cursor`.
@detailsExecutes the `stmt_execute_cursor` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- stmtPrepared statement object, statement handle, or statement id used by the database operation.
- paramsName/value parameter map encoded into the request or protocol message.
- flagsBitmask of option flags that controls how the operation is performed.
@returnReturns `net.mysql.QueryResult, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.stmt_fetch
Signature
func stmt_fetch(self: net.mysql.Conn, statement_id: Int, rows: Int) -> net.mysql.QueryResult, ErrCode func stmt_fetch(self: net.mysql.Conn, statement_id: Int, rows: Int) -> net.mysql.QueryResult, ErrCode {
return self.exec_command(protocol.mysql.encode_stmt_fetch(statement_id, rows), true);
}@briefProvides the system library operation `Conn.stmt_fetch`.
@detailsExecutes the `stmt_fetch` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- statement_idPrepared statement identifier assigned by the database server.
- rowsRow data returned by, encoded for, or supplied to the database operation.
@returnReturns `net.mysql.QueryResult, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.stmt_fetch_rows
Signature
func stmt_fetch_rows(self: net.mysql.Conn, statement_id: Int, rows: Int, columns: collections.Vector<protocol.mysql.ColumnDefinition>) -> net.mysql.QueryResult, ErrCode func stmt_fetch_rows(self: net.mysql.Conn, statement_id: Int, rows: Int, columns: collections.Vector<protocol.mysql.ColumnDefinition>) -> net.mysql.QueryResult, ErrCode {
let qr: net.mysql.QueryResult = new net.mysql.QueryResult();
if self.busy {@briefProvides the system library operation `Conn.stmt_fetch_rows`.
@detailsExecutes the `stmt_fetch_rows` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- statement_idPrepared statement identifier assigned by the database server.
- rowsRow data returned by, encoded for, or supplied to the database operation.
- columnsColumn definitions or selected column names used by the database operation.
@returnReturns `net.mysql.QueryResult, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.reset_connection
Signature
func reset_connection(self: net.mysql.Conn) -> ErrCode func reset_connection(self: net.mysql.Conn) -> ErrCode {
let _, err = self.exec_command(protocol.mysql.encode_reset_connection());
return err;@briefProvides the system library operation `Conn.reset_connection`.
@detailsExecutes the `reset_connection` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.apply_session_config
Signature
func apply_session_config(self: net.mysql.Conn, cfg: protocol.mysql.Config) -> ErrCode func apply_session_config(self: net.mysql.Conn, cfg: protocol.mysql.Config) -> ErrCode {
let n: Int = protocol.mysql.session_sql_count(cfg);
loop (let i: Int = 0; i < n; i += 1) {@briefProvides the system library operation `Conn.apply_session_config`.
@detailsExecutes the `apply_session_config` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
- cfgConfiguration value or pointer used to initialize or control the operation.
@returnReturns `ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::Conn.deinit
Signature
func deinit(self: net.mysql.Conn) -> Void func deinit(self: net.mysql.Conn) -> Void {
}
}@briefReleases fallback resources at the end of the `Conn` lifetime.
@detailsThis destructor hook is called by object lifetime management to clean up underlying resources that were not released explicitly. Normal application code should prefer `dispose`, `close`, or the module-specific close function to release resources at a deterministic time.
@param
- selfThe current instance whose fields, handles, buffers, or external resources are read or modified by this method.
@returnVoid
functionnet.mysql::connect
Signature
func connect(cfg: protocol.mysql.Config) -> net.mysql.Conn, ErrCodefunc connect(cfg: protocol.mysql.Config) -> net.mysql.Conn, ErrCode {
let fd: Int = net.tcp.connect(cfg.host, cfg.port, cfg.timeout_ms)?;
let conn: net.mysql.Conn = new net.mysql.Conn(fd, cfg.timeout_ms);@briefEstablishes a connection with `connect`.
@detailsExecutes the `connect` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- cfgConfiguration value or pointer used to initialize or control the operation.
@returnReturns `net.mysql.Conn, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
functionnet.mysql::connect_dsn
Signature
func connect_dsn(dsn: String) -> net.mysql.Conn, ErrCodefunc connect_dsn(dsn: String) -> net.mysql.Conn, ErrCode {
let cfg: protocol.mysql.Config = protocol.mysql.parse_dsn(dsn)?;
return net.mysql.connect(cfg);@briefProvides the system library operation `connect_dsn`.
@detailsExecutes the `connect_dsn` system-library API. The documented parameters define the accepted inputs, ownership requirements, range limits, and timeout behavior for this call. Callers must check returned `ErrCode` values or boolean status values before using the result.
@param
- dsnData source name containing connection settings for the database client.
@returnReturns `net.mysql.Conn, ErrCode`; on success the error code is `std.OK` or `OK`, and on failure the error code describes the failure while any returned value contains the usable partial result when available.
Variables
Class fields (var).
varnet.mysql::QueryResult.is_result_set
Type
Bool@brief`is_result_set` field.
@detailsHolds the `is_result_set` value for each `QueryResult` instance. The field type is `Bool`, and constructors and methods keep it synchronized with the object's runtime state.
var is_result_set: Bool;
/*
@brief `ok` field.varnet.mysql::QueryResult.ok
Type
protocol.mysql.OkPacket@brief`ok` field.
@detailsIndicates whether the operation or state is valid. The field type is `protocol.mysql.OkPacket`, and it is maintained by the constructors and methods of `QueryResult`.
var ok: protocol.mysql.OkPacket;
/*
@brief `err` field.varnet.mysql::QueryResult.err
Type
protocol.mysql.ErrPacket@brief`err` field.
@detailsHolds the `err` value for each `QueryResult` instance. The field type is `protocol.mysql.ErrPacket`, and constructors and methods keep it synchronized with the object's runtime state.
var err: protocol.mysql.ErrPacket;
/*
@brief `result_set` field.varnet.mysql::QueryResult.result_set
Type
protocol.mysql.ResultSet@brief`result_set` field.
@detailsHolds the `result_set` value for each `QueryResult` instance. The field type is `protocol.mysql.ResultSet`, and constructors and methods keep it synchronized with the object's runtime state.
var result_set: protocol.mysql.ResultSet;
/*varnet.mysql::MultiResult.results
Type
collections.Vector<net.mysql.QueryResult>@brief`results` field.
@detailsHolds the `results` value for each `MultiResult` instance. The field type is `collections.Vector<net.mysql.QueryResult>`, and constructors and methods keep it synchronized with the object's runtime state.
var results: collections.Vector<net.mysql.QueryResult>;
/*varnet.mysql::Pool.cfg
Type
protocol.mysql.Config@brief`cfg` field.
@detailsHolds the `cfg` value for each `Pool` instance. The field type is `protocol.mysql.Config`, and constructors and methods keep it synchronized with the object's runtime state.
var cfg: protocol.mysql.Config;
/*
@brief `max_size` field.varnet.mysql::Pool.max_size
Type
Int@brief`max_size` field.
@detailsHolds the `max_size` value for each `Pool` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var max_size: Int;
/*
@brief `idle` field.varnet.mysql::Pool.idle
Type
collections.Vector<net.mysql.Conn>@brief`idle` field.
@detailsHolds the `idle` value for each `Pool` instance. The field type is `collections.Vector<net.mysql.Conn>`, and constructors and methods keep it synchronized with the object's runtime state.
var idle: collections.Vector<net.mysql.Conn>;
/*
@brief `mu` field.varnet.mysql::Pool.mu
Type
sync.Mutex@brief`mu` field.
@detailsHolds the `mu` value for each `Pool` instance. The field type is `sync.Mutex`, and constructors and methods keep it synchronized with the object's runtime state.
var mu: sync.Mutex;
/*
@brief `total` field.varnet.mysql::Pool.total
Type
Int@brief`total` field.
@detailsHolds the `total` value for each `Pool` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var total: Int;
/*
@brief `in_use` field.varnet.mysql::Pool.in_use
Type
Int@brief`in_use` field.
@detailsHolds the `in_use` value for each `Pool` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var in_use: Int;
/*
@brief `waiters` field.varnet.mysql::Pool.waiters
Type
Int@brief`waiters` field.
@detailsHolds the `waiters` value for each `Pool` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var waiters: Int;
/*
@brief `closed` field.varnet.mysql::Pool.closed
Type
Bool@brief`closed` field.
@detailsIndicates whether the resource has already been closed. The field type is `Bool`, and it is maintained by the constructors and methods of `Pool`.
var closed: Bool;
/*
@brief `acquire_timeout_ms` field.varnet.mysql::Pool.acquire_timeout_ms
Type
Int@brief`acquire_timeout_ms` field.
@detailsHolds the `acquire_timeout_ms` value for each `Pool` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var acquire_timeout_ms: Int;
/*
@brief `max_idle_ms` field.varnet.mysql::Pool.max_idle_ms
Type
Int@brief`max_idle_ms` field.
@detailsHolds the `max_idle_ms` value for each `Pool` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var max_idle_ms: Int;
/*
@brief `max_lifetime_ms` field.varnet.mysql::Pool.max_lifetime_ms
Type
Int@brief`max_lifetime_ms` field.
@detailsHolds the `max_lifetime_ms` value for each `Pool` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var max_lifetime_ms: Int;
/*
@brief `validation_query` field.varnet.mysql::Pool.validation_query
Type
String@brief`validation_query` field.
@detailsHolds the `validation_query` value for each `Pool` instance. The field type is `String`, and constructors and methods keep it synchronized with the object's runtime state.
var validation_query: String;
/*
@brief `health_check_on_get` field.varnet.mysql::Pool.health_check_on_get
Type
Bool@brief`health_check_on_get` field.
@detailsHolds the `health_check_on_get` value for each `Pool` instance. The field type is `Bool`, and constructors and methods keep it synchronized with the object's runtime state.
var health_check_on_get: Bool;
/*
@brief `leak_threshold_ms` field.varnet.mysql::Pool.leak_threshold_ms
Type
Int@brief`leak_threshold_ms` field.
@detailsHolds the `leak_threshold_ms` value for each `Pool` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var leak_threshold_ms: Int;
/*
@brief `leak_reports` field.varnet.mysql::Pool.leak_reports
Type
Int@brief`leak_reports` field.
@detailsHolds the `leak_reports` value for each `Pool` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var leak_reports: Int;
/*
@brief `oldest_borrowed_at_ms` field.varnet.mysql::Pool.oldest_borrowed_at_ms
Type
Int@brief`oldest_borrowed_at_ms` field.
@detailsHolds the `oldest_borrowed_at_ms` value for each `Pool` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var oldest_borrowed_at_ms: Int;
/*varnet.mysql::Conn.fd
Type
Int@brief`fd` field.
@detailsStores the underlying file descriptor or socket descriptor. The field type is `Int`, and it is maintained by the constructors and methods of `Conn`.
var fd: Int;
/*
@brief `tls_h` field.varnet.mysql::Conn.tls_h
Type
Int@brief`tls_h` field.
@detailsHolds the `tls_h` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var tls_h: Int;
/*
@brief `tls_enabled` field.varnet.mysql::Conn.tls_enabled
Type
Bool@brief`tls_enabled` field.
@detailsHolds the `tls_enabled` value for each `Conn` instance. The field type is `Bool`, and constructors and methods keep it synchronized with the object's runtime state.
var tls_enabled: Bool;
/*
@brief `timeout_ms` field.varnet.mysql::Conn.timeout_ms
Type
Int@brief`timeout_ms` field.
@detailsStores the default timeout in milliseconds. The field type is `Int`, and it is maintained by the constructors and methods of `Conn`.
var timeout_ms: Int;
/*
@brief `seq` field.varnet.mysql::Conn.seq
Type
Int@brief`seq` field.
@detailsHolds the `seq` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var seq: Int;
/*
@brief `caps` field.varnet.mysql::Conn.caps
Type
Int@brief`caps` field.
@detailsHolds the `caps` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var caps: Int;
/*
@brief `server_caps` field.varnet.mysql::Conn.server_caps
Type
Int@brief`server_caps` field.
@detailsHolds the `server_caps` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var server_caps: Int;
/*
@brief `status_flags` field.varnet.mysql::Conn.status_flags
Type
Int@brief`status_flags` field.
@detailsHolds the `status_flags` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var status_flags: Int;
/*
@brief `warnings` field.varnet.mysql::Conn.warnings
Type
Int@brief`warnings` field.
@detailsHolds the `warnings` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var warnings: Int;
/*
@brief `busy` field.varnet.mysql::Conn.busy
Type
Bool@brief`busy` field.
@detailsHolds the `busy` value for each `Conn` instance. The field type is `Bool`, and constructors and methods keep it synchronized with the object's runtime state.
var busy: Bool;
/*
@brief `closed` field.varnet.mysql::Conn.closed
Type
Bool@brief`closed` field.
@detailsIndicates whether the resource has already been closed. The field type is `Bool`, and it is maintained by the constructors and methods of `Conn`.
var closed: Bool;
/*
@brief `acquire_timeout_ms` field.varnet.mysql::Conn.allow_local_infile
Type
Bool@brief`allow_local_infile` field.
@detailsHolds the `allow_local_infile` value for each `Conn` instance. The field type is `Bool`, and constructors and methods keep it synchronized with the object's runtime state.
var allow_local_infile: Bool;
/*
@brief `local_infile_root` field.varnet.mysql::Conn.local_infile_root
Type
String@brief`local_infile_root` field.
@detailsHolds the `local_infile_root` value for each `Conn` instance. The field type is `String`, and constructors and methods keep it synchronized with the object's runtime state.
var local_infile_root: String;
/*
@brief `max_local_infile_bytes` field.varnet.mysql::Conn.max_local_infile_bytes
Type
Int@brief`max_local_infile_bytes` field.
@detailsHolds the `max_local_infile_bytes` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var max_local_infile_bytes: Int;
/*
@brief `compression_enabled` field.varnet.mysql::Conn.compression_enabled
Type
Bool@brief`compression_enabled` field.
@detailsHolds the `compression_enabled` value for each `Conn` instance. The field type is `Bool`, and constructors and methods keep it synchronized with the object's runtime state.
var compression_enabled: Bool;
/*
@brief `compression_requested` field.varnet.mysql::Conn.compression_requested
Type
Bool@brief`compression_requested` field.
@detailsHolds the `compression_requested` value for each `Conn` instance. The field type is `Bool`, and constructors and methods keep it synchronized with the object's runtime state.
var compression_requested: Bool;
/*
@brief `compression_min_bytes` field.varnet.mysql::Conn.compression_min_bytes
Type
Int@brief`compression_min_bytes` field.
@detailsHolds the `compression_min_bytes` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var compression_min_bytes: Int;
/*
@brief `max_uncompressed_packet_bytes` field.varnet.mysql::Conn.max_uncompressed_packet_bytes
Type
Int@brief`max_uncompressed_packet_bytes` field.
@detailsHolds the `max_uncompressed_packet_bytes` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var max_uncompressed_packet_bytes: Int;
/*
@brief `compressed_seq` field.varnet.mysql::Conn.compressed_seq
Type
Int@brief`compressed_seq` field.
@detailsHolds the `compressed_seq` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var compressed_seq: Int;
/*
@brief `compressed_read_buffer` field.varnet.mysql::Conn.compressed_read_buffer
Type
String@brief`compressed_read_buffer` field.
@detailsHolds the `compressed_read_buffer` value for each `Conn` instance. The field type is `String`, and constructors and methods keep it synchronized with the object's runtime state.
var compressed_read_buffer: String;
/*
@brief `last_error` field.varnet.mysql::Conn.last_error
Type
protocol.mysql.ErrPacket@brief`last_error` field.
@detailsHolds the `last_error` value for each `Conn` instance. The field type is `protocol.mysql.ErrPacket`, and constructors and methods keep it synchronized with the object's runtime state.
var last_error: protocol.mysql.ErrPacket;
/*
@brief `created_at_ms` field.varnet.mysql::Conn.created_at_ms
Type
Int@brief`created_at_ms` field.
@detailsHolds the `created_at_ms` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var created_at_ms: Int;
/*
@brief `last_used_at_ms` field.varnet.mysql::Conn.last_used_at_ms
Type
Int@brief`last_used_at_ms` field.
@detailsHolds the `last_used_at_ms` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var last_used_at_ms: Int;
/*
@brief `borrowed_at_ms` field.varnet.mysql::Conn.borrowed_at_ms
Type
Int@brief`borrowed_at_ms` field.
@detailsHolds the `borrowed_at_ms` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var borrowed_at_ms: Int;
/*
@brief `use_count` field.varnet.mysql::Conn.use_count
Type
Int@brief`use_count` field.
@detailsHolds the `use_count` value for each `Conn` instance. The field type is `Int`, and constructors and methods keep it synchronized with the object's runtime state.
var use_count: Int;
/*