# src/db_connector/mysql

Theme:

- Manual
- Standard library
- Index
- Compiler docs
- Fusion docs
- devel, stable

Search:

# Types

    BIND = St_mysql_bind

    Character_set {.final.} = object
      number*: cuint
      state*: cuint
      csname*: cstring
      name*: cstring
      comment*: cstring
      dir*: cstring
      mbminlen*: cuint
      mbmaxlen*: cuint

    CHARSET_INFO = Charset_info_st

    Charset_info_st {.final.} = object
      number*: cuint
      primary_number*: cuint
      binary_number*: cuint
      state*: cuint
      csname*: cstring
      name*: cstring
      comment*: cstring
      tailoring*: cstring
      ftype*: cstring
      to_lower*: cstring
      to_upper*: cstring
      sort_order*: cstring
      contractions*: ptr int16
      sort_order_big*: ptr ptr int16
      tab_to_uni*: ptr int16
      tab_from_uni*: pointer
      state_map*: cstring
      ident_map*: cstring
      strxfrm_multiply*: cuint
      mbminlen*: cuint
      mbmaxlen*: cuint
      min_sort_char*: int16
      max_sort_char*: int16
      escape_with_backslash_is_dangerous*: my_bool
      cset*: pointer
      coll*: pointer

    cuint = cint

    DATA = St_mysql_data

    DYNAMIC_ARRAY = St_dynamic_array

    Enum_cursor_type = enum
      CURSOR_TYPE_NO_CURSOR = 0, CURSOR_TYPE_READ_ONLY = 1,
      CURSOR_TYPE_FOR_UPDATE = 2, CURSOR_TYPE_SCROLLABLE = 4

    Enum_field_types = enum
      TYPE_DECIMAL, TYPE_TINY, TYPE_SHORT, TYPE_LONG, TYPE_FLOAT, TYPE_DOUBLE,
      TYPE_NULL, TYPE_TIMESTAMP, TYPE_LONGLONG, TYPE_INT24, TYPE_DATE, TYPE_TIME,
      TYPE_DATETIME, TYPE_YEAR, TYPE_NEWDATE, TYPE_VARCHAR, TYPE_BIT,
      TYPE_NEWDECIMAL = 246, TYPE_ENUM = 247, TYPE_SET = 248, TYPE_TINY_BLOB = 249,
      TYPE_MEDIUM_BLOB = 250, TYPE_LONG_BLOB = 251, TYPE_BLOB = 252,
      TYPE_VAR_STRING = 253, TYPE_STRING = 254, TYPE_GEOMETRY = 255

    Enum_mysql_set_option = enum
      OPTION_MULTI_STATEMENTS_ON, OPTION_MULTI_STATEMENTS_OFF

    Enum_mysql_stmt_state = enum
      STMT_INIT_DONE = 1, STMT_PREPARE_DONE, STMT_EXECUTE_DONE, STMT_FETCH_DONE

    Enum_server_command = enum
      COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST, COM_CREATE_DB,
      COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS, COM_PROCESS_INFO,
      COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING, COM_TIME,
      COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP, COM_TABLE_DUMP,
      COM_CONNECT_OUT, COM_REGISTER_SLAVE, COM_STMT_PREPARE, COM_STMT_EXECUTE,
      COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE, COM_STMT_RESET, COM_SET_OPTION,
      COM_STMT_FETCH, COM_END

    Enum_shutdown_level = enum
      SHUTDOWN_DEFAULT = 0, SHUTDOWN_WAIT_CONNECTIONS = 1,
      SHUTDOWN_WAIT_TRANSACTIONS = 2, SHUTDOWN_WAIT_UPDATES = 8,
      SHUTDOWN_WAIT_ALL_BUFFERS = 16, SHUTDOWN_WAIT_CRITICAL_BUFFERS = 17,
      KILL_QUERY = 254, KILL_CONNECTION = 255

    Enum_stmt_attr_type = enum
      STMT_ATTR_UPDATE_MAX_LENGTH, STMT_ATTR_CURSOR_TYPE, STMT_ATTR_PREFETCH_ROWS

    FIELD = St_mysql_field

    FIELD_OFFSET = cuint

    gptr = cstring

    Item_result = enum
      STRING_RESULT, REAL_RESULT, INT_RESULT, ROW_RESULT, DECIMAL_RESULT

    MANAGER = St_mysql_manager

    MEM_ROOT = St_mem_root

    METHODS = St_mysql_methods

    my_bool = bool

    MY_CHARSET_INFO = Character_set

    my_socket = cint

    my_ulonglong = int64

    MySQL = St_mysql

    NET = St_net

    Option = enum
      OPT_CONNECT_TIMEOUT, OPT_COMPRESS, OPT_NAMED_PIPE, INIT_COMMAND,
      READ_DEFAULT_FILE, READ_DEFAULT_GROUP, SET_CHARSET_DIR, SET_CHARSET_NAME,
      OPT_LOCAL_INFILE, OPT_PROTOCOL, SHARED_MEMORY_BASE_NAME, OPT_READ_TIMEOUT,
      OPT_WRITE_TIMEOUT, OPT_USE_RESULT, OPT_USE_REMOTE_CONNECTION,
      OPT_USE_EMBEDDED_CONNECTION, OPT_GUESS_CONNECTION, SET_CLIENT_IP, SECURE_AUTH,
      REPORT_DATA_TRUNCATION, OPT_RECONNECT

    PARAMETERS = St_mysql_parameters

    PBIND = ptr BIND

    Pcharacter_set = ptr Character_set

    Pcharset_info_st = ptr Charset_info_st

    PDATA = ptr DATA

    PFIELD = ptr FIELD

    PFIELD_OFFSET = ptr FIELD_OFFSET

    Pgptr = ptr gptr

    PItem_result = ptr Item_result

    PMANAGER = ptr MANAGER

    PMEM_ROOT = ptr MEM_ROOT

    PMETHODS = ptr METHODS

    Pmy_bool = ptr my_bool

    PMY_CHARSET_INFO = ptr MY_CHARSET_INFO

    Pmy_socket = ptr my_socket

    Pmy_ulonglong = ptr my_ulonglong

    PMySQL = ptr MySQL

    PNET = ptr NET

    PPARAMETERS = ptr PARAMETERS

    PPByte = pointer

    Prand_struct = ptr Rand_struct

    PRES = ptr RES

    Protocol_type = enum
      PROTOCOL_DEFAULT, PROTOCOL_TCP, PROTOCOL_SOCKET, PROTOCOL_PIPE,
      PROTOCOL_MEMORY

    PROW = ptr ROW

    PROW_OFFSET = ptr ROW_OFFSET

    PROWS = ptr ROWS

    Psockaddr = ptr Sockaddr

    Pst_dynamic_array = ptr St_dynamic_array

    Pst_mem_root = ptr St_mem_root

    Pst_mysql = ptr St_mysql

    Pst_mysql_bind = ptr St_mysql_bind

    Pst_mysql_data = ptr St_mysql_data

    Pst_mysql_field = ptr St_mysql_field

    Pst_mysql_manager = ptr St_mysql_manager

    Pst_mysql_methods = ptr St_mysql_methods

    Pst_mysql_options = ptr St_mysql_options

    Pst_mysql_parameters = ptr St_mysql_parameters

    Pst_mysql_res = ptr St_mysql_res

    Pst_mysql_rows = ptr St_mysql_rows

    Pst_mysql_stmt = ptr St_mysql_stmt

    Pst_net = ptr St_net

    Pst_udf_args = ptr St_udf_args

    Pst_udf_init = ptr St_udf_init

    Pst_used_mem = ptr St_used_mem

    PSTMT = ptr STMT

    PUDF_ARGS = ptr UDF_ARGS

    PUDF_INIT = ptr UDF_INIT

    PUSED_MEM = ptr USED_MEM

    PVIO = pointer

    Rand_struct {.final.} = object
      seed1*: int
      seed2*: int
      max_value*: int
      max_value_dbl*: cdouble

    RES = St_mysql_res

    ROW = cstringArray

    ROW_OFFSET = ROWS

    ROWS = St_mysql_rows

    Rpl_type = enum
      RPL_MASTER, RPL_SLAVE, RPL_ADMIN

    Sockaddr {.final.} = object

    St_dynamic_array {.final.} = object
      buffer*: cstring
      elements*: cuint
      max_element*: cuint
      alloc_increment*: cuint
      size_of_element*: cuint

    St_mem_root {.final.} = object
      free*: PUSED_MEM
      used*: PUSED_MEM
      pre_alloc*: PUSED_MEM
      min_malloc*: cuint
      block_size*: cuint
      block_num*: cuint
      first_block_usage*: cuint
      error_handler*: proc () {.cdecl.}

    St_mysql {.final.} = object
      net*: NET
      connector_fd*: gptr
      host*: cstring
      user*: cstring
      passwd*: cstring
      unix_socket*: cstring
      server_version*: cstring
      host_info*: cstring
      info*: cstring
      db*: cstring
      charset*: Pcharset_info_st
      fields*: PFIELD
      field_alloc*: MEM_ROOT
      affected_rows*: my_ulonglong
      insert_id*: my_ulonglong
      extra_info*: my_ulonglong
      thread_id*: int
      packet_length*: int
      port*: cuint
      client_flag*: int
      server_capabilities*: int
      protocol_version*: cuint
      field_count*: cuint
      server_status*: cuint
      server_language*: cuint
      warning_count*: cuint
      options*: St_mysql_options
      status*: Status
      free_me*: my_bool
      reconnect*: my_bool
      scramble*: array[0 .. 21 - 1, char]
      rpl_pivot*: my_bool
      master*: Pst_mysql
      next_slave*: Pst_mysql
      last_used_slave*: Pst_mysql
      last_used_con*: Pst_mysql
      stmts*: pointer
      methods*: Pst_mysql_methods
      thd*: pointer
      unbuffered_fetch_owner*: Pmy_bool

    St_mysql_bind {.final.} = object
      len*: int
      is_null*: Pmy_bool
      buffer*: pointer
      error*: Pmy_bool
      buffer_type*: Enum_field_types
      buffer_length*: int
      row_ptr*: ptr byte
      offset*: int
      length_value*: int
      param_number*: cuint
      pack_length*: cuint
      error_value*: my_bool
      is_unsigned*: my_bool
      long_data_used*: my_bool
      is_null_value*: my_bool
      store_param_func*: proc (net: PNET; param: Pst_mysql_bind) {.cdecl.}
      fetch_result*: proc (para1: Pst_mysql_bind; para2: PFIELD; row: PPByte)
      skip_result*: proc (para1: Pst_mysql_bind; para2: PFIELD; row: PPByte)

    St_mysql_data {.final.} = object
      rows*: my_ulonglong
      fields*: cuint
      data*: PROWS
      alloc*: MEM_ROOT
      prev_ptr*: ptr PROWS

    St_mysql_field {.final.} = object
      name*: cstring
      org_name*: cstring
      table*: cstring
      org_table*: cstring
      db*: cstring
      catalog*: cstring
      def*: cstring
      len*: int
      max_length*: int
      name_length*: cuint
      org_name_length*: cuint
      table_length*: cuint
      org_table_length*: cuint
      db_length*: cuint
      catalog_length*: cuint
      def_length*: cuint
      flags*: cuint
      decimals*: cuint
      charsetnr*: cuint
      ftype*: Enum_field_types
      extension*: pointer

    St_mysql_manager {.final.} = object
      net*: NET
      host*: cstring
      user*: cstring
      passwd*: cstring
      port*: cuint
      free_me*: my_bool
      eof*: my_bool
      cmd_status*: cint
      last_errno*: cint
      net_buf*: cstring
      net_buf_pos*: cstring
      net_data_end*: cstring
      net_buf_size*: cint
      last_error*: array[0 .. 256 - 1, char]

    St_mysql_methods {.final.} = object
      read_query_result*: proc (MySQL: PMySQL): my_bool {.cdecl.}
      advanced_command*: proc (MySQL: PMySQL; command: Enum_server_command;
                               header: cstring; header_length: int; arg: cstring;
                               arg_length: int; skip_check: my_bool): my_bool
      read_rows*: proc (MySQL: PMySQL; fields: PFIELD; fields_count: cuint): PDATA
      use_result*: proc (MySQL: PMySQL): PRES
      fetch_lengths*: proc (fto: ptr int; column: ROW; field_count: cuint)
      flush_use_result*: proc (MySQL: PMySQL)
      list_fields*: proc (MySQL: PMySQL): PFIELD
      read_prepare_result*: proc (MySQL: PMySQL; stmt: PSTMT): my_bool
      stmt_execute*: proc (stmt: PSTMT): cint
      read_binary_rows*: proc (stmt: PSTMT): cint
      unbuffered_fetch*: proc (MySQL: PMySQL; row: cstringArray): cint
      free_embedded_thd*: proc (MySQL: PMySQL)
      read_statistics*: proc (MySQL: PMySQL): cstring
      next_result*: proc (MySQL: PMySQL): my_bool
      read_change_user_result*: proc (MySQL: PMySQL; buff: cstring; passwd: cstring): cint
      read_rowsfrom_cursor*: proc (stmt: PSTMT): cint

    St_mysql_options {.final.} = object
      connect_timeout*: cuint
      read_timeout*: cuint
      write_timeout*: cuint
      port*: cuint
      protocol*: cuint
      client_flag*: int
      host*: cstring
      user*: cstring
      password*: cstring
      unix_socket*: cstring
      db*: cstring
      init_commands*: Pst_dynamic_array
      my_cnf_file*: cstring
      my_cnf_group*: cstring
      charset_dir*: cstring
      charset_name*: cstring
      ssl_key*: cstring
      ssl_cert*: cstring
      ssl_ca*: cstring
      ssl_capath*: cstring
      ssl_cipher*: cstring
      shared_memory_base_name*: cstring
      max_allowed_packet*: int
      use_ssl*: my_bool
      compress*: my_bool
      named_pipe*: my_bool
      rpl_probe*: my_bool
      rpl_parse*: my_bool
      no_master_reads*: my_bool
      separate_thread*: my_bool
      methods_to_use*: Option
      client_ip*: cstring
      secure_auth*: my_bool
      report_data_truncation*: my_bool
      local_infile_init*: proc (para1: var pointer; para2: cstring; para3: pointer): cint {.
          cdecl.}
      local_infile_read*: proc (para1: pointer; para2: cstring; para3: cuint): cint
      local_infile_end*: proc (para1: pointer)
      local_infile_error*: proc (para1: pointer; para2: cstring; para3: cuint): cint
      local_infile_userdata*: pointer

    St_mysql_parameters {.final.} = object
      p_max_allowed_packet*: ptr int
      p_net_buffer_length*: ptr int

    St_mysql_res {.final.} = object
      row_count*: my_ulonglong
      fields*: PFIELD
      data*: PDATA
      data_cursor*: PROWS
      lengths*: ptr int
      handle*: PMySQL
      field_alloc*: MEM_ROOT
      field_count*: cuint
      current_field*: cuint
      row*: ROW
      current_row*: ROW
      eof*: my_bool
      unbuffered_fetch_cancelled*: my_bool
      methods*: Pst_mysql_methods

    St_mysql_rows {.final.} = object
      next*: Pst_mysql_rows
      data*: ROW
      len*: int

    St_mysql_stmt {.final.} = object
      mem_root*: MEM_ROOT
      mysql*: PMySQL
      params*: PBIND
      fields*: PFIELD
      result*: DATA
      data_cursor*: PROWS
      affected_rows*: my_ulonglong
      insert_id*: my_ulonglong
      read_row_func*: proc (stmt: Pst_mysql_stmt; row: PPByte): cint {.cdecl.}
      stmt_id*: int
      flags*: int
      prefetch_rows*: int
      server_status*: cuint
      last_errno*: cuint
      param_count*: cuint
      field_count*: cuint
      state*: Enum_mysql_stmt_state
      last_error*: array[0 .. 200 - 1, char]
      sqlstate*: array[0 .. 6 - 1, char]
      send_types_to_server*: my_bool
      bind_param_done*: my_bool
      bind_result_done*: char
      unbuffered_fetch_cancelled*: my_bool
      update_max_length*: my_bool

    St_net {.final.} = object
      vio*: PVIO
      buff*: cstring
      buff_end*: cstring
      write_pos*: cstring
      read_pos*: cstring
      fd*: my_socket
      max_packet*: int
      max_packet_size*: int
      pkt_nr*: cuint
      compress_pkt_nr*: cuint
      write_timeout*: cuint
      read_timeout*: cuint
      retry_count*: cuint
      fcntl*: cint
      compress*: my_bool
      remain_in_buf*: int
      len*: int
      buf_length*: int
      where_b*: int
      return_status*: ptr cint
      reading_or_writing*: char
      save_char*: cchar
      no_send_ok*: my_bool
      no_send_eof*: my_bool
      no_send_error*: my_bool
      last_error*: array[0 .. 200 - 1, char]
      sqlstate*: array[0 .. 6 - 1, char]
      last_errno*: cuint
      error*: char
      query_cache_query*: gptr
      report_error*: my_bool
      return_errno*: my_bool

    St_udf_args {.final.} = object
      arg_count*: cuint
      arg_type*: PItem_result
      args*: cstringArray
      lengths*: ptr int
      maybe_null*: cstring
      attributes*: cstringArray
      attribute_lengths*: ptr int

    St_udf_init {.final.} = object
      maybe_null*: my_bool
      decimals*: cuint
      max_length*: int
      theptr*: cstring
      const_item*: my_bool

    St_used_mem {.final.} = object
      next*: Pst_used_mem
      left*: cuint
      size*: cuint

    Status = enum
      STATUS_READY, STATUS_GET_RESULT, STATUS_USE_RESULT

    STMT = St_mysql_stmt

    UDF_ARGS = St_udf_args

    UDF_INIT = St_udf_init

    USED_MEM = St_used_mem

