<commit_before>@[Link("libmapi")]
lib MonetDBMAPI

# Constants
  _MAPI_H_INCLUDED = 1
  MAPI_AUTO	= 0	/* automatic type detection */
  MAPI_TINY	= 1
  MAPI_UTINY	= 2
  MAPI_SHORT	= 3
  MAPI_USHORT	= 4
  MAPI_INT	= 5
  MAPI_UINT	= 6
  MAPI_LONG	= 7
  MAPI_ULONG	= 8
  MAPI_LONGLONG	= 9
  MAPI_ULONGLONG = 10
  MAPI_CHAR	= 11
  MAPI_VARCHAR	= 12
  MAPI_FLOAT	= 13
  MAPI_DOUBLE	= 14
  MAPI_DATE	= 15
  MAPI_TIME	= 16
  MAPI_DATETIME	= 17
  MAPI_NUMERIC	= 18
  PLACEHOLDER	= "?"
  MAPI_SEEK_SET	= 0
  MAPI_SEEK_CUR	= 1
  MAPI_SEEK_END	= 2
  MAPI_TRACE	= 1
  MAPI_TRACE_LANG = 2
  MOK		= 0
  MERROR	= -1
  MTIMEOUT	= -2
  MMORE		= -3
  MSERVER       = -4
  LANG_MAL	= 0
  LANG_SQL	= 2
  LANG_JAQL	= 3
  PROMPTBEG	= "\001"	/* start prompt bracket */
  PROMPT1	= "\001\001\n"	/* prompt: ready for new query */
  PROMPT2	= "\001\002\n"	/* prompt: more data needed */

  enum SQLQuery
    Q_PARSE = 0
    Q_TABLE = 1
    Q_UPDATE = 2
    Q_SCHEMA = 3
    Q_TRANS = 4
    Q_PREPARE = 5
    Q_BLOCK = 6
  end

  type Mapi = Void*
  fun mapi_mapi(host : LibC::Char*, port : LibC::Int, username : LibC::Char*, password : LibC::Char*, lang : LibC::Char*, dbname : LibC::Char*) : Mapi
  fun mapi_mapiuri(url : LibC::Char*, user : LibC::Char*, pass : LibC::Char*, lang : LibC::Char*) : Mapi
  alias Mapimsg = LibC::Int
  fun mapi_destroy(mid : Mapi) : Mapimsg
  fun mapi_start_talking(mid : Mapi) : Mapimsg
  fun mapi_connect(host : LibC::Char*, port : LibC::Int, username : LibC::Char*, password : LibC::Char*, lang : LibC::Char*, dbname : LibC::Char*) : Mapi
  fun mapi_disconnect(mid : Mapi) : Mapimsg
  fun mapi_reconnect(mid : Mapi) : Mapimsg
  fun mapi_ping(mid : Mapi) : Mapimsg
  fun mapi_error(mid : Mapi) : Mapimsg
  fun mapi_noexplain(mid : Mapi, errorprefix : LibC::Char*)
  struct X_IoFile
    _flags : LibC::Int
    _io_read_ptr : LibC::Char*
    _io_read_end : LibC::Char*
    _io_read_base : LibC::Char*
    _io_write_base : LibC::Char*
    _io_write_ptr : LibC::Char*
    _io_write_end : LibC::Char*
    _io_buf_base : LibC::Char*<commit_msg>Finally added the structs<commit_after>@[Link("libmapi")]
lib MonetDBMAPI

# Constants
  _MAPI_H_INCLUDED = 1
  MAPI_AUTO	= 0	/* automatic type detection */
  MAPI_TINY	= 1
  MAPI_UTINY	= 2
  MAPI_SHORT	= 3
  MAPI_USHORT	= 4
  MAPI_INT	= 5
  MAPI_UINT	= 6
  MAPI_LONG	= 7
  MAPI_ULONG	= 8
  MAPI_LONGLONG	= 9
  MAPI_ULONGLONG = 10
  MAPI_CHAR	= 11
  MAPI_VARCHAR	= 12
  MAPI_FLOAT	= 13
  MAPI_DOUBLE	= 14
  MAPI_DATE	= 15
  MAPI_TIME	= 16
  MAPI_DATETIME	= 17
  MAPI_NUMERIC	= 18
  PLACEHOLDER	= "?"
  MAPI_SEEK_SET	= 0
  MAPI_SEEK_CUR	= 1
  MAPI_SEEK_END	= 2
  MAPI_TRACE	= 1
  MAPI_TRACE_LANG = 2
  MOK		= 0
  MERROR	= -1
  MTIMEOUT	= -2
  MMORE		= -3
  MSERVER       = -4
  LANG_MAL	= 0
  LANG_SQL	= 2
  LANG_JAQL	= 3
  PROMPTBEG	= "\001"	/* start prompt bracket */
  PROMPT1	= "\001\001\n"	/* prompt: ready for new query */
  PROMPT2	= "\001\002\n"	/* prompt: more data needed */

  enum SQLQuery
    Q_PARSE = 0
    Q_TABLE = 1
    Q_UPDATE = 2
    Q_SCHEMA = 3
    Q_TRANS = 4
    Q_PREPARE = 5
    Q_BLOCK = 6
  end

# three structures used for communicating date/time information
# these structs are deliberately compatible with the ODBC versions
# SQL_DATE_STRUCT, SQL_TIME_STRUCT, and SQL_TIMESTAMP_STRUCT

struct MapiDate		# used by MAPI_DATE
  year : i8
  month : u8
  day : u8
end

struct MapiTime		# used by MAPI_TIME
  hour : u8
  minute : u8
  second: : u8
end

struct MapiDateTime     # used by MAPI_DATETIME
  year : i8;
  month : u8
  day : u8
  hour : u8
  minute : u8
  second : u8
  fraction : Int32	# in 1000 millionths of a second (10e-9)
end

# connection-oriented functions

  type Mapi = Void*
  fun mapi_mapi(host : LibC::Char*, port : LibC::Int, username : LibC::Char*, password : LibC::Char*, lang : LibC::Char*, dbname : LibC::Char*) : Mapi
  fun mapi_mapiuri(url : LibC::Char*, user : LibC::Char*, pass : LibC::Char*, lang : LibC::Char*) : Mapi
  alias Mapimsg = LibC::Int
  fun mapi_destroy(mid : Mapi) : Mapimsg
  fun mapi_start_talking(mid : Mapi) : Mapimsg
  fun mapi_connect(host : LibC::Char*, port : LibC::Int, username : LibC::Char*, password : <PASSWORD>*, lang : LibC::Char*, dbname : LibC::Char*) : Mapi
  fun mapi_disconnect(mid : Mapi) : Mapimsg
  fun mapi_reconnect(mid : Mapi) : Mapimsg
  fun mapi_ping(mid : Mapi) : Mapimsg
  fun mapi_error(mid : Mapi) : Mapimsg
  fun mapi_noexplain(mid : Mapi, errorprefix : LibC::Char*)
  struct X_IoFile
    _flags : LibC::Int
    _io_read_ptr : LibC::Char*
    _io_read_end : LibC::Char*
    _io_read_base : LibC::Char*
    _io_write_base : LibC::Char*
    _io_write_ptr : LibC::Char*
    _io_write_end : LibC::Char*
    _io_buf_base : LibC::Char*
{'fraction_non_alphanumeric': 0.11118238186871926, 'fraction_numerical': 0.0327132777421424, 'mean_word_length': 3.184257602862254, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4288977', 'n_tokens_mistral': 2158, 'n_tokens_neox': 2026, 'n_words': 475}