Hi Herby

On which version of Pharo are you trying? Because lot of changes
happened on Pharo 60 FFI.

Stef

On Sun, Aug 13, 2017 at 6:11 PM, Herby Vojčík <he...@mailbox.sk> wrote:
> Hello!
>
> This testing code:
>
> | databaseFile login accessor sqlString |
>         databaseFile := Smalltalk imageDirectory asFileReference /
> 'play.sqlite'.
>         login := Login new
>                         database: SQLite3Platform new;
>                         host: '';
>                         port: '';
>                         username: '';
>                         password: '';
>                         databaseName: databaseFile fullPath asZnUrl
> asString;
>                         yourself.
>         accessor := DatabaseAccessor forLogin: login.
>         accessor login.
>         sqlString := 'SELECT * FROM AGENT'.
>         (accessor basicExecuteSQLString: sqlString) contents inspect.
>
> fails (Pharo 6.1, GarageGlorp #stable loaded a week ago as a project
> dependency) with:
>
> Error: Unable to resolve external type: sqlite3
>
> FFICallout(Object)>>error:
> FFICallout>>resolveType:
> FFICallout>>typeName:pointerArity:
> FFICallout>>argName:indirectIndex:type:ptrArity:
> FFIFunctionParser>>parseArgument
> FFIFunctionParser>>parseArguments
> FFIFunctionParser>>parseNamedFunction:
> FFICalloutMethodBuilder>>parseSignature:
> FFICalloutMethodBuilder>>generate
> FFICalloutMethodBuilder>>build:
> FFICalloutAPI>>function:module:
> GASqlite3FFI(Object)>>ffiCall:module:
> GASqlite3FFI>>apiErrorMessage:
> GASqlite3FFI>>signal:with:on:
> GASqlite3FFI>>checkForOk:on:
> GASqlite3FFI>>prepare:on:with:
> GASqlite3Statement>>prepare
> GASqlite3Driver>>prepare:
> GASqlite3ResultSet>>prepareStatement:
> GASqlite3ResultSet>>execute:withCollection:
> GASqlite3ResultSet>>execute:with:on:
> GASqlite3Driver>>execute:with:
> GASqlite3Driver>>execute:
> GAGlorpDriver>>basicExecuteSQLString:
> PharoDatabaseAccessor>>basicExecuteSQLString:
> UndefinedObject>>DoIt
> OpalCompiler>>evaluate
> [..snip..]
>
> Problem seems to be that in FFICallout >> resolveType:, the line
>
> binding := resolver ffiBindingOf: name asSymbol.
>
> actually produces nil, resolver being GASqlite3FFI class. If looking at the
> class side of GaSqlite3FFI, there is no ffiBindingOf: at all; there is
>
> nbBindingOf: aTypeName
>         ^ TypeMap at: aTypeName ifAbsent: [ super nbBindingOf: aTypeName ]
>
> though. If I copy near-mindlessly and add:
>
> ffiBindingOf: aTypeName
>         ^ TypeMap at: aTypeName ifAbsent: [ super ffiBindingOf: aTypeName ]
>
> then the code above fails correctly with: 'no such table: AGENT'.
>
> Am I missing some nb<->ffi bridge? Or is there a bug in Garage SQLite
> driver?
>
> Herby
>

Reply via email to