# Consts

    ALLOC_MAX_BLOCK_TO_DROP = 4096

    ALLOC_MAX_BLOCK_USAGE_BEFORE_DROP = 10

    AUTO_INCREMENT_FLAG = 512

    BINARY_FLAG = 128

    BINCMP_FLAG = 131072

    BLOB_FLAG = 16

    CLIENT_COMPRESS = 32

    CLIENT_CONNECT_WITH_DB = 8

    CLIENT_FOUND_ROWS = 2

    CLIENT_IGNORE_SIGPIPE = 4096

    CLIENT_IGNORE_SPACE = 256

    CLIENT_INTERACTIVE = 1024

    CLIENT_LOCAL_FILES = 128

    CLIENT_LONG_FLAG = 4

    CLIENT_LONG_PASSWORD = 1

    CLIENT_MULTI_QUERIES = 65536

    CLIENT_MULTI_RESULTS = 131072

    CLIENT_MULTI_STATEMENTS = 65536

    CLIENT_NET_READ_TIMEOUT = 31536000

    CLIENT_NET_WRITE_TIMEOUT = 31536000

    CLIENT_NO_SCHEMA = 16

    CLIENT_ODBC = 64

    CLIENT_PROTOCOL_41 = 512

    CLIENT_REMEMBER_OPTIONS: int = -2147483648

    CLIENT_RESERVED = 16384

    CLIENT_SECURE_CONNECTION = 32768

    CLIENT_SSL = 2048

    CLIENT_TRANSACTIONS = 8192

    COMP_HEADER_SIZE = 3

    COUNT_ERROR = -1'i64

    DATA_TRUNCATED = 101

    ENUM_FLAG = 256

    ERRMSG_SIZE = 200

    FIELD_TYPE_BIT = TYPE_BIT

    FIELD_TYPE_BLOB = TYPE_BLOB

    FIELD_TYPE_CHAR = TYPE_TINY

    FIELD_TYPE_DATE = TYPE_DATE

    FIELD_TYPE_DATETIME = TYPE_DATETIME

    FIELD_TYPE_DECIMAL = TYPE_DECIMAL

    FIELD_TYPE_DOUBLE = TYPE_DOUBLE

    FIELD_TYPE_ENUM = TYPE_ENUM

    FIELD_TYPE_FLOAT = TYPE_FLOAT

    FIELD_TYPE_GEOMETRY = TYPE_GEOMETRY

    FIELD_TYPE_INT24 = TYPE_INT24

    FIELD_TYPE_INTERVAL = TYPE_ENUM

    FIELD_TYPE_LONG = TYPE_LONG

    FIELD_TYPE_LONG_BLOB = TYPE_LONG_BLOB

    FIELD_TYPE_LONGLONG = TYPE_LONGLONG

    FIELD_TYPE_MEDIUM_BLOB = TYPE_MEDIUM_BLOB

    FIELD_TYPE_NEWDATE = TYPE_NEWDATE

    FIELD_TYPE_NEWDECIMAL = TYPE_NEWDECIMAL

    FIELD_TYPE_NULL = TYPE_NULL

    FIELD_TYPE_SET = TYPE_SET

    FIELD_TYPE_SHORT = TYPE_SHORT

    FIELD_TYPE_STRING = TYPE_STRING

    FIELD_TYPE_TIME = TYPE_TIME

    FIELD_TYPE_TIMESTAMP = TYPE_TIMESTAMP

    FIELD_TYPE_TINY = TYPE_TINY

    FIELD_TYPE_TINY_BLOB = TYPE_TINY_BLOB

    FIELD_TYPE_VAR_STRING = TYPE_VAR_STRING

    FIELD_TYPE_YEAR = TYPE_YEAR

    GROUP_FLAG = 32768

    HOSTNAME_LENGTH = 60

    LOCAL_HOST = "localhost"

    LOCAL_HOST_NAMEDPIPE = '.'

    LOCAL_INFILE_ERROR_LEN = 512

    LONG_DATA_HEADER = 6

    MANAGER_ACCESS = 401

    MANAGER_CLIENT_ERR = 450

    MANAGER_INFO = 250

    MANAGER_INTERNAL_ERR = 500

    MANAGER_OK = 200

    MAX_BIGINT_WIDTH = 20

    MAX_BLOB_WIDTH = 8192

    MAX_CHAR_WIDTH = 255

    MAX_INT_WIDTH = 10

    MAX_MEDIUMINT_WIDTH = 8

    MAX_MYSQL_MANAGER_ERR = 256

    MAX_MYSQL_MANAGER_MSG = 256

    MAX_SMALLINT_WIDTH = 5

    MAX_TINYINT_WIDTH = 3

    MULTIPLE_KEY_FLAG = 8

    NAME_LEN = 64

    NAMEDPIPE = "MySQL"

    NET_HEADER_SIZE = 4

    NET_READ_TIMEOUT = 30

    NET_WAIT_TIMEOUT = 28800

    NET_WRITE_TIMEOUT = 60

    NO_DATA = 100

    NO_DEFAULT_VALUE_FLAG = 4096

    NOT_NULL_FLAG = 1

    NULL_LENGTH: int = -1

    NUM_FLAG = 32768

    ONLY_KILL_QUERY = 1

    packet_error = -1

    PART_KEY_FLAG = 16384

    PRI_KEY_FLAG = 2

    REFRESH_DES_KEY_FILE = 0x00040000

    REFRESH_FAST = 32768

    REFRESH_GRANT = 1

    REFRESH_HOSTS = 8

    REFRESH_LOG = 2

    REFRESH_MASTER = 128

    REFRESH_QUERY_CACHE = 65536

    REFRESH_QUERY_CACHE_FREE = 0x00020000

    REFRESH_READ_LOCK = 16384

    REFRESH_SLAVE = 64

    REFRESH_STATUS = 16

    REFRESH_TABLES = 4

    REFRESH_THREADS = 32

    REFRESH_USER_RESOURCES = 0x00080000

    SCRAMBLE_LENGTH = 20

    SCRAMBLE_LENGTH_323 = 8

    SCRAMBLED_PASSWORD_CHAR_LENGTH = 41

    SCRAMBLED_PASSWORD_CHAR_LENGTH_323 = 16

    SERVER_MORE_RESULTS_EXISTS = 8

    SERVER_QUERY_NO_GOOD_INDEX_USED = 16

    SERVER_QUERY_NO_INDEX_USED = 32

    SERVER_STATUS_AUTOCOMMIT = 2

    SERVER_STATUS_CURSOR_EXISTS = 64

    SERVER_STATUS_DB_DROPPED = 256

    SERVER_STATUS_IN_TRANS = 1

    SERVER_STATUS_LAST_ROW_SENT = 128

    SERVER_STATUS_MORE_RESULTS = 4

    SERVER_STATUS_NO_BACKSLASH_ESCAPES = 512

    SERVER_VERSION_LENGTH = 60

    SERVICENAME = "MySQL"

    SET_FLAG = 2048

    SHUTDOWN_KILLABLE_CONNECT = '\x01'

    SHUTDOWN_KILLABLE_LOCK_TABLE = '\x04'

    SHUTDOWN_KILLABLE_TRANS = '\x02'

    SHUTDOWN_KILLABLE_UPDATE = '\b'

    SQLSTATE_LENGTH = 5

    STMT_HEADER = 4

    TIMESTAMP_FLAG = 1024

    UNIQUE_FLAG = 65536

    UNIQUE_KEY_FLAG = 4

    UNSIGNED_FLAG = 32

    USERNAME_LENGTH = 16

    ZEROFILL_FLAG = 64

