Re: [sqlite] Recursive CTE on tree with doubly linked items

2019-03-11 Thread Keith Medcalf
On Monday, 11 March, 2019 09:42, heribert wrote: >it works perfect - but i do not understand why. See https://sqlite.org/lang_with.html for a description of recursive queries ... >The 'inital-select' results with the head node - only one result set. >SELECT * > FROM Tree > WHERE ParentID

Re: [sqlite] Missing docs

2019-03-15 Thread Keith Medcalf
These docs: https://sqlite.org/c3ref/expanded_sql.html The sqlite3_sql and sqlite3_expanded_sql are always be available. The sqlite3_normalized_sql interface is only available if the SQLITE_ENABLE_NORMALIZE compile option is used. --- The fact that there's a Highway to Hell but only a Stair

Re: [sqlite] Query planner: Scanning subqueries vs using automatic covering index

2019-03-15 Thread Keith Medcalf
The current tip of trunk produced the same results demonstrated by Niklas in his original post for his original testcase for me. I would have written the query as a simple query with correlated subqueries to get the concatenated data as it is a "more natural" declaration of what is wanted (in

Re: [sqlite] Query planner: Scanning subqueries vs using automatic covering index

2019-03-15 Thread Keith Medcalf
Original Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf >Sent: Friday, 15 March, 2019 14:44 >To: SQLite mailing list >Subject: Re: [sqlite] Query planner: Scanning subqueries vs using >automatic covering index >

Re: [sqlite] Rowid alias and description of query result: suspected tiny bug

2019-03-17 Thread Keith Medcalf
On Sunday, 17 March, 2019 12:30, Yannick Duchêne wrote: >Hi people, it’s a long time I did not get there. >I’m currently to create and use an SQLite DB with the Python biding >APSW. For each row returned, I always retrieve the description with >`Cursor.getdescription()`. Surprisingly, during a

Re: [sqlite] Rowid alias and description of query result: suspected tiny bug

2019-03-17 Thread Keith Medcalf
On Sunday, 17 March, 2019 15:00, Yannick Duchêne wrote: >Aside, what also surprised me just a moment ago and I never >noticed before, is that although I can refer to ROWID (not aliased) >anywhere in a query, it seems to not work properly in `using(rowid)`, if >the ROWID is automatically generat

Re: [sqlite] Query planner: Scanning subqueries vs using automatic covering index

2019-03-17 Thread Keith Medcalf
On Sunday, 17 March, 2019 11:19, niklas wrote: >I agree that correlated subqueries in general seem more natural and >are probably also less likely to have the performance pessimizations >noticed with joins. >But I might also want to use the column, or in case of a correlated >subquery, the colu

Re: [sqlite] Recursive CTE on tree with doubly linked items

2019-03-18 Thread Keith Medcalf
The trigger program will have update anomalies (violation of the UNIQUE constraint for example) as well as performance issues unless the data in the tree is tiny (since it must visit every row in the tree even if it is not being updated). This will fix those issues (and also requires a "gentle

Re: [sqlite] Do SQLITE_LOCKED situations call the busy-handler ?

2019-03-19 Thread Keith Medcalf
SQLITE_LOCKED is an immediate return (that is, it returns immediately, it is not subject to automatic retries or timeouts or the busy/wait handler -- it is an error indication, not necessarily a transient condition). You may use the sqlite3_unlock_notify API (assuming that you have compiled y

Re: [sqlite] Do SQLITE_LOCKED situations call the busy-handler ?

2019-03-19 Thread Keith Medcalf
See also: https://sqlite.org/unlock_notify.html --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Original Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On B

Re: [sqlite] What is the most commonly used file extension for sqlite3 database files?

2019-03-23 Thread Keith Medcalf
I use .db cuz it is a database. You are free to call your files whatever you please (as is everyone else). You would have to take a very wide poll of the millions of users of SQLite3 to discover all the file extensions they use, since a name is just a name and nothing more than a name and has

Re: [sqlite] Diagnosing stale readers

2019-03-24 Thread Keith Medcalf
https://sqlite.org/walformat.html The -shm file contains information about in process transactions that are blocking the checkpoint, but not the processes that are holding them. --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volum

Re: [sqlite] Windows dll - Export Symbol

2019-03-27 Thread Keith Medcalf
On Wednesday, 27 March, 2019 07:18, Lloyd wrote: >I wish to build SQLite as a dll in Windows. As per the documentation >here >https://www.sqlite.org/howtocompile.html, I have executed the command >cl sqlite3.c -link -dll -out:sqlite3.dll >on Visual Studio x86 command prompt. >It seems that the

Re: [sqlite] Row locking sqlite3

2019-03-27 Thread Keith Medcalf
On Wednesday, 27 March, 2019 12:04, Thomas Kurz wrote: >> I wonder whether SQLite is treating each DELETE as a single >transaction. Could you try wrapping the main delete in BEGIN ... END >and see whether that speeds up the cascaded DELETE ? Would you be >able to find timings (either in your c

Re: [sqlite] Feature request: dynamically referenced bind parameters

2019-03-27 Thread Keith Medcalf
You mean something like this: SELECT staff.* FROM staff, contributions WHERE contributions.staff = staff.email AND contributions.article IN (SELECT id FROM articles WHERE publish_date <= CURRENT_TIMESTAMP ORDER BY publish_date DESC LIMIT ?); --- The fact that there's a Highway to Hell but only a

Re: [sqlite] is this possible

2019-03-28 Thread Keith Medcalf
On Thursday, 28 March, 2019 13:21, Mark Wagner wrote: >Imagine I have these two tables and one view defining a join. >CREATE TABLE t (foo); >CREATE TABLE s (bar); >CREATE VIEW v as select * from t join s on (foo = q); >I appear to be able to do this query: >select 20 as q, * from t join s on (

Re: [sqlite] Is it possible to transpose a table using SQL?

2019-03-31 Thread Keith Medcalf
On Sunday, 31 March, 2019 14:07, Shane Dev wrote: >Is it possible to create a view which switches rows and columns of a >dynamically changing table? >For example, imagine we have table t1 where both columns and rows >could change after the view has been created >sqlite> select * from t1; >Prod

Re: [sqlite] Bug in sqlite3 (CLI, linux/Ubuntu)

2019-03-31 Thread Keith Medcalf
Works fine for me on Centos ... using the default (ancient) version of SQLite3 # sqlite3 /tmp/test.db "CREATE TABLE test (col1); INSERT INTO test VALUES(1);" # touch /tmp/test.init # sqlite3 /tmp/test.db "SELECT * FROM test;" 2>/dev/null 1 # sqlite3 -init /tmp/test.init /tmp/test.db "SELECT * FRO

Re: [sqlite] compressed sqlite3 database file?

2019-04-10 Thread Keith Medcalf
The disassembled bird will always require more tar to coat than the assembled bird. This is because the disassembled bird will have a greater surface area to coat with tar than the assembled bird. This is a fact of physics which, although you may try as you might, you cannot change (unless of

Re: [sqlite] Built in and enabled Virtual Table extensions in SQLite CLI?

2019-04-10 Thread Keith Medcalf
--- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. On Tuesday, 9 April, 2019 21:17, John McMahon wrote: >I have not used extensions before. I understand that some are >included in the amalgamation source file and that some

Re: [sqlite] Does sqlite3 support alter table add primary key?

2019-04-10 Thread Keith Medcalf
CREATE UNIQUE INDEX on H1 (...the unique columns...). Primary key is (except for the INTEGER PRIMARY KEY in a rowid table) and in WITHOUT ROWID tables where it is the key of the b-tree, just semantic sugar for a UNIQUE index ... --- The fact that there's a Highway to Hell but only a Stairway

Re: [sqlite] [EXTERNAL] compressed sqlite3 database file?

2019-04-10 Thread Keith Medcalf
The first column is of strings ... Do you mean a single string as in "KerfufledAllaHasbalah" Or a "bunch of strings with some implied delimiter" such as "Kerfufled/Alla/Hasballah" where "/" is the separator between strings? If the latter, the data needs to be normalized. --- The fact that ther

Re: [sqlite] [EXTERNAL] compressed sqlite3 database file?

2019-04-10 Thread Keith Medcalf
the second column is of integers ... Do you mean the second column in AN integer or that it is a bunch-o-integers separated by some separator? If the latter, normalization is required. --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traf

Re: [sqlite] [EXTERNAL] compressed sqlite3 database file?

2019-04-10 Thread Keith Medcalf
On Wednesday, 10 April, 2019 08:12, Peng Yu wrote: >On 4/10/19, Keith Medcalf wrote: >> The first column is of strings ... >> Do you mean a single string as in "KerfufledAllaHasbalah" >> Or a "bunch of strings with some implied delimiter" such as &

Re: [sqlite] Option to control implicit casting

2019-04-10 Thread Keith Medcalf
On Wednesday, 10 April, 2019 08:28, Joshua Thomas Wise wrote: >This is not enough. Because of implicit casting, an integer (a >precise value) could be passed through a series of operations that >outputs an integer, satisfying the check constraint, but it still >could’ve been converted to a floa

Re: [sqlite] Option to control implicit casting

2019-04-10 Thread Keith Medcalf
d require even more extensive testing. And thinking about how one would want it to work. >> On Apr 10, 2019, at 10:55 AM, Keith Medcalf >wrote: >> >> >> On Wednesday, 10 April, 2019 08:28, Joshua Thomas Wise >mailto:joshuathomasw...@gmail.com>> >wrote: >&

Re: [sqlite] compressed sqlite3 database file?

2019-04-10 Thread Keith Medcalf
It is far cheaper and much more reliable to just buy some file storage space. Last I looked 4 TB of NVMe is about $1,000.00. This is not the old days when a 5 1/2 inch full height 40 MEGABYTE drive cost a bundle. Geez, I remember when I got a bunch of CDC Wren IV 300 MB drives at the whoppi

Re: [sqlite] compressed sqlite3 database file?

2019-04-10 Thread Keith Medcalf
On Wednesday, 10 April, 2019 14:21, Peter da Silva wrote: >On Wed, Apr 10, 2019 at 3:12 PM Keith Medcalf wrote: >> Why would anyone fart about with added complication and the >> concomittant increased unreliability when storage is so damn cheap? >Embedded systems and mo

Re: [sqlite] Help with sqlite3_value_text

2019-04-12 Thread Keith Medcalf
Actually you would have to convert the strings to UCS-4. UTF-16 is a variable-length encoding. An actual "unicode character" is (at this present moment in time, though perhaps not tomorrow) 4 bytes (64-bits). --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lo

Re: [sqlite] Problem with SELECT by rowid after INSERT

2019-04-12 Thread Keith Medcalf
On Friday, 12 April, 2019 09:40, Jim Dossey wrote" This does not really make a lot of sense at all for the following reasons: >I have a table define like this: >CREATE TABLE "sessiond" ( >"journal" VARCHAR(4) DEFAULT '' NOT NULL, >"session" VARCHAR(16) DEFAULT '' NOT NULL, >"pid" INTEGER DEFA

[sqlite] finalize or reset? (was Problem with SELECT by rowid after INSERT)

2019-04-12 Thread Keith Medcalf
On Friday, 12 April, 2019 12:36, Richard Hipp wrote: >Perhaps the SELECT is running inside of a transaction that was >started >before you did the INSERT. For example, perhaps you didn't >sqlite3_finalize() the previous SELECT, which caused it to hold the >read transaction open. Is it not sqlit

Re: [sqlite] Problem with SELECT by rowid after INSERT

2019-04-12 Thread Keith Medcalf
On Friday, 12 April, 2019 14:48, Jim Dossey wrote: >On Apr 12, 2019, at 3:27 PM, Keith Medcalf wrote: >>> To be a little more specific, the problem happens when I try to do >>> sqlite3_bind_int() on the prepared statement using the new rowid. >It >>> d

Re: [sqlite] Help with sqlite3_value_text

2019-04-15 Thread Keith Medcalf
sqlite3_value_text and sqlite3_value_bytes will cause the conversion (if required) to UTF-8, and then return the data requested. sqlite3_value_text16 and sqlite3_value_bytes16 will cause the conversion (if required) to UTF-16 and then return the data requested. So if you call sqlite3_value_text

Re: [sqlite] Intersect and Minus

2019-04-15 Thread Keith Medcalf
On Monday, 15 April, 2019 13:31, Mohit Mathur wrote: >I am working on one sqllite query, in which i am doing left outer >join between two tables and than using intersect and again doing >left outer join between two other tablescolumns that i am >selecting are exactly same in number and dat

Re: [sqlite] [EXTERNAL] slow join, fast subselect

2019-04-17 Thread Keith Medcalf
Your made up plans are intriguing. The plan you show for the latter query omit to join a and b. Are you just making things up? sqlite> select a.rowid from a, b where a.ref=7 and a.rowid in (select rowid from b); QUERY PLAN |--SEARCH TABLE a USING COVERING INDEX aa (ref=? AND rowid=?) (~8 rows

Re: [sqlite] Use cases for sqlite3_value_frombind()?

2019-04-17 Thread Keith Medcalf
Simon, There are fields (columns) in your invoices table named 1.23 and 7524? Why did you do this (or did you just use the wrong quotes around text strings?) --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Origina

Re: [sqlite] Use cases for sqlite3_value_frombind()?

2019-04-17 Thread Keith Medcalf
nticipated traffic volume. >-Original Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf >Sent: Wednesday, 17 April, 2019 12:38 >To: SQLite mailing list >Subject: Re: [sqlite] Use cases for sqlite3_value_frombind(

Re: [sqlite] Table names starting with sqlite (not sqlite_)

2019-04-19 Thread Keith Medcalf
Ticket https://www.sqlite.org/src/info/f00d7b65 Fixed on trunk https://www.sqlite.org/src/info/a2ead8aa4517b63c --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Original Message- >From: sqlite-users [mailto:sqlite-u

Re: [sqlite] Is Cursor a 1 time only object?

2019-04-19 Thread Keith Medcalf
On Friday, 19 April, 2019 18:05, Andy Hegedus wrote: >Newbie here so please be gentle. That's OK. Just to let you know this is a little off topic since it is more discussing the Python pysqlite2 (sqlite3) wrapper than being about SQLite3 iteself -- however -- I will endeavour to answer your

Re: [sqlite] Multiple Independent Database Instances

2019-04-22 Thread Keith Medcalf
This is somewhat unclear. You make two conflicting statements: "I have been testing with 16, 32, and 48 threads/databases at once ..." and "time it takes for all of the threads to just open all (millions) of the databases" So, are you: (a) opening one independently and uniquely named database

Re: [sqlite] Multiple Independent Database Instances

2019-04-22 Thread Keith Medcalf
million database files sitting on my >filesystem. Each thread will open a previously unprocessed database >file, do some queries, close the database, and move on to the next >unprocessed database file. > > >Jason Lee > >____ >From: sqlite-user

Re: [sqlite] Multiple Independent Database Instances

2019-04-22 Thread Keith Medcalf
Interesting. If you can guarantee that you will only have a single thread accessing a single database only from one single thread, give it a try with SQLITE_OPEN_NOMUTEX | SQLITE_OPEN_READONLY in the flags parameter of sqlite3_open_v2 ... Don't know if it will make a difference, but it might.

Re: [sqlite] Regarding sqlite3 reliability in using in service oriented architecture

2019-04-28 Thread Keith Medcalf
I will leave aside the use of SHARED_CACHE which massively trades performance for memory usage (that is, it "totally kills" performance but also "hugely reduces" memory requirements) -- it trades a huge reduction in performance for a huge reduction in memory usage and changes some other things

Re: [sqlite] Regarding sqlite3 reliability in using in service oriented architecture

2019-04-28 Thread Keith Medcalf
On Sunday, 28 April, 2019 11:23, Lullaby Dayal asked: To answer your specific questions: >So my questions are:- >1. In auto-commit mode in serialized threading mode, how command >queueing works? auto-commit and transactions are an attribute of the connection and have nothing whatsoever to do

Re: [sqlite] Regarding sqlite3 reliability in using in service oriented architecture

2019-04-28 Thread Keith Medcalf
On Thursday, 25 April, 2019 19:10, Lullaby Dayal wrote: >We use sqlite3 in an embedded automotive system based on QNX >hypervisor running multiple virtual machines. Software is >architectured in a service oriented way. Interestingly, the default "database" service in QNX is (or at least was a

[sqlite] Minor Source Code Comment Typo in date.c lines 104 & 105 (No code change)

2019-04-30 Thread Keith Medcalf
In date.c at line 83: /* ** Convert zDate into one or more integers according to the conversion ** specifier zFormat. ** ** zFormat[] contains 4 characters for each integer converted, except for ** the last integer which is specified by three characters. The meaning ** of a four-character format

Re: [sqlite] Unique index that uses GLOB does not detect duplicate due to REAL conversion

2019-04-30 Thread Keith Medcalf
Actually, the affinity is applied first, however -- c0 has affinity "A" (blob) applied. c1 has affinity "E" (real) applied, but has the "tryForInteger" set which results in an integer value the GLOB function converts its arguments to text, so when it is presented with the "integer" c1 differen

Re: [sqlite] COLLATE NOCASE index on REAL column malfunctions

2019-05-01 Thread Keith Medcalf
Again, I think this is a problem with applying affinity when the index is created. The result of applying real affinity to the string '+/' should probably be the string '+/' not the real value 0. On the gripping hand, '+/' looks like a number with "crud" at the end of the string. I believe t

Re: [sqlite] logically stored rows

2019-05-01 Thread Keith Medcalf
On Wednesday, 1 May, 2019 15:56, Tom Bassel wrote: >In this page in the docs: >https://sqlite.org/queryplanner.html#searching >it says: >"The rows are logically stored in order of increasing rowid" >Would this imply that executing a SELECT would always return the rows >in order or increasing r

Re: [sqlite] Error when renaming a table when an invalid view exists in the schema

2019-05-03 Thread Keith Medcalf
Use PRAGMA LEGACY_ALTER_TABLE=ON; The "Legacy alter table" does not require the database to be "valid/consistent" after executing the "alter table" command. The non-legacy (default) mode requires that the database be "transformed" into a "valid/consistent" state in order for the alter table c

Re: [sqlite] Problem with REAL PRIMARY KEY

2019-05-04 Thread Keith Medcalf
The actual value is 5.7646075230342348e+17 or 5.764607523034235e+17 (depending on compiler, floating point mode, FPU rounding settings, etc.). This is a common problem with using = with floating point numbers ... You can find the actual exact value using: select printf('%!.20e', c1) from t1;

Re: [sqlite] Problem with REAL PRIMARY KEY

2019-05-04 Thread Keith Medcalf
There is, however, something weird: SQLite version 3.29.0 2019-05-04 17:32:07 Enter ".help" for usage hints. Connected to a transient in-memory database. Use ".open FILENAME" to reopen on a persistent database. sqlite> .version SQLite 3.29.0 2019-05-04 17:32:07 c2e439bccc40825e211bfa9a88e6a251ff

Re: [sqlite] Problem with REAL PRIMARY KEY

2019-05-04 Thread Keith Medcalf
e-users- >boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf >Sent: Saturday, 4 May, 2019 12:09 >To: SQLite mailing list >Subject: Re: [sqlite] Problem with REAL PRIMARY KEY > > >There is, however, something weird: > >SQLite version 3.29.0 2019-05-04 17:32:07 >En

Re: [sqlite] Problem with REAL PRIMARY KEY

2019-05-04 Thread Keith Medcalf
ing list >Subject: Re: [sqlite] Problem with REAL PRIMARY KEY > >Sorry, I should have anticipated that we get slightly different >values. >Shouldn't the query "SELECT * FROM t1 WHERE c1 IN (SELECT c1 FROM >t1);" >return a result though? > >Best, >Manuel >

Re: [sqlite] SQLite with single writer on Windows network share

2019-05-11 Thread Keith Medcalf
https://sourceforge.net/projects/mingw-w64/files/?source=navbar --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Original Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Beh

Re: [sqlite] CTE to Get Path In a Tree

2019-05-13 Thread Keith Medcalf
Assuming "right folder id" is short-hand for "the id of the rightmost folder" ... with folderpath(id, rightmost_folder_id, parent_id, path, rank) as ( select id, rightmost_folder_id, parent_id, name, rank from folders union all select f.id, rightmost_folder_id, f.par

Re: [sqlite] CTE to Get Path In a Tree

2019-05-13 Thread Keith Medcalf
Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Original Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf >Sent: Monday, 13 May, 2019 19:46 >To: SQLite mailing list >Subject:

Re: [sqlite] CSV import does not handle fields with a comma surrounded by double

2019-05-21 Thread Keith Medcalf
On Tuesday, 21 May, 2019 07:55, Richard Hipp wrote: >On 5/21/19, Patrick Sherrill wrote: >> I don’t know about ‘valid’ csv, it has been a moving target for >>decades. >> White space as far as my recollection should not be considered in >>parsing a csv. >I'm going by RFC 4180. https://tools.i

Re: [sqlite] SQL Features That SQLite Does Not Implement

2019-05-22 Thread Keith Medcalf
On Wednesday, 22 May, 2019 11:51, sky5w...@gmail.com wrote: >Please add a note to the omitted page that many basic math functions >are NOT supported. (sqrt,mod,power,stdev,etc.) Traditionally "math library" functions provided by the various language runtimes were not included becase this would

Re: [sqlite] Have SQLite handle values of my own type

2019-05-22 Thread Keith Medcalf
On Wednesday, 22 May, 2019 19:06, Simon Slavin wrote: >Since there are people posting who appear know about these things … >Suppose I want SQlite to handle my own type. Or to do its best to >simulate that. IP address, x/y location, something like that. What >should I be doing ? Do I store B

[sqlite] User Defined Types implementations ...

2019-05-22 Thread Keith Medcalf
On Wednesday, 22 May, 2019 16:56, James K. Lowden wrote: >On Wed, 22 May 2019 14:20:11 -0600 >"Keith Medcalf" wrote: >> (such as was added to DB2 back in the late 80's early 90's, and >> which I do not think anyone else has implemented as nicely any

Re: [sqlite] SQL Features That SQLite Does Not Implement

2019-05-22 Thread Keith Medcalf
t;some kind of a "check function" so that one could write > >SELECT CASE WHEN defined('stddev') THEN stddev(foo) ELSE NULL END >FROM bar > > >- Original Message - >From: Keith Medcalf >To: SQLite mailing list >Sent: Wednesday, May 22, 2019, 22

Re: [sqlite] SQL Features That SQLite Does Not Implement

2019-05-22 Thread Keith Medcalf
27;) THEN stddev(foo) ELSE NULL END >FROM bar > > >- Original Message - >From: Keith Medcalf >To: SQLite mailing list >Sent: Wednesday, May 22, 2019, 22:20:11 >Subject: [sqlite] SQL Features That SQLite Does Not Implement > > >On Wednesday, 22 May, 2019 11:51,

Re: [sqlite] SQL Features That SQLite Does Not Implement

2019-05-23 Thread Keith Medcalf
ut it is still very unconvenient. How >can I define a view based on your suggestion? I want to have >something like > >CREATE VIEW foo AS SELECT {if has stddev then stddev(...) else null} >FROM ... > >- Original Message - >From: Keith Medcalf >To: SQLite mailing list >

Re: [sqlite] SQL Features That SQLite Does Not Implement

2019-05-23 Thread Keith Medcalf
On Thursday, 23 May, 2019 02:08, Dominique Devienne wrote: >On Thu, May 23, 2019 at 7:39 AM Keith Medcalf >wrote: >> You can check if what you need is available on a connection and >either load it if needed or just abort: >> sqlite> select * from pragma_function_lis

Re: [sqlite] Have SQLite handle values of my own type

2019-05-23 Thread Keith Medcalf
On Thursday, 23 May, 2019 08:35, Dominique Devienne wrote: >On Thu, May 23, 2019 at 3:50 PM Jose Isaias Cabrera > wrote: > >> I have been working network for a long time, and I have never seen >> any application that takes "zeroed left-filled" IP addresses. Just >> sharing... >> Thanks. > Works

Re: [sqlite] User Defined Types implementations ...

2019-05-23 Thread Keith Medcalf
On Thursday, 23 May, 2019 14:39, Jens Alfke wrote: >> On May 22, 2019, at 8:16 PM, Keith Medcalf >wrote: >> Basically, User Defined Types (UDT) were implemented in a fashion >analgous to a C++ class (remember that at this time C++ was just a >pre-processor for C and a

Re: [sqlite] round function inconsistent

2019-05-24 Thread Keith Medcalf
sqlite> select roundhe(3.255, 2); 3.26 sqlite> select printf('%!.18f', 3.255); 3.254893 sqlite> select printf('%!.18f', roundhe(3.255, 2)); 3.259787 sqlite> select printf('%!.18f', pow(10.0, 2)); 100.0 sqlite> select printf('%!.18f', pow(10.0, 2) * 3.255); 325.5 The good:

Re: [sqlite] Making blob as a sqlite database.

2019-05-28 Thread Keith Medcalf
https://sqlite.org/c3ref/deserialize.html https://sqlite.org/c3ref/serialize.html --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Original Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sq

Re: [sqlite] I am unable to build sqlite3 on windows. Possible errors in https://sqlite.org/src/doc/trunk/README.md

2019-05-29 Thread Keith Medcalf
D:\Source\SQLite3 contains the fossil checkout of trunk D:\Source\Bld is an empty directory D:\Source\Bld>nmake -f ..\sqlite3\makefile.msc sqlite3.c TOP=..\sqlite3 ... for the rest of the targets you want In other words, you point to the makefile.msc wherever it may be found, and set TOP= t

Re: [sqlite] select * where abc like "xxx" works, ...where abc='xxx' fails

2019-06-03 Thread Keith Medcalf
>Why does the "=" query fail and the "like" query work? There are no >wildcards involved. >The behavior is the same in Sqlite command line. There are no >wildcards involved. sqlite> create table songfiletable ( ...> songfile_id integer primary key, ...> dancename text ...> ); sqlite> in

[sqlite] New Information Schema Views

2019-06-06 Thread Keith Medcalf
This is an update to the Schema Information views that I previously posted. This version has the capability to display information for all available schema names (attached databases) simultaneously. It requires that the SQL function "eval" be available since it runs dynamically generated SQL

Re: [sqlite] New Information Schema Views

2019-06-07 Thread Keith Medcalf
Improved version that does not execute the eval multiple times. I have not renamed the columns match the ANSI INFORMATION_SCHEMA views, though I suppose that might be possible (though I find that schema yucky -- it embodies the thinking from decades ago where one would embed table names into c

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 suspe

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] 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 declared

Re: [sqlite] Should SQLite distinguish between +0.0 and -0.0 on output?

2019-06-12 Thread Keith Medcalf
On Wednesday, 12 June, 2019 07:35, Richard Hipp wrote: >IEEE754 floating point numbers have separate representations for +0.0 >and -0.0. As currently implemented, SQLite always display both >quantities as just "0.0". >Question: Should SQLite be enhanced to show -0.0 as "-0.0"? Or, >would that

Re: [sqlite] Should SQLite distinguish between +0.0 and -0.0 on output?

2019-06-12 Thread Keith Medcalf
On Wednesday, 12 June, 2019 10:02, James K. Lowden wrote: >1. Prior art. I can't think of a single programming language that >displays -0.0 without jumping through hoops. ---//--- t.c ---//--- #include int main(int argc, char** argv) { printf("%f %f\n", -0.0, 0.0); } ---//--- t.c ---//

Re: [sqlite] Should SQLite distinguish between +0.0 and -0.0 on output?

2019-06-12 Thread Keith Medcalf
t(s) in 0.44s Running `target\release\demo.exe` 0 0 -0.0 0.0 --- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Original Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqli

Re: [sqlite] [EXTERNAL] Re: Should SQLite distinguish between +0.0 and -0.0 on output?

2019-06-13 Thread Keith Medcalf
Perhaps this should be handled the same way as Inf and -Inf. For the purposes of conversion to text the value should be 0.0. However, for the purposes of .dump the actual -0.0 should be output just as Inf and -Inf are output as 1e999 and -1e999 respectively, since the purpose of .dump is to b

Re: [sqlite] [SPAM?] Re: [EXTERNAL] Re: Should SQLite distinguish between +0.0 and -0.0 on output?

2019-06-13 Thread Keith Medcalf
On Thursday, 13 June, 2019 11:28, Doug wrote: >It occurs to me that if there are sqlite applications today requiring >the functionality of -0.0, they have implemented it so that it works >for their application. Perhaps, they accomplished that by adding a >flag bit or by some other means. >So if

Re: [sqlite] [SPAM?] Re: [EXTERNAL] Re: Should SQLite distinguish between +0.0 and -0.0 on output?

2019-06-13 Thread Keith Medcalf
On Thursday, 13 June, 2019 15:01, Donald Shepherd wrote: >Given there's been numerous comments to the effect that SQLite now >supports -0.0 storing and retrieval other than printing, I'm curious >which version this was implemented in as I wouldn't mind removing my >custom code when we move to

Re: [sqlite] [SPAM?] Re: [EXTERNAL] Re: Should SQLite distinguish between +0.0 and -0.0 on output?

2019-06-13 Thread Keith Medcalf
On Thursday, 13 June, 2019 15:21, Donald Shepherd wrote: >On Fri, 14 Jun 2019 at 7:11 am, Richard Hipp wrote: >> On 6/13/19, Donald Shepherd wrote: >>> Given there's been numerous comments to the effect that SQLite >>> now supports -0.0 storing and retrieval other than printing, >>> I'm cur

Re: [sqlite] [SPAM?] Re: [EXTERNAL] Re: Should SQLite distinguish between +0.0 and -0.0 on output?

2019-06-13 Thread Keith Medcalf
n of SQLite Database >Subject: Re: [sqlite] [SPAM?] Re: [EXTERNAL] Re: Should SQLite >distinguish between +0.0 and -0.0 on output? > >On Fri., 14 Jun. 2019, 7:43 am Keith Medcalf, >wrote: > >> On Thursday, 13 June, 2019 15:21, Donald Shepherd < >> donald.sheph...@gm

Re: [sqlite] Please explain multi-access behaviour to me

2019-06-17 Thread Keith Medcalf
On Monday, 17 June, 2019 17:50, Simon Slavin wrote: >Can someone please explain this error message to me: > >Simple database, journal mode set to 'delete', accessed by two >simultaneous sessions running the SQLite command-line shell, >SQLite version 3.28.0 2019-04-15 14:49:49 > >Session A: > >PRA

Re: [sqlite] Please explain multi-access behaviour to me

2019-06-17 Thread Keith Medcalf
If you intend to update the database (ie, write to it) during a transaction, you should begin that transaction with BEGIN IMMEDIATE; This signals that you intend to WRITE to the database in that transaction and will prevent any other connection from obtaining an INTENT (to write) lock. BEGIN

Re: [sqlite] Please explain multi-access behaviour to me

2019-06-17 Thread Keith Medcalf
On Monday, 17 June, 2019 18:46, Simon Slavin wrote: >I think I see my error. I thought that the lock was promoted from >read to read/write when the INSERT command was processed. At this >point, SQLite knows that it is going to need to write. >Instead, although SQLite knows that it is going to

Re: [sqlite] Please explain multi-access behaviour to me

2019-06-17 Thread Keith Medcalf
On Monday, 17 June, 2019 18:46, Simon Slavin wrote: >I think I see my error. I thought that the lock was promoted from >read to read/write when the INSERT command was processed. At this >point, SQLite knows that it is going to need to write. >Instead, although SQLite knows that it is going to

Re: [sqlite] Please explain multi-access behaviour to me

2019-06-17 Thread Keith Medcalf
On Monday, 17 June, 2019 21:36, Simon Slavin wrote: >I understand about the RESERVED lock. I read the documentation. My >surprise was at this, from further down the same page: >" No EXCLUSIVE lock is acquired until either the memory cache fills >up and must be spilled to disk or until the tra

Re: [sqlite] Please explain multi-access behaviour to me

2019-06-18 Thread Keith Medcalf
On Tuesday, 18 June, 2019 07:12, Thomas Kurz wrote: >This has been a very informative and helpful discussion. Thank you. >So have I understood correctly, that in an application, this kind of >SQLITE_BUSY handling is sufficient: >BEGIN >UPDATE #1 >SELECT #2 >UPDATE #3 >COMMIT <- check for b

Re: [sqlite] Please explain multi-access behaviour to me

2019-06-18 Thread Keith Medcalf
sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf >Sent: Tuesday, 18 June, 2019 08:25 >To: SQLite mailing list >Subject: Re: [sqlite] Please explain multi-access behaviour to me > > >On Tuesday, 18 June, 2019 07:12, Thomas Kurz >w

Re: [sqlite] pragma trigger_info?

2019-06-21 Thread Keith Medcalf
What do you want for trigger info? The following pragma code will return all the data in the currently loaded schema for all attached databases (table/index/trigger names). It creates a new pragma called DATABASE_INFO (and table pragme_database_info) that returns three columns: schema type na

Re: [sqlite] pragma trigger_info?

2019-06-22 Thread Keith Medcalf
- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume. >-Original Message- >From: sqlite-users [mailto:sqlite-users- >boun...@mailinglists.sqlite.org] On Behalf Of Keith Medcalf >Sent: Friday, 21 June, 2019 15:

Re: [sqlite] the sqlite3 documentation would be pretty good if itwasn't tragic...

2019-06-26 Thread Keith Medcalf
On Wednesday, 26 June, 2019 10:59, a...@zator.com wrote: >Irreproachable argumentation, which in my humble opinion is little or >nothing useful to those who want to enter in the diabolic world of >SQL. Especially, if you have not yet managed to change the chip and >find out that for example, you

Re: [sqlite] wal

2019-06-28 Thread Keith Medcalf
On Friday, 28 June, 2019 07:37, Thomas Kurz wrote: >> A WAL file left behind is a sign of a problem in the app which >should be corrected. >I have exactly this problem and don't like the SHM and WAL files >being left behind. I have even tried "pragma wal_checkpoint(full)" >before closing the co

Re: [sqlite] How lock is implemented upon write?

2019-07-02 Thread Keith Medcalf
On Tuesday, 2 July, 2019 13:26, Peng Yu : >I not sure how to use os_unix.c. Are there any easy to follow >examples in python? YOU do not use os_unix.c. Perhaps you can state what it is that you are trying to accomplish. For example: I would like to know how I drive a car to the supermarket

Re: [sqlite] How lock is implemented upon write?

2019-07-03 Thread Keith Medcalf
On Wednesday, 3 July, 2019 11:59, Peng Yu wrote: >As I said in my original message "I am trying to understand how lock >is implemented in sqlite3". from os_unix.c: /* The following describes the implementation of the various locks and ** lock transitions in terms of the POSIX advisory shar

Re: [sqlite] How lock is implemented upon write?

2019-07-05 Thread Keith Medcalf
On Friday, 5 July, 2019 12:26, Peng Yu : >There is something shown below that uses SQLite3, but it still does >not go deeper into reimplementing using the raw code available from >SQLite3. This implementation merely calls SQLite3. >https://github.com/pypa/pip/blob/master/src/pip/_vendor/lockfile

Re: [sqlite] Is WAL mode serializable?

2019-07-09 Thread Keith Medcalf
On Tuesday, 9 July, 2019 20:34, Andy Bennett wrote: >However, the wording for WAL mode is confusing me. >isolation.html says 'all transactions in SQLite show "serializable" >isolation.' but it also says 'In WAL mode, SQLite exhibits "snapshot >isolation"'. >Snapshot Isolation and Serializable

Re: [sqlite] Grammar police

2019-07-12 Thread Keith Medcalf
>> I can highly recommend the book “Word by Word: The Secret Life of >> Dictionaries,” written by one of the editors at Merriam-Webster. >> The author spends much of her book illustrating why prescriptivist >> approaches to language are doomed to failure. Merriam-Webster does not publish a Dictio

<    1   2   3   4   5   6   7   8   9   10   >