Re: [sqlite] Explicit "read transaction" with journal_mode=WAL.

2019-07-30 Thread Keith Medcalf
On Tuesday, 30 July, 2019 13:01, test user asked: >How sure are you that "any SELECT that reads from the DB file starts >a read transaction"? Well, it is not that it starts a transaction so much as it acquires a shared lock. You cannot read data from a database file without first having

Re: [sqlite] Proposal: SQLite on DNA

2019-07-25 Thread Keith Medcalf
Considering the write speed is measured in kb/week I don't think it will be used for online storage anytime in the lifetime of anyone within the spin of these electrons ... -- The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume.

Re: [sqlite] Seg fault using json_each() subquery

2019-07-23 Thread Keith Medcalf
Yes, that old version (from about 2 years ago) crashes (on Windows). No, the current one does not crash and produces two output lines. This is using your test SQL with the spelling errors fixed. CREATE TABLE mimmo (key TEXT PRIMARY KEY, value TEXT, valueJson TEXT, blockNo INTEGER, txnNo

Re: [sqlite] [SPAM?] Re: [EXTERNAL] Determining valid statement placeholders.

2019-07-22 Thread Keith Medcalf
was appropriated by Microsoft and became SQL Server). The $name is because that is how TCL variables are accessed and SQLite3 was originally a TCL extension. >> On Jul 22, 2019, at 9:22 AM, Keith Medcalf >wrote: >> >> >> I don't see what is so hard. APSW does it: &

Re: [sqlite] [EXTERNAL] Determining valid statement placeholders.

2019-07-22 Thread Keith Medcalf
unbound >placeholders set to null (the SQLite default). > >Id like the ability to instead throw an error in this case. > > >I think SQLite internally knows how many placeholders are in the >query at >parse time. > >My question is how can I get the data via the

Re: [sqlite] [EXTERNAL] Determining valid statement placeholders.

2019-07-22 Thread Keith Medcalf
On Monday, 22 July, 2019 04:34, Enzo wrote: >It is not the same information. >I want to be able to determine "has the user bound all placeholder >values with data?". >The user provides this as input: >query="SELECT ?, ?10" >data={"0": "data-a", "10": "data-b"} >Note: This IS valid, as they

Re: [sqlite] I can insert multiple rows with the same primary key when one of the value of the PK is NULL ...

2019-07-18 Thread Keith Medcalf
Except in SQLite where as a documented behavioural anomaly maintained for backwards compatibility it simply means "UNIQUE" (for ROWID tables). And UNIQUE indexes may have NULL components. This is because despite your wishing that your primary key is the primary key, it is not the primary

Re: [sqlite] [EXTERNAL] Re: how to delete BLOB object from the data base

2019-07-15 Thread Keith Medcalf
>-Original Message- >From: Keith Medcalf [mailto:kmedc...@dessus.com] >Sent: Monday, 15 July, 2019 19:13 >To: 'SQLite mailing list' >Subject: RE: [sqlite] [EXTERNAL] Re: how to delete BLOB object from >the data base > > >Use one connection. Use one thread.

Re: [sqlite] [EXTERNAL] Re: how to delete BLOB object from the data base

2019-07-15 Thread Keith Medcalf
Use one connection. Use one thread. As follows: sqlite *db; sqlite_stmt *beginstatement; sqlite_stmt *commitstatement; sqlite_stmt *insertstatement; sqlite_stmt *deletestatement; int i = 0; sqlite_open_v2('database.db', , ...); sqlite_prepare_v2(db, "begin immediate", , ...);

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

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

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

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

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

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

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

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

2019-06-18 Thread Keith Medcalf
te-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 >wrote:

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

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

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

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

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 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: >

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

2019-06-13 Thread Keith Medcalf
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...@gmail.c

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

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

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

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.sqlite.or

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

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

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

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

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=

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

2019-05-29 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-

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

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] SQL Features That SQLite Does Not Implement

2019-05-23 Thread Keith Medcalf
till 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 >Sent: Thu

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

2019-05-22 Thread Keith Medcalf
v(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, sky5w...@gmail.

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

2019-05-22 Thread Keith Medcalf
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:20:11 >Subject: [sqli

[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 anywhere >

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

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

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

2019-05-13 Thread Keith Medcalf
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: [sqlit

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,

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

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 > >On Sa

Re: [sqlite] Problem with REAL PRIMARY KEY

2019-05-04 Thread Keith Medcalf
rs- >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
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

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

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

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

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

[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

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

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

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

Re: [sqlite] Multiple Independent Database Instances

2019-04-22 Thread Keith Medcalf
ion 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-users

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

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

2019-04-17 Thread Keith Medcalf
pated 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()? &g

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.

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

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

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

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

[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

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

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

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

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: &g

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

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" su

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

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

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

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

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 *

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;

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

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

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

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

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 Behalf

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