[sqlite] Affinity conversions and BLOB values

2019-06-09 Thread Manuel Rigger
Hi everyone, Consider the following example: CREATE TABLE t0(c0 TEXT); INSERT INTO t0(c0) VALUES (x'41'); -- 'A' if converted to TEXT SELECT (+ c0) IS c0 FROM t0; -- expected: 0, actual: 1 I would expect that a row with a value 0 is returned. I suspect that this is a misunderstanding on my

Re: [sqlite] Affinity conversions and BLOB values

2019-06-09 Thread Keith Medcalf
On Sunday, 9 June, 2019 08:15, Manuel Rigger wrote: >Hi Keith, >I don't understand completely. So we agree that +c0 has no affinity. >However, you argue that c0 has BLOB affinity, if I understood >correctly. >Why is that? I'd assume that it has TEXT affinity, since the table >column is

[sqlite] Optimising multiple group by clauses

2019-06-09 Thread Kevin Martin
Hi, I am trying to find the best way to write a query that has two levels of group by where the outer group by columns are a subset of the inner group by columns. In my example below I want to do an aggregation grouping by per, prod, and mar, then I want aggregate the results of this

Re: [sqlite] Affinity conversions and BLOB values

2019-06-09 Thread Manuel Rigger
Hi Keith, I don't understand completely. So we agree that +c0 has no affinity. However, you argue that c0 has BLOB affinity, if I understood correctly. Why is that? I'd assume that it has TEXT affinity, since the table column is declared as TEXT. Since applying TEXT affinity seems to be lossless,

Re: [sqlite] Affinity conversions and BLOB values

2019-06-09 Thread Keith Medcalf
On Sunday, 9 June, 2019 05:20, Manuel Rigger wrote: >Consider the following example: >CREATE TABLE t0(c0 TEXT); >INSERT INTO t0(c0) VALUES (x'41'); -- 'A' if converted to TEXT >SELECT (+ c0) IS c0 FROM t0; -- expected: 0, actual: 1 >I would expect that a row with a value 0 is returned. I

Re: [sqlite] Affinity conversions and BLOB values

2019-06-09 Thread Keith Medcalf
On Sunday, 9 June, 2019 05:20, Manuel Rigger wrote: >CREATE TABLE t0(c0 TEXT); >INSERT INTO t0(c0) VALUES (x'41'); -- 'A' if converted to TEXT >SELECT (+ c0) IS c0 FROM t0; -- expected: 0, actual: 1 Note also that the only place where + is different from by itself generally speaking is in an

Re: [sqlite] How to set access permissions to protect a database file?

2019-06-09 Thread Markos
Many thanks to Luuk, Adrian, Graham, James, Simon, Richard and Peter, To guarantee "some" protection to the files containing the database I decided to use the following strategy: I created, as root, the directory /home/reading_room And activated the "sticky bit" of the reading_room directory

Re: [sqlite] How to insert the BLOB in database?

2019-06-09 Thread Richard Hipp
On 6/9/19, Igor Korot wrote: > > Now I open this database in sqlite3 CLI binary and would like to insert some > png > file inside this BLOB field. INSERT INTO tab1(blob1) VALUES(readfile('some.png')); -- D. Richard Hipp d...@sqlite.org ___

[sqlite] System.Data.SQLite version 1.0.111.0 released

2019-06-09 Thread Joe Mistachkin
System.Data.SQLite version 1.0.111.0 (with SQLite 3.28.0) is now available on the System.Data.SQLite website: https://system.data.sqlite.org/ Further information about this release can be seen at: https://system.data.sqlite.org/index.html/doc/trunk/www/news.wiki Please post on the

[sqlite] How to insert the BLOB in database?

2019-06-09 Thread Igor Korot
Hi, ALL, Let's say I have some database, where I have table called test. This test table contains the field whose type is BLOB. Now I open this database in sqlite3 CLI binary and would like to insert some png file inside this BLOB field. And I am not talking about the file name - the actual

Re: [sqlite] How to insert the BLOB in database?

2019-06-09 Thread Simon Slavin
On 9 Jun 2019, at 2:24pm, Igor Korot wrote: >> INSERT INTO tab1(blob1) VALUES(readfile('some.png')); > > I presume the file extension can be anything? As you presume, the SQLite extension does not understand the contents of the file. It's treated just as a sequence of octets. So you can use

Re: [sqlite] How to insert the BLOB in database?

2019-06-09 Thread Simon Slavin
On 10 Jun 2019, at 3:44am, Mark Halegua wrote: > I probably should figure this out, but in a GUI, how do I recover a graphic > from the database? Programming. SQLite can't do it since it doesn't even understand that that sequence of octets is a graphics. How you do it in programming depends

[sqlite] endianess/signed issue on OpenBSD/sparc64 ?

2019-06-09 Thread Landry Breuil
Hi (not subscribed to the list), i'm more or less maintaining sqlite3 in OpenBSD packages (at 3.28.0 now), and recently proj.4 was updated to a version that relies on sqlite3 to store projections, which has some constraints on values entered. this broke on sparc64 (cf

Re: [sqlite] How to insert the BLOB in database?

2019-06-09 Thread Mark Halegua
On Sunday, June 09, 2019 08:24:10 PM Richard Hipp wrote: > On 6/9/19, Igor Korot wrote: > > Now I open this database in sqlite3 CLI binary and would like to insert > > some png > > file inside this BLOB field. > > INSERT INTO tab1(blob1) VALUES(readfile('some.png')); I probably should figure

Re: [sqlite] How to insert the BLOB in database?

2019-06-09 Thread Mark Halegua
On Monday, June 10, 2019 03:46:02 AM Simon Slavin wrote: > On 10 Jun 2019, at 3:44am, Mark Halegua wrote: > > I probably should figure this out, but in a GUI, how do I recover a > > graphic from the database? > Programming. SQLite can't do it since it doesn't even understand that that > sequence

Re: [sqlite] How to insert the BLOB in database?

2019-06-09 Thread Igor Korot
Hi, Richard, Thank you for the reply. On Sun, Jun 9, 2019 at 7:24 PM Richard Hipp wrote: > > On 6/9/19, Igor Korot wrote: > > > > Now I open this database in sqlite3 CLI binary and would like to insert some > > png > > file inside this BLOB field. > > > INSERT INTO tab1(blob1)

Re: [sqlite] How to insert the BLOB in database?

2019-06-09 Thread Simon Slavin
On 10 Jun 2019, at 4:08am, Mark Halegua wrote: > I'm using Python. What would the programming sequence be to display the > graphic in that language? It's not a SQlite question. SQLite doesn't understand graphics. You'd do it similar to how you'd display a graphic you'd read from a file.

[sqlite] Fwd: Best way to set default PRAGMA's in System.Data.SQLite

2019-06-09 Thread Sam Carleton
Joe, I just opened up the build.bat file and saw your name as the author. I just wanted to send you a quick little note of immense gratitude for your personal help and for all the hard work you and the rest of the SQLite development team do for SQLite. Independent software vendors such as