Hi all,
I've enhanced the Pharo SQLite library to be even more multilingual. It has always supported data elements that are Pharo WideString instances, these being converted to/from UTF8 transparently by the library. Now the library also handles multilingual table names, column names and default column values; in other words, multilingual SQL statements. To install in Pharo 7, load GlorpSQLite from the Catalog Browser. Example: | db | db := UDBCSQLite3Connection openOn: '/tmp/ml.db'. [ "Chinese table name, column names, and default column value." db basicExecute: 'create table 表一 (键一 integer primary key, 列二 text default ''中文'');'. "Insert a row, taking default column value for the 2nd column." db basicExecute: 'insert into 表一 (键一) values (NULL)'. "Insert another row, specifying a value in Chinese for the 2nd column." db execute: 'insert into 表一 values (NULL, ?)' with: (Array with: '值二'). (db execute: 'select * from 表一') rows inspect. ] ensure: [ db close ] From the SQLite shell: % sqlite3 /tmp/ml.db SQLite version 3.27.2 2019-02-25 16:06:06 Enter ".help" for usage hints. sqlite> .header on sqlite> .schema CREATE TABLE 表一 (键一 integer primary key, 列二 text default '中文'); sqlite> select * from 表一; 键一|列二 1|中文 2|值二 sqlite> Testing and feedback welcome, especially on which other parts of the library needing internationalization. Pierce |
Wow! I wasn't aware SQLite supported that.
Thank you from bringing such powerful, yet small, database to Pharo. Esteban A. Maringolo El sáb., 2 mar. 2019 a las 10:17, Pierce Ng (<[hidden email]>) escribió: > > Hi all, > > I've enhanced the Pharo SQLite library to be even more multilingual. It has > always supported data elements that are Pharo WideString instances, these > being converted to/from UTF8 transparently by the library. Now the library > also handles multilingual table names, column names and default column > values; in other words, multilingual SQL statements. > > To install in Pharo 7, load GlorpSQLite from the Catalog Browser. > > Example: > > | db | > db := UDBCSQLite3Connection openOn: '/tmp/ml.db'. > [ "Chinese table name, column names, and default column value." > db basicExecute: 'create table 表一 (键一 integer primary key, 列二 text default ''中文'');'. > "Insert a row, taking default column value for the 2nd column." > db basicExecute: 'insert into 表一 (键一) values (NULL)'. > "Insert another row, specifying a value in Chinese for the 2nd column." > db execute: 'insert into 表一 values (NULL, ?)' > with: (Array with: '值二'). > (db execute: 'select * from 表一') rows inspect. > ] ensure: [ db close ] > > From the SQLite shell: > > % sqlite3 /tmp/ml.db > SQLite version 3.27.2 2019-02-25 16:06:06 > Enter ".help" for usage hints. > sqlite> .header on > sqlite> .schema > CREATE TABLE 表一 (键一 integer primary key, 列二 text default '中文'); > sqlite> select * from 表一; > 键一|列二 > 1|中文 > 2|值二 > sqlite> > > Testing and feedback welcome, especially on which other parts of the > library needing internationalization. > > Pierce > > |
In reply to this post by Pierce Ng-3
Thanks!
Hilaire Le 02/03/2019 à 14:16, Pierce Ng a écrit : > I've enhanced the Pharo SQLite library to be even more multilingual. It has -- Dr. Geo http://drgeo.eu |
Free forum by Nabble | Edit this page |