For one of my projects I need Perl to access data from a database. SQLite3 would be perfectly suitable for my needs, except for the fact that by default SQLite does not know my national characters. For example, a
turns all ASCII characters of the name to uppercase, but leaves all my national characters as they were, because SQLite does not know the uppercase counterpart of those letters.
A little research revealed that the required functionality can be compiled into SQLite3 at build time, using ICU. So this is what I did:
This brought up a nice curses-based window with some 20 build options, "Use ICU for Unicode support" being unchecked by default. I checked it, and left everything else on their default values. Then ...
... and everything went just fine. Then ...
... which failed because I already had SQLite3 in the system. A sentence printed out by the failed make install suggested that I do a "make deinstall" first. So I attempted ...
... but that listed two screenful of other ports depending on sqlite3 destined for automatic removal, that I answered NO to leave everything as is.
However, I copied out the sqlite3 executable from the build directory work/stage/usr/local/bin/sqlite3 together with the sqlite libs work/stage/usr/local/lib/* to /root/sqlite3icu/. Now if I use that custom built sqlite3 executable, the SELECT UPPER(person_name) example shown above works perfectly fine and prints all letters (including my accented national ones) as proper uppercase.
Now I just need to get Perl to use my custom built sqlite instead of the one in the base system.
I figured that if I can similarly custom-build the Perl database-driver for SQLite then I will be all set. So ...
... which offered one single configuration option to use the sqlite found in the base system (this was the default) or use the one in the ports database/sqlite3. I removed the checkmark, indicating my desire to build using the code in ports. Then
Unfortunately, when I use a perl script to connect to my SQLite3 database file and print the results of the SELECT UPPER( ) example above, it leaves the national characters as lowercase, proving that Perl uses the ASCII-ONLY sqlite present in the base system instead of my Unicode capable ICU build.
I would appreciate your thoughts on ...
SQL:
SELECT UPPER(person_name) FROM people;
A little research revealed that the required functionality can be compiled into SQLite3 at build time, using ICU. So this is what I did:
cd /usr/ports/database/sqlite3
make config
This brought up a nice curses-based window with some 20 build options, "Use ICU for Unicode support" being unchecked by default. I checked it, and left everything else on their default values. Then ...
make
... and everything went just fine. Then ...
make install
... which failed because I already had SQLite3 in the system. A sentence printed out by the failed make install suggested that I do a "make deinstall" first. So I attempted ...
pkg remove sqlite3
... but that listed two screenful of other ports depending on sqlite3 destined for automatic removal, that I answered NO to leave everything as is.
However, I copied out the sqlite3 executable from the build directory work/stage/usr/local/bin/sqlite3 together with the sqlite libs work/stage/usr/local/lib/* to /root/sqlite3icu/. Now if I use that custom built sqlite3 executable, the SELECT UPPER(person_name) example shown above works perfectly fine and prints all letters (including my accented national ones) as proper uppercase.
Now I just need to get Perl to use my custom built sqlite instead of the one in the base system.
I figured that if I can similarly custom-build the Perl database-driver for SQLite then I will be all set. So ...
cd /usr/ports/database/p5-DBD-SQLite3
make config
... which offered one single configuration option to use the sqlite found in the base system (this was the default) or use the one in the ports database/sqlite3. I removed the checkmark, indicating my desire to build using the code in ports. Then
make
followed by make install
, all completed well. Unfortunately, when I use a perl script to connect to my SQLite3 database file and print the results of the SELECT UPPER( ) example above, it leaves the national characters as lowercase, proving that Perl uses the ASCII-ONLY sqlite present in the base system instead of my Unicode capable ICU build.
I would appreciate your thoughts on ...
- What to do in order to get Perl to use my ICU-extended SQLite3.
- or How to replace the sqlite in the base system with my custom-built one without removing or rebuilding the existing packages depending on SQLIte.
- Am I on the right track believing that the way to get Perl to work with the ICU-ready custom-built SQLite is through the p5-dbd-sqlite3 driver?