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

Pierce Ng pierce at samadhiweb.com
Tue Feb 5 10:32:19 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 ]

Below checks the database outside Pharo.

    % sqlite3 /tmp/u.db
    SQLite version 3.26.0 2018-12-01 12:34:55
    Enter ".help" for usage hints.
    sqlite> .tables
    x
    sqlite> .schema x
    CREATE TABLE x (xv varchar);
    sqlite> .header on
    sqlite> select xv from x;
    xv
    ěščřžýáíéúůĚŠČŘŽÝÁÍÉÚŮ
    sqlite>





More information about the Pharo-users mailing list