]> gitweb.factorcode.org Git - factor.git/blob - extra/db/mysql/ffi/ffi.factor
db.mysql: Add low-level MySQL support
[factor.git] / extra / db / mysql / ffi / ffi.factor
1 ! Copyright (C) 2007 Berlin Brown, 2008 Doug Coleman, 2021 Giftpflanze.
2 ! See http://factorcode.org/license.txt for BSD license.
3 ! Adapted from mysql.h and mysql.c
4 ! Tested with MariaDB version 10.1.39
5 USING: alien alien.c-types alien.libraries alien.syntax
6 combinators system ;
7 IN: db.mysql.ffi
8
9 << "mysql" {
10     { [ os windows? ] [ "libmySQL.dll" stdcall ] }
11     { [ os macosx? ] [ "libmysqlclient.14.dylib" cdecl ] }
12     { [ os unix? ] [ "libmysqlclient.so" cdecl ] }
13 } cond add-library >>
14
15 LIBRARY: mysql
16
17 FUNCTION: uint mysql_errno ( void* mysql )
18 FUNCTION: c-string mysql_error ( void* mysql )
19 FUNCTION: void* mysql_init ( void* mysql )
20 FUNCTION: int mysql_options ( void* mysql, int option, void* arg
21 )
22 FUNCTION: void* mysql_real_connect ( void* mysql, c-string host,
23 c-string user, c-string password, c-string db, int port,
24 c-string unixsocket, long clientflag )
25 FUNCTION: int mysql_query ( void* mysql, c-string query )
26 FUNCTION: void* mysql_use_result ( void* mysql )
27 FUNCTION: uint mysql_field_count ( void* mysql )
28 FUNCTION: uint mysql_num_fields ( void* result )
29 FUNCTION: char** mysql_fetch_row ( void* result )
30 FUNCTION: ulong* mysql_fetch_lengths ( void* result )
31 FUNCTION: void mysql_free_result ( void* result )
32 FUNCTION: void mysql_close ( void* mysql )