[Pharo-users] SQLite3 [UDBC2] - "Could not coerce arguments" error for UTF8 chars

Petr Fischer petr.fischer at me.com
Tue Feb 5 14:20:22 EST 2019


> On Tue, Feb 05, 2019 at 02:51:42PM +0000, Petr Fischer via Pharo-users wrote:
> > When I executing this insert SQL command:
> > insert into "TABLE" (..., "VARCHAR_FIELD") values (..., 'ěščřžýáíéúůĚŠČŘŽÝÁÍÉÚŮ');
> > this UDBC error occurs (what's wrong?):
> > Error: "Could not coerce arguments"
> 
> Please show complete code.
> 
> Below code completes without error.
> 
>     | db |
>     db := UDBCSQLite3Connection openOn: '/tmp/u.db'.
>     [   db basicExecute: 'create table x (xv varchar)'.
>         db execute: 'insert into x values (?)'
>             with: (Array with: 'ěščřžýáíéúůĚŠČŘŽÝÁÍÉÚŮ').
>     ] ensure: [ db close ]

Yes, via. binding a value ala prepared statement, this works. Thanks!

But still... I do not expect anyone to create tables through binding values (like in your example), so following SQL command is still broken:

db execute: 'create table A (ID INTEGER, T TEXT DEFAULT ''áěšřčá'')'.

Error: "Could not coerce arguments"

pf



More information about the Pharo-users mailing list