Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-19 Thread Simon Slavin
On 20 Feb 2018, at 1:38am, petern wrote: > Yet even so, as Ralf pointed out, the PostgreSQL lpad() and rpad() fill > with arbitrary string functionality would still be missing despite the > checked in printf() being more directly equivalent to the PostgreSQL >

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-19 Thread J Decker
On Mon, Feb 19, 2018 at 5:38 PM, petern wrote: > FYI. See http://www.sqlite.org/src/timeline for the equivalent DRH > checkins: http://www.sqlite.org/src/info/c883c4d33f4cd722 > Hopefully that branch will make a forthcoming trunk merge. [Printing > explicit nul

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-19 Thread petern
FYI. See http://www.sqlite.org/src/timeline for the equivalent DRH checkins: http://www.sqlite.org/src/info/c883c4d33f4cd722 Hopefully that branch will make a forthcoming trunk merge. [Printing explicit nul terminator by formatting an interesting twist.] Yet even so, as Ralf pointed out, the

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-19 Thread Cezary H. Noweta
Hello, On 2018-02-17 18:39, Ralf Junker wrote: Example SQL: select   length(printf ('%4s', 'abc')),   length(printf ('%4s', 'äöü')),   length(printf ('%-4s', 'abc')),   length(printf ('%-4s', 'äöü')) Output is 4, 3, 4, 3. Padding seems to take into account UTF-8 bytes instead of UTF-8

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-19 Thread Keith Medcalf
Should not your application just retrieve the UTF-8 text and format it for display to the user? User <-> Software formatting (and input/output diddling of any type) should only be done ONCE (on INPUT from the user or on OUTPUT to the user) as close to the User as possible and should *NEVER

Re: [sqlite] How does adding an index change a query plan even though the new query plan doesn't use the newly added index?

