On Sun, Jun 21, 2020 at 11:27:22AM +0200, Georg Hagn wrote:
> 'mariaDB://localhost:5432/sodbxtest?&user=sodbxtest&password=sodbxtest'.

Hi,

Firstly, 5432 is PostgreSQL. MySQL/MariaDB default port is 3306.

Just a note, as mysql_init() only allocates the C level structure and
doesn't connect.

> FFILibrary subclass: #MariaDBLibC
> 
> FFIOpaqueObject subclass: #MariaDBHandle
> MariaDBHandle >> unixModuleName [
>    ^ '/usr/lib/x86_64-linux-gnu/libmariadb.so'
> ]

With your code, implementing #unixModuleName in MariaDBLibC works for
me. I've never done that in FFIOpaqueObject subclasses.

In terms of organizing code, suggest you implement the FFI calls in
MariaDBLibC itself and do away with MariaDBDriver. Having the FFI calls
in MariaDBDriver while using MariaDBLibC only for locating the C
libraries is using two classes where one will do.

Finally, there is a non FFI pure Smalltalk implementation of the MySQL
wire protocol that has been around a while. If you are doing this FFI
thing for practice, I recommend that you wrap another C library, so that
when you are done, Pharo gets another C library binding.

  https://github.com/pharo-rdbms/Pharo-MySQL

Pierce

Reply via email to