Hello Stephane, Definition from: https://mariadb.com/kb/en/mariadb-connectorc-data-structures : "The MYSQL structure represents one database connection and is used by most of MariaDB Connector/C's API functions. The MYSQL structure needs to be allocated and initialized by the mysql_init() API function. It will be released by the mysql_close() function. The MYSQL structure should be considered as opaque."
I try with MariaDB, because there is a valid mysql binding. I can test my UFFi Connector agains MySQL. BTW, I use Pharo 8.0 Georg Hagn Am So., 21. Juni 2020 um 16:12 Uhr schrieb Stéphane Ducasse <stephane.duca...@inria.fr>: > > Hello Georg > > This is a great news. since we need more binding. > I do not really know the answer but I’m sure the guys will help you. > Now just a question: what is the definition of MYSQL > that you mentioned in > „MYSQL * mysql_init(NULL)“ > > > S. > > On 21 Jun 2020, at 11:27, Georg Hagn <georg.h...@gmail.com> wrote: > > For an exercise with uFFi i am try an C-Connector for MariaDB like > Garage or UBDC > As in "Unified FFI Februar 12 2020" I made Helper-classes: > > FFILibrary subclass: #MariaDBLibC > > FFIOpaqueObject subclass: #MariaDBHandle > MariaDBHandle >> unixModuleName [ > ^ '/usr/lib/x86_64-linux-gnu/libmariadb.so' > ] > > and a class > > Object subclass: #MariaDBDriver > instanceVariableNames: 'connectionHandle' > > "Accessors" > MariaDBDriver >> connectionHandle [ ^ connectionHandle ] > MariaDBDriver >> connectionHandle: aHandle [ connectionHandle := aHandle ] > MariaDBDriver class >> ffiLibrary [ ^ MariaDBLibC ] > > "API Methods" > MariaDBDriver >> clientInfo [ ^ self class clientInfo ] > > MariaDBDriver class >> clientInfo [ > ^ self ffiCall: #(String mysql_get_client_info(void)) > ] > > For a first simple Test I choosed the c-api-funtion: > „const char * mysql_get_client_info(void )“ > > In Playground I executed: > driver := MariaDBDriver fromConnectionString: > 'mariaDB://localhost:5432/sodbxtest?&user=sodbxtest&password=sodbxtest'. > > driver clientInfo inspect. > And I get the expected result: String „10.2.9“ > > But the second test with c-api-funtcion fails > „MYSQL * mysql_init(NULL)“ > > MariaDBDriver >> init [ > | aNullHandle | > aNullHandle := ExternalAddress null. > self connectionHandle: (self class init: aNullHandle). > ] > > MariaDBDriver class >> init: aNullHandle [ > ^ self ffiCall: #(MariaDBHandle * mysql_init(ExternalAddress aNullHandle)). > ] > > In Playground I again executed: > driver := MariaDBDriver fromConnectionString: > 'mariaDB://localhost:5432/sodbxtest?&user=sodbxtest&password=sodbxtest'. > > driver init inspect. > " A call to an external function failed" > > Any ideas what is wrong?? > > Thanks > Georg > > > -------------------------------------------- > Stéphane Ducasse > http://stephane.ducasse.free.fr / http://www.pharo.org > 03 59 35 87 52 > Assistant: Aurore Dalle > FAX 03 59 57 78 50 > TEL 03 59 35 86 16 > S. Ducasse - Inria > 40, avenue Halley, > Parc Scientifique de la Haute Borne, Bât.A, Park Plaza > Villeneuve d'Ascq 59650 > France >