2018-02-19 Thread Jens Alfke
> On Feb 15, 2018, at 3:31 PM, David Pitchford > wrote: > > I have been using SQLite 3.8.2 > for this since I don't feel up to try replacing the version that came with > my OS. If you're coding in some dialect of C, simply download the 'amalgamation' (the big

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-19 Thread Jens Alfke
> On Feb 19, 2018, at 2:54 AM, Ralf Junker wrote: > > 'です' are 2 codepoints according to > > http://www.fontspace.com/unicode/analyzer/?q=%E3%81%A7%E3%81%99 > > > The requested overall width is 4, so I

Re: [sqlite] Test error in oserror-2.1.1

2018-02-19 Thread Free Ekanayaka
Hi, Dan Kennedy writes: > On 02/19/2018 01:28 AM, Free Ekanayaka wrote: >> Hello, >> >> I've tried to run the quicktest suite for SQLite 3.22.0 on Linux (kernel >> version 4.13.0), and when it executes test/oserror.test I get errors: >> >> oserror-1.1.1... Ok >>

[sqlite] Building 3.22.0 for vxWorks fails

2018-02-19 Thread Andy Ling
I decided it was about time we updated our version 3.8 sqlite to something a bit newer. So I have just tried building the 3.22.0 amalgamation for VxWorks and it fails to compile with the following error sqlite3.c:31215: error: 'geteuid' undeclared here (not in a function) It looks like the

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-19 Thread petern
As d3ck0r suggested. adding a byte_length() function would enable padding of spaces [but not general padding with arbitrary characters as lpad() and rpad() afford]. WITH points(p) AS (VALUES ('abc'), ('äöü'), ('です')) ,format(f) AS (VALUES ('%*s'), ('%-*s')) ,pad AS (SELECT p, f,

Re: [sqlite] invalid date time

2018-02-19 Thread Olivier Leprêtre
Thanks to all for your answers, special thanks to Cezary : Use `Flags=GetAllAsText' when creating a SQLiteConnection is the right answer. After, I used reader.GetValue(i).ToString() to get all values as strings, regardless their type. Have a good day, Olivier -Message d'origine- De :

Re: [sqlite] invalid date time

2018-02-19 Thread Cezary H. Noweta
Hello, On 2018-02-19 13:08, Joe Mistachkin wrote: Cezary H. Noweta wrote: Use ``Flags=GetAllAsText'' when creating a SQLiteConnection. Excellent suggestion. Alternatively, you could use the GetString method on the SQLiteDataReader class. Indeed, however OP posted that ``GetString()'' does

Re: [sqlite] invalid date time

2018-02-19 Thread Joe Mistachkin
Cezary H. Noweta wrote: > > Use ``Flags=GetAllAsText'' when creating a SQLiteConnection. > Excellent suggestion. Alternatively, you could use the GetString method on the SQLiteDataReader class. The GetValue method, by design, refers to the table schema so that it can convert the requested

Re: [sqlite] invalid date time

2018-02-19 Thread Cezary H. Noweta
Hello, On 2018-02-19 07:02, Olivier Leprêtre wrote: I have an sqlite database with wrong information in a timestamp field. Using System.Data.Sqlite, I want to get this information as a string inside a very simple loop. while (i < reader.FieldCount) { txt = reader[i].ToString(); // or

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-19 Thread J Decker
On Mon, Feb 19, 2018 at 2:54 AM, Ralf Junker wrote: > On 19.02.2018 09:50, Rowan Worth wrote: > > What is your expected answer for: >> >> select length(printf ('%4s', 'です')) >> > > 'です' are 2 codepoints according to > >

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-19 Thread J Decker
On Mon, Feb 19, 2018 at 3:21 AM, Cezary H. Noweta wrote: > Hello, > > On 2018-02-18 00:36, Richard Hipp wrote: > >> The current behavior of the printf() function in SQLite, goofy though >> it may be, exactly mirrors the behavior of the printf() C function in >> the standard

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-19 Thread Cezary H. Noweta
Hello, On 2018-02-18 00:36, Richard Hipp wrote: The current behavior of the printf() function in SQLite, goofy though it may be, exactly mirrors the behavior of the printf() C function in the standard library in this regard. So I'm not sure whether or not this is something that ought to be

Re: [sqlite] Test error in oserror-2.1.1

2018-02-19 Thread Dan Kennedy
On 02/19/2018 01:28 AM, Free Ekanayaka wrote: Hello, I've tried to run the quicktest suite for SQLite 3.22.0 on Linux (kernel version 4.13.0), and when it executes test/oserror.test I get errors: oserror-1.1.1... Ok oserror-1.1.2... Ok oserror-1.1.3... Ok oserror-1.2.1... Ok oserror-1.2.2...

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-19 Thread Ralf Junker
On 19.02.2018 09:50, Rowan Worth wrote: What is your expected answer for: select length(printf ('%4s', 'です')) 'です' are 2 codepoints according to http://www.fontspace.com/unicode/analyzer/?q=%E3%81%A7%E3%81%99 The requested overall width is 4, so I would expect expect two added spaces

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-19 Thread Rowan Worth
What is your expected answer for: select length(printf ('%4s', 'です')) -Rowan On 18 February 2018 at 01:39, Ralf Junker wrote: > Example SQL: > > select > length(printf ('%4s', 'abc')), > length(printf ('%4s', 'äöü')), > length(printf ('%-4s', 'abc')), >

Re: [sqlite] printf() problem padding multi-byte UTF-8 code points

2018-02-19 Thread Ralf Junker
On 18.02.2018 00:36, Richard Hipp wrote: The current behavior of the printf() function in SQLite, goofy though it may be, exactly mirrors the behavior of the printf() C function in the standard library in this regard. SQLite3 is not C. SQLite3 text storage is always Unicode. Thus SQL text

Re: [sqlite] invalid date time

2018-02-19 Thread Olivier Leprêtre
Hi, Thanks for this answer J but if I have only SQLiteDataReader reader object tmp = reader[i]; I get "string is not a valid DateTime" Exception on this line. Olivier -Message d'origine- De : sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] De la part de J Decker