# Procs

    proc add_slave(MySQL: PMySQL; host: cstring; port: cuint; user: cstring;
                   passwd: cstring): cint {.stdcall, dynlib: lib,
                                            importc: "mysql_add_slave", ...raises: [],
                                            tags: [], forbids: [].}

    proc affected_rows(MySQL: PMySQL): my_ulonglong {.stdcall, dynlib: lib,
        importc: "mysql_affected_rows", ...raises: [], tags: [], forbids: [].}

    proc autocommit(MySQL: PMySQL; auto_mode: my_bool): my_bool {.stdcall,
        dynlib: lib, importc: "mysql_autocommit", ...raises: [], tags: [], forbids: [].}

    proc change_user(MySQL: PMySQL; user: cstring; passwd: cstring; db: cstring): my_bool {.
        stdcall, dynlib: lib, importc: "mysql_change_user", ...raises: [], tags: [],
        forbids: [].}

    proc character_set_name(MySQL: PMySQL): cstring {.stdcall, dynlib: lib,
        importc: "mysql_character_set_name", ...raises: [], tags: [], forbids: [].}

    proc check_scramble(reply: cstring; message: cstring; hash_stage2: pointer): my_bool {.
        cdecl, dynlib: lib, importc: "check_scramble", ...raises: [], tags: [],
        forbids: [].}

    proc check_scramble_323(para1: cstring; message: cstring; salt: int): my_bool {.
        cdecl, dynlib: lib, importc: "check_scramble_323", ...raises: [], tags: [],
        forbids: [].}

    proc close(sock: PMySQL) {.stdcall, dynlib: lib, importc: "mysql_close",
                               ...raises: [], tags: [], forbids: [].}

    proc commit(MySQL: PMySQL): my_bool {.stdcall, dynlib: lib,
                                          importc: "mysql_commit", ...raises: [],
                                          tags: [], forbids: [].}

    proc create_random_string(fto: cstring; len: cuint; rand_st: Prand_struct) {.
        cdecl, dynlib: lib, importc: "create_random_string", ...raises: [], tags: [],
        forbids: [].}

    proc data_seek(result: PRES; offset: my_ulonglong) {.stdcall, dynlib: lib,
        importc: "mysql_data_seek", ...raises: [], tags: [], forbids: [].}

    proc debug(debug: cstring) {.stdcall, dynlib: lib, importc: "mysql_debug",
                                 ...raises: [], tags: [], forbids: [].}

    proc disable_reads_from_master(MySQL: PMySQL) {.stdcall, dynlib: lib,
        importc: "mysql_disable_reads_from_master", ...raises: [], tags: [],
        forbids: [].}

    proc disable_rpl_parse(MySQL: PMySQL) {.stdcall, dynlib: lib,
                                            importc: "mysql_disable_rpl_parse",
                                            ...raises: [], tags: [], forbids: [].}

    proc dump_debug_info(MySQL: PMySQL): cint {.stdcall, dynlib: lib,
        importc: "mysql_dump_debug_info", ...raises: [], tags: [], forbids: [].}

    proc embedded(): my_bool {.stdcall, dynlib: lib, importc: "mysql_embedded",
                               ...raises: [], tags: [], forbids: [].}

    proc enable_reads_from_master(MySQL: PMySQL) {.stdcall, dynlib: lib,
        importc: "mysql_enable_reads_from_master", ...raises: [], tags: [], forbids: [].}

    proc enable_rpl_parse(MySQL: PMySQL) {.stdcall, dynlib: lib,
                                           importc: "mysql_enable_rpl_parse",
                                           ...raises: [], tags: [], forbids: [].}

    proc eof(res: PRES): my_bool {.stdcall, dynlib: lib, importc: "mysql_eof",
                                   ...raises: [], tags: [], forbids: [].}

    proc errno(MySQL: PMySQL): cuint {.stdcall, dynlib: lib, importc: "mysql_errno",
                                       ...raises: [], tags: [], forbids: [].}

    proc errno_to_sqlstate(errno: cuint): cstring {.cdecl, dynlib: lib,
        importc: "mysql_errno_to_sqlstate", ...raises: [], tags: [], forbids: [].}

    proc error(MySQL: PMySQL): cstring {.stdcall, dynlib: lib,
                                         importc: "mysql_error", ...raises: [],
                                         tags: [], forbids: [].}

    proc escape_string(fto: cstring; from: cstring; from_length: int): int {.
        stdcall, dynlib: lib, importc: "mysql_escape_string", ...raises: [], tags: [],
        forbids: [].}

    proc fetch_field(result: PRES): PFIELD {.stdcall, dynlib: lib,
        importc: "mysql_fetch_field", ...raises: [], tags: [], forbids: [].}

    proc fetch_field_direct(res: PRES; fieldnr: cuint): PFIELD {.stdcall,
        dynlib: lib, importc: "mysql_fetch_field_direct", ...raises: [], tags: [],
        forbids: [].}

    proc fetch_fields(res: PRES): PFIELD {.stdcall, dynlib: lib,
                                           importc: "mysql_fetch_fields",
                                           ...raises: [], tags: [], forbids: [].}

    proc fetch_lengths(result: PRES): ptr int {.stdcall, dynlib: lib,
        importc: "mysql_fetch_lengths", ...raises: [], tags: [], forbids: [].}

    proc fetch_row(result: PRES): ROW {.stdcall, dynlib: lib,
                                        importc: "mysql_fetch_row", ...raises: [],
                                        tags: [], forbids: [].}

    proc field_count(MySQL: PMySQL): cuint {.stdcall, dynlib: lib,
        importc: "mysql_field_count", ...raises: [], tags: [], forbids: [].}

    proc field_seek(result: PRES; offset: FIELD_OFFSET): FIELD_OFFSET {.stdcall,
        dynlib: lib, importc: "mysql_field_seek", ...raises: [], tags: [], forbids: [].}

    proc field_tell(res: PRES): FIELD_OFFSET {.stdcall, dynlib: lib,
        importc: "mysql_field_tell", ...raises: [], tags: [], forbids: [].}

    proc free_result(result: PRES) {.stdcall, dynlib: lib,
                                     importc: "mysql_free_result", ...raises: [],
                                     tags: [], forbids: [].}

    proc get_character_set_info(MySQL: PMySQL; charset: PMY_CHARSET_INFO) {.stdcall,
        dynlib: lib, importc: "mysql_get_character_set_info", ...raises: [], tags: [],
        forbids: [].}

    proc get_client_info(): cstring {.stdcall, dynlib: lib,
                                      importc: "mysql_get_client_info", ...raises: [],
                                      tags: [], forbids: [].}

    proc get_client_version(): int {.stdcall, dynlib: lib,
                                     importc: "mysql_get_client_version",
                                     ...raises: [], tags: [], forbids: [].}

    proc get_host_info(MySQL: PMySQL): cstring {.stdcall, dynlib: lib,
        importc: "mysql_get_host_info", ...raises: [], tags: [], forbids: [].}

    proc get_parameters(): PPARAMETERS {.stdcall, dynlib: lib,
                                         importc: "mysql_get_parameters",
                                         ...raises: [], tags: [], forbids: [].}

    proc get_proto_info(MySQL: PMySQL): cuint {.stdcall, dynlib: lib,
        importc: "mysql_get_proto_info", ...raises: [], tags: [], forbids: [].}

    proc get_salt_from_password(res: pointer; password: cstring) {.cdecl,
        dynlib: lib, importc: "get_salt_from_password", ...raises: [], tags: [],
        forbids: [].}

    proc get_salt_from_password_323(res: ptr int; password: cstring) {.cdecl,
        dynlib: lib, importc: "get_salt_from_password_323", ...raises: [], tags: [],
        forbids: [].}

    proc get_server_info(MySQL: PMySQL): cstring {.stdcall, dynlib: lib,
        importc: "mysql_get_server_info", ...raises: [], tags: [], forbids: [].}

    proc get_server_version(MySQL: PMySQL): int {.stdcall, dynlib: lib,
        importc: "mysql_get_server_version", ...raises: [], tags: [], forbids: [].}

    proc get_tty_password(opt_message: cstring): cstring {.cdecl, dynlib: lib,
        importc: "get_tty_password", ...raises: [], tags: [], forbids: [].}

    proc hash_password(fto: int; password: cstring; password_len: cuint) {.cdecl,
        dynlib: lib, importc: "hash_password", ...raises: [], tags: [], forbids: [].}

    proc hex_string(fto: cstring; from: cstring; from_length: int): int {.stdcall,
        dynlib: lib, importc: "mysql_hex_string", ...raises: [], tags: [], forbids: [].}

    proc info(MySQL: PMySQL): cstring {.stdcall, dynlib: lib, importc: "mysql_info",
                                        ...raises: [], tags: [], forbids: [].}

    proc init(MySQL: PMySQL): PMySQL {.stdcall, dynlib: lib, importc: "mysql_init",
                                       ...raises: [], tags: [], forbids: [].}

    proc insert_id(MySQL: PMySQL): my_ulonglong {.stdcall, dynlib: lib,
        importc: "mysql_insert_id", ...raises: [], tags: [], forbids: [].}

    proc INTERNAL_NUM_FIELD(f: Pst_mysql_field): bool {....raises: [], tags: [],
        forbids: [].}

    proc IS_BLOB(n: int32): bool {....raises: [], tags: [], forbids: [].}

    proc IS_NOT_NULL(n: int32): bool {....raises: [], tags: [], forbids: [].}

    proc IS_NUM(t: Enum_field_types): bool {....raises: [], tags: [], forbids: [].}

    proc IS_NUM_FIELD(f: Pst_mysql_field): bool {....raises: [], tags: [], forbids: [].}

    proc IS_PRI_KEY(n: int32): bool {....raises: [], tags: [], forbids: [].}

    proc kill(MySQL: PMySQL; pid: int): cint {.stdcall, dynlib: lib,
        importc: "mysql_kill", ...raises: [], tags: [], forbids: [].}

    proc library_end() {.cdecl, dynlib: lib, importc: "mysql_server_end",
                         ...raises: [], tags: [], forbids: [].}

    proc library_init(argc: cint; argv: cstringArray; groups: cstringArray): cint {.
        cdecl, dynlib: lib, importc: "mysql_server_init", ...raises: [], tags: [],
        forbids: [].}

    proc list_dbs(MySQL: PMySQL; wild: cstring): PRES {.stdcall, dynlib: lib,
        importc: "mysql_list_dbs", ...raises: [], tags: [], forbids: [].}

    proc list_fields(MySQL: PMySQL; table: cstring; wild: cstring): PRES {.stdcall,
        dynlib: lib, importc: "mysql_list_fields", ...raises: [], tags: [], forbids: [].}

    proc list_processes(MySQL: PMySQL): PRES {.stdcall, dynlib: lib,
        importc: "mysql_list_processes", ...raises: [], tags: [], forbids: [].}

    proc list_tables(MySQL: PMySQL; wild: cstring): PRES {.stdcall, dynlib: lib,
        importc: "mysql_list_tables", ...raises: [], tags: [], forbids: [].}

    proc load_defaults(conf_file: cstring; groups: cstringArray; argc: ptr cint;
                       argv: ptr cstringArray): cint {.cdecl, dynlib: lib,
        importc: "load_defaults", ...raises: [], tags: [], forbids: [].}

    proc make_password_from_salt(fto: cstring; hash_stage2: pointer) {.cdecl,
        dynlib: lib, importc: "make_password_from_salt", ...raises: [], tags: [],
        forbids: [].}

    proc make_password_from_salt_323(fto: cstring; salt: ptr int) {.cdecl,
        dynlib: lib, importc: "make_password_from_salt_323", ...raises: [], tags: [],
        forbids: [].}

    proc make_scrambled_password(fto: cstring; password: cstring) {.cdecl,
        dynlib: lib, importc: "make_scrambled_password", ...raises: [], tags: [],
        forbids: [].}

    proc make_scrambled_password_323(fto: cstring; password: cstring) {.cdecl,
        dynlib: lib, importc: "make_scrambled_password_323", ...raises: [], tags: [],
        forbids: [].}

    proc manager_close(con: PMANAGER) {.stdcall, dynlib: lib,
                                        importc: "mysql_manager_close", ...raises: [],
                                        tags: [], forbids: [].}

    proc manager_command(con: PMANAGER; cmd: cstring; cmd_len: cint): cint {.
        stdcall, dynlib: lib, importc: "mysql_manager_command", ...raises: [],
        tags: [], forbids: [].}

    proc manager_connect(con: PMANAGER; host: cstring; user: cstring;
                         passwd: cstring; port: cuint): PMANAGER {.stdcall,
        dynlib: lib, importc: "mysql_manager_connect", ...raises: [], tags: [],
        forbids: [].}

    proc manager_fetch_line(con: PMANAGER; res_buf: cstring; res_buf_size: cint): cint {.
        stdcall, dynlib: lib, importc: "mysql_manager_fetch_line", ...raises: [],
        tags: [], forbids: [].}

    proc manager_init(con: PMANAGER): PMANAGER {.stdcall, dynlib: lib,
        importc: "mysql_manager_init", ...raises: [], tags: [], forbids: [].}

    proc master_query(MySQL: PMySQL; q: cstring; len: int): my_bool {.stdcall,
        dynlib: lib, importc: "mysql_master_query", ...raises: [], tags: [],
        forbids: [].}

    proc master_send_query(MySQL: PMySQL; q: cstring; len: int): my_bool {.stdcall,
        dynlib: lib, importc: "mysql_master_send_query", ...raises: [], tags: [],
        forbids: [].}

    proc modify_defaults_file(file_location: cstring; option: cstring;
                              option_value: cstring; section_name: cstring;
                              remove_option: cint): cint {.cdecl, dynlib: lib,
        importc: "load_defaults", ...raises: [], tags: [], forbids: [].}

    proc more_results(MySQL: PMySQL): my_bool {.stdcall, dynlib: lib,
        importc: "mysql_more_results", ...raises: [], tags: [], forbids: [].}

    proc my_connect(s: my_socket; name: Psockaddr; namelen: cuint; timeout: cuint): cint {.
        cdecl, dynlib: lib, importc: "my_connect", ...raises: [], tags: [], forbids: [].}

    proc my_init(): my_bool {.cdecl, dynlib: lib, importc: "my_init", ...raises: [],
                              tags: [], forbids: [].}

    proc my_net_init(net: PNET; vio: PVIO): my_bool {.cdecl, dynlib: lib,
        importc: "my_net_init", ...raises: [], tags: [], forbids: [].}

    proc my_net_local_init(net: PNET) {.cdecl, dynlib: lib,
                                        importc: "my_net_local_init", ...raises: [],
                                        tags: [], forbids: [].}

    proc my_net_read(net: PNET): int {.cdecl, dynlib: lib, importc: "my_net_read",
                                       ...raises: [], tags: [], forbids: [].}

    proc my_net_write(net: PNET; packet: cstring; length: int): my_bool {.cdecl,
        dynlib: lib, importc: "my_net_write", ...raises: [], tags: [], forbids: [].}

    proc my_rnd(para1: Prand_struct): cdouble {.cdecl, dynlib: lib,
        importc: "my_rnd", ...raises: [], tags: [], forbids: [].}

    proc my_thread_end() {.cdecl, dynlib: lib, importc: "my_thread_end", ...raises: [],
                           tags: [], forbids: [].}

    proc my_thread_init(): my_bool {.cdecl, dynlib: lib, importc: "my_thread_init",
                                     ...raises: [], tags: [], forbids: [].}

    proc myodbc_remove_escape(MySQL: PMySQL; name: cstring) {.stdcall, dynlib: lib,
        importc: "myodbc_remove_escape", ...raises: [], tags: [], forbids: [].}

    proc net_clear(net: PNET) {.cdecl, dynlib: lib, importc: "net_clear",
                                ...raises: [], tags: [], forbids: [].}

    proc net_end(net: PNET) {.cdecl, dynlib: lib, importc: "net_end", ...raises: [],
                              tags: [], forbids: [].}

    proc net_flush(net: PNET): my_bool {.cdecl, dynlib: lib, importc: "net_flush",
                                         ...raises: [], tags: [], forbids: [].}

    proc net_real_write(net: PNET; packet: cstring; length: int): cint {.cdecl,
        dynlib: lib, importc: "net_real_write", ...raises: [], tags: [], forbids: [].}

    proc net_realloc(net: PNET; len: int): my_bool {.cdecl, dynlib: lib,
        importc: "net_realloc", ...raises: [], tags: [], forbids: [].}

    proc net_safe_read(MySQL: PMySQL): cuint {.cdecl, dynlib: lib,
        importc: "net_safe_read", ...raises: [], tags: [], forbids: [].}

    proc net_write_command(net: PNET; command: char; header: cstring; head_len: int;
                           packet: cstring; length: int): my_bool {.cdecl,
        dynlib: lib, importc: "net_write_command", ...raises: [], tags: [], forbids: [].}

    proc next_result(MySQL: PMySQL): cint {.stdcall, dynlib: lib,
                                            importc: "mysql_next_result",
                                            ...raises: [], tags: [], forbids: [].}

    proc num_fields(res: PRES): cuint {.stdcall, dynlib: lib,
                                        importc: "mysql_num_fields", ...raises: [],
                                        tags: [], forbids: [].}

    proc num_rows(res: PRES): my_ulonglong {.stdcall, dynlib: lib,
        importc: "mysql_num_rows", ...raises: [], tags: [], forbids: [].}

    proc octet2hex(fto: cstring; str: cstring; length: cuint): cstring {.cdecl,
        dynlib: lib, importc: "octet2hex", ...raises: [], tags: [], forbids: [].}

    proc options(MySQL: PMySQL; option: Option; arg: cstring): cint {.stdcall,
        dynlib: lib, importc: "mysql_options", ...raises: [], tags: [], forbids: [].}

    proc ping(MySQL: PMySQL): cint {.stdcall, dynlib: lib, importc: "mysql_ping",
                                     ...raises: [], tags: [], forbids: [].}

    proc query(MySQL: PMySQL; q: cstring): cint {.stdcall, dynlib: lib,
        importc: "mysql_query", ...raises: [], tags: [], forbids: [].}

    proc randominit(para1: Prand_struct; seed1: int; seed2: int) {.cdecl,
        dynlib: lib, importc: "randominit", ...raises: [], tags: [], forbids: [].}

    proc read_query_result(MySQL: PMySQL): my_bool {.stdcall, dynlib: lib,
        importc: "mysql_read_query_result", ...raises: [], tags: [], forbids: [].}

    proc reads_from_master_enabled(MySQL: PMySQL): my_bool {.stdcall, dynlib: lib,
        importc: "mysql_reads_from_master_enabled", ...raises: [], tags: [],
        forbids: [].}

    proc real_connect(MySQL: PMySQL; host: cstring; user: cstring; passwd: cstring;
                      db: cstring; port: cuint; unix_socket: cstring;
                      clientflag: int): PMySQL {.stdcall, dynlib: lib,
        importc: "mysql_real_connect", ...raises: [], tags: [], forbids: [].}

    proc real_escape_string(MySQL: PMySQL; fto: cstring; from: cstring; len: int): int {.
        stdcall, dynlib: lib, importc: "mysql_real_escape_string", ...raises: [],
        tags: [], forbids: [].}

    proc real_query(MySQL: PMySQL; q: cstring; len: int): cint {.stdcall,
        dynlib: lib, importc: "mysql_real_query", ...raises: [], tags: [], forbids: [].}

    proc refresh(sql: PMySQL; refresh_options: cuint): cint {.stdcall, dynlib: lib,
        importc: "mysql_refresh", ...raises: [], tags: [], forbids: [].}

    proc reload(x: PMySQL): cint {....raises: [], tags: [], forbids: [].}

    proc rollback(MySQL: PMySQL): my_bool {.stdcall, dynlib: lib,
                                            importc: "mysql_rollback", ...raises: [],
                                            tags: [], forbids: [].}

    proc row_seek(result: PRES; offset: ROW_OFFSET): ROW_OFFSET {.stdcall,
        dynlib: lib, importc: "mysql_row_seek", ...raises: [], tags: [], forbids: [].}

    proc row_tell(res: PRES): ROW_OFFSET {.stdcall, dynlib: lib,
                                           importc: "mysql_row_tell", ...raises: [],
                                           tags: [], forbids: [].}

    proc rpl_parse_enabled(MySQL: PMySQL): cint {.stdcall, dynlib: lib,
        importc: "mysql_rpl_parse_enabled", ...raises: [], tags: [], forbids: [].}

    proc rpl_probe(MySQL: PMySQL): my_bool {.stdcall, dynlib: lib,
        importc: "mysql_rpl_probe", ...raises: [], tags: [], forbids: [].}

    proc rpl_query_type(q: cstring; length: cint): Rpl_type {.stdcall, dynlib: lib,
        importc: "mysql_rpl_query_type", ...raises: [], tags: [], forbids: [].}

    proc scramble(fto: cstring; message: cstring; password: cstring) {.cdecl,
        dynlib: lib, importc: "scramble", ...raises: [], tags: [], forbids: [].}

    proc scramble_323(fto: cstring; message: cstring; password: cstring) {.cdecl,
        dynlib: lib, importc: "scramble_323", ...raises: [], tags: [], forbids: [].}

    proc select_db(MySQL: PMySQL; db: cstring): cint {.stdcall, dynlib: lib,
        importc: "mysql_select_db", ...raises: [], tags: [], forbids: [].}

    proc send_query(MySQL: PMySQL; q: cstring; len: int): cint {.stdcall,
        dynlib: lib, importc: "mysql_send_query", ...raises: [], tags: [], forbids: [].}

    proc server_end() {.cdecl, dynlib: lib, importc: "mysql_server_end", ...raises: [],
                        tags: [], forbids: [].}

    proc server_init(argc: cint; argv: cstringArray; groups: cstringArray): cint {.
        cdecl, dynlib: lib, importc: "mysql_server_init", ...raises: [], tags: [],
        forbids: [].}

    proc set_character_set(MySQL: PMySQL; csname: cstring): int32 {.stdcall,
        dynlib: lib, importc: "mysql_set_character_set", ...raises: [], tags: [],
        forbids: [].}

    proc set_local_infile_default(MySQL: PMySQL) {.cdecl, dynlib: lib,
        importc: "mysql_set_local_infile_default", ...raises: [], tags: [], forbids: [].}

    proc set_master(MySQL: PMySQL; host: cstring; port: cuint; user: cstring;
                    passwd: cstring): cint {.stdcall, dynlib: lib,
        importc: "mysql_set_master", ...raises: [], tags: [], forbids: [].}

    proc set_server_option(MySQL: PMySQL; option: Enum_mysql_set_option): cint {.
        stdcall, dynlib: lib, importc: "mysql_set_server_option", ...raises: [],
        tags: [], forbids: [].}

    proc shutdown(MySQL: PMySQL; shutdown_level: Enum_shutdown_level): cint {.
        stdcall, dynlib: lib, importc: "mysql_shutdown", ...raises: [], tags: [],
        forbids: [].}

    proc slave_query(MySQL: PMySQL; q: cstring; len: int): my_bool {.stdcall,
        dynlib: lib, importc: "mysql_slave_query", ...raises: [], tags: [], forbids: [].}

    proc slave_send_query(MySQL: PMySQL; q: cstring; len: int): my_bool {.stdcall,
        dynlib: lib, importc: "mysql_slave_send_query", ...raises: [], tags: [],
        forbids: [].}

    proc sqlstate(MySQL: PMySQL): cstring {.stdcall, dynlib: lib,
                                            importc: "mysql_sqlstate", ...raises: [],
                                            tags: [], forbids: [].}

    proc ssl_set(MySQL: PMySQL; key: cstring; cert: cstring; ca: cstring;
                 capath: cstring; cipher: cstring): my_bool {.stdcall, dynlib: lib,
        importc: "mysql_ssl_set", ...raises: [], tags: [], forbids: [].}

    proc stat(MySQL: PMySQL): cstring {.stdcall, dynlib: lib, importc: "mysql_stat",
                                        ...raises: [], tags: [], forbids: [].}

    proc stmt_affected_rows(stmt: PSTMT): my_ulonglong {.stdcall, dynlib: lib,
        importc: "mysql_stmt_affected_rows", ...raises: [], tags: [], forbids: [].}

    proc stmt_attr_get(stmt: PSTMT; attr_type: Enum_stmt_attr_type; attr: pointer): my_bool {.
        stdcall, dynlib: lib, importc: "mysql_stmt_attr_get", ...raises: [], tags: [],
        forbids: [].}

    proc stmt_attr_set(stmt: PSTMT; attr_type: Enum_stmt_attr_type; attr: pointer): my_bool {.
        stdcall, dynlib: lib, importc: "mysql_stmt_attr_set", ...raises: [], tags: [],
        forbids: [].}

    proc stmt_bind_param(stmt: PSTMT; bnd: PBIND): my_bool {.stdcall, dynlib: lib,
        importc: "mysql_stmt_bind_param", ...raises: [], tags: [], forbids: [].}

    proc stmt_bind_result(stmt: PSTMT; bnd: PBIND): my_bool {.stdcall, dynlib: lib,
        importc: "mysql_stmt_bind_result", ...raises: [], tags: [], forbids: [].}

    proc stmt_close(stmt: PSTMT): my_bool {.stdcall, dynlib: lib,
                                            importc: "mysql_stmt_close", ...raises: [],
                                            tags: [], forbids: [].}

    proc stmt_data_seek(stmt: PSTMT; offset: my_ulonglong) {.stdcall, dynlib: lib,
        importc: "mysql_stmt_data_seek", ...raises: [], tags: [], forbids: [].}

    proc stmt_errno(stmt: PSTMT): cuint {.stdcall, dynlib: lib,
                                          importc: "mysql_stmt_errno", ...raises: [],
                                          tags: [], forbids: [].}

    proc stmt_error(stmt: PSTMT): cstring {.stdcall, dynlib: lib,
                                            importc: "mysql_stmt_error", ...raises: [],
                                            tags: [], forbids: [].}

    proc stmt_execute(stmt: PSTMT): cint {.stdcall, dynlib: lib,
                                           importc: "mysql_stmt_execute",
                                           ...raises: [], tags: [], forbids: [].}

    proc stmt_fetch(stmt: PSTMT): cint {.stdcall, dynlib: lib,
                                         importc: "mysql_stmt_fetch", ...raises: [],
                                         tags: [], forbids: [].}

    proc stmt_fetch_column(stmt: PSTMT; bind: PBIND; column: cuint; offset: int): cint {.
        stdcall, dynlib: lib, importc: "mysql_stmt_fetch_column", ...raises: [],
        tags: [], forbids: [].}

    proc stmt_field_count(stmt: PSTMT): cuint {.stdcall, dynlib: lib,
        importc: "mysql_stmt_field_count", ...raises: [], tags: [], forbids: [].}

    proc stmt_free_result(stmt: PSTMT): my_bool {.stdcall, dynlib: lib,
        importc: "mysql_stmt_free_result", ...raises: [], tags: [], forbids: [].}

    proc stmt_init(MySQL: PMySQL): PSTMT {.stdcall, dynlib: lib,
                                           importc: "mysql_stmt_init", ...raises: [],
                                           tags: [], forbids: [].}

    proc stmt_insert_id(stmt: PSTMT): my_ulonglong {.stdcall, dynlib: lib,
        importc: "mysql_stmt_insert_id", ...raises: [], tags: [], forbids: [].}

    proc stmt_num_rows(stmt: PSTMT): my_ulonglong {.stdcall, dynlib: lib,
        importc: "mysql_stmt_num_rows", ...raises: [], tags: [], forbids: [].}

    proc stmt_param_count(stmt: PSTMT): int {.stdcall, dynlib: lib,
        importc: "mysql_stmt_param_count", ...raises: [], tags: [], forbids: [].}

    proc stmt_param_metadata(stmt: PSTMT): PRES {.stdcall, dynlib: lib,
        importc: "mysql_stmt_param_metadata", ...raises: [], tags: [], forbids: [].}

    proc stmt_prepare(stmt: PSTMT; query: cstring; len: int): cint {.stdcall,
        dynlib: lib, importc: "mysql_stmt_prepare", ...raises: [], tags: [],
        forbids: [].}

    proc stmt_reset(stmt: PSTMT): my_bool {.stdcall, dynlib: lib,
                                            importc: "mysql_stmt_reset", ...raises: [],
                                            tags: [], forbids: [].}

    proc stmt_result_metadata(stmt: PSTMT): PRES {.stdcall, dynlib: lib,
        importc: "mysql_stmt_result_metadata", ...raises: [], tags: [], forbids: [].}

    proc stmt_row_seek(stmt: PSTMT; offset: ROW_OFFSET): ROW_OFFSET {.stdcall,
        dynlib: lib, importc: "mysql_stmt_row_seek", ...raises: [], tags: [],
        forbids: [].}

    proc stmt_row_tell(stmt: PSTMT): ROW_OFFSET {.stdcall, dynlib: lib,
        importc: "mysql_stmt_row_tell", ...raises: [], tags: [], forbids: [].}

    proc stmt_send_long_data(stmt: PSTMT; param_number: cuint; data: cstring;
                             len: int): my_bool {.stdcall, dynlib: lib,
        importc: "mysql_stmt_send_long_data", ...raises: [], tags: [], forbids: [].}

    proc stmt_sqlstate(stmt: PSTMT): cstring {.stdcall, dynlib: lib,
        importc: "mysql_stmt_sqlstate", ...raises: [], tags: [], forbids: [].}

    proc stmt_store_result(stmt: PSTMT): cint {.stdcall, dynlib: lib,
        importc: "mysql_stmt_store_result", ...raises: [], tags: [], forbids: [].}

    proc store_result(MySQL: PMySQL): PRES {.stdcall, dynlib: lib,
        importc: "mysql_store_result", ...raises: [], tags: [], forbids: [].}

    proc thread_end() {.stdcall, dynlib: lib, importc: "mysql_thread_end",
                        ...raises: [], tags: [], forbids: [].}

    proc thread_id(MySQL: PMySQL): int {.stdcall, dynlib: lib,
                                         importc: "mysql_thread_id", ...raises: [],
                                         tags: [], forbids: [].}

    proc thread_init(): my_bool {.stdcall, dynlib: lib,
                                  importc: "mysql_thread_init", ...raises: [],
                                  tags: [], forbids: [].}

    proc thread_safe(): cuint {.stdcall, dynlib: lib, importc: "mysql_thread_safe",
                                ...raises: [], tags: [], forbids: [].}

    proc use_result(MySQL: PMySQL): PRES {.stdcall, dynlib: lib,
                                           importc: "mysql_use_result", ...raises: [],
                                           tags: [], forbids: [].}

    proc warning_count(MySQL: PMySQL): cuint {.stdcall, dynlib: lib,
        importc: "mysql_warning_count", ...raises: [], tags: [], forbids: [].}