Re: [sqlite] Using CTE with date comparison

2018-08-03 Thread Csányi Pál
2018-08-02 23:12 GMT+02:00 R Smith : > On 2018/08/02 10:29 PM, Csányi Pál wrote: >> >> Hi, >> >> I just want to know why the following SQLite query does not work as I >> expected? >> >> WITH RECURSIVE dates(dateD) AS ( VALUES('2015-10-03') UNION ALL SELECT >> date(dateD, '+1 year') FROM dates

Re: [sqlite] Common index for multiple databases

2018-08-03 Thread Ling, Andy
> another point that I did not make clear. The accounting programs are not > associated with the technical programs, different people, different security > access. The tech databases and programs are in portable computers that go out > in the field, but not the accounting, etc. There indexes

Re: [sqlite] Using CTE with date comparison

2018-08-03 Thread Csányi Pál
2018-08-02 23:12 GMT+02:00 R Smith : > On 2018/08/02 10:29 PM, Csányi Pál wrote: >> >> Hi, >> >> I just want to know why the following SQLite query does not work as I >> expected? >> >> WITH RECURSIVE dates(dateD) AS ( VALUES('2015-10-03') UNION ALL SELECT >> date(dateD, '+1 year') FROM dates

Re: [sqlite] [EXTERNAL] Common index for multiple databases

2018-08-03 Thread Hick Gunter
This is what I think you are asking: - You have a "main office" computer that holds the current information on "everything" - You have several different categories of users (technicians, accountant, ...) that require different subsets of the data - Each user has his own computer, that may be

Re: [sqlite] Common index for multiple databases

2018-08-03 Thread Paul Sanderson
On 2 August 2018 at 20:08, Keith Medcalf wrote: Further to this, you can "emulate" the current structure by creating multiple databases each containing only the tables needed for that "bit" of your application. For example, you can create a customers.db containing the customers table and all

Re: [sqlite] Common index for multiple databases

2018-08-03 Thread Ling, Andy
> another point that I did not make clear. The accounting programs are not > associated with the technical programs, different people, different security > access. The tech databases and programs are in portable computers that go out > in the field, but not the accounting, etc. There indexes

Re: [sqlite] Using CTE with date comparison

2018-08-03 Thread Csányi Pál
2018-08-03 13:09 GMT+02:00 R Smith : > > > On 2018/08/03 12:35 PM, Csányi Pál wrote: >> >> 2018-08-02 23:12 GMT+02:00 R Smith : >>> >>> On 2018/08/02 10:29 PM, Csányi Pál wrote: Hi, I just want to know why the following SQLite query does not work as I expected?

Re: [sqlite] Using CTE with date comparison

2018-08-03 Thread R Smith
On 2018/08/03 12:35 PM, Csányi Pál wrote: 2018-08-02 23:12 GMT+02:00 R Smith : On 2018/08/02 10:29 PM, Csányi Pál wrote: Hi, I just want to know why the following SQLite query does not work as I expected? WITH RECURSIVE dates(dateD) AS ( VALUES('2015-10-03') UNION ALL SELECT date(dateD,

Re: [sqlite] Common index for multiple databases

2018-08-03 Thread Keith Medcalf
Not exactly. The index is stored in the SAME FILE that contains the table. For example in dBase I (or II or III) you might have the following files: Customer.DBF CustNo.NDX CustName.NDX where the two NDX files index fields from the Customer.DBF file. In FoxPro you can have "compound"

Re: [sqlite] Common index for multiple databases

2018-08-03 Thread Simon Slavin
On 3 Aug 2018, at 7:52pm, John R. Sowden wrote: > My concern in using Sqlite is since the index is embedded into the database > file with various tables, if I am running multiple Sqlite database files, how > do I use a common index for the different database files. Okay. Thanks for that

Re: [sqlite] mmap, madvise, mlock and performance

2018-08-03 Thread Warren Young
On Aug 3, 2018, at 1:36 PM, Shevek wrote: > > the database is read-only In that case, I’d just create a :memory: DB on application startup, attach to the disk copy, use the INSERT FROM … SELECT pattern [1] to clone the data content within a single transaction, create the indexes, and detach

Re: [sqlite] Common index for multiple databases

2018-08-03 Thread Keith Medcalf
On Friday, 3 August, 2018 13:50, Warren Young wrote: >I’d be careful trying to apply your knowledge directly to SQLite. >dBase comes out of the non-SQL world, so it’s going to have a >different outlook in many areas. >If the following is a fair description of how FoxPro for DOS indexes >work,

Re: [sqlite] Save text file content in db: lines or whole file?

2018-08-03 Thread Richard Hipp
On 8/3/18, Abroży Nieprzełoży wrote: > > I would also consider keeping the largest files external to the > database. https://www.sqlite.org/intern-v-extern-blob.html > See also https://www.sqlite.org/fasterthanfs.html Yes, it is a little faster to store larger files directly in the filesystem.

Re: [sqlite] Common index for multiple databases

2018-08-03 Thread John R. Sowden
I have the xbase type of databases down tight, having been using them since I bought my copy of dBASE II from George Tate of Ashton-Tate at a West Coast Computer Faire in 1981.  I have been writing applications for my alarm company, now through Foxpro 2.6 in DOS.  I understand what an index

[sqlite] Save text file content in db: lines or whole file?

2018-08-03 Thread Abramo Bagnara
I need to save text files (let say between 1 KB to 20 MB) in a SQLite DB. I see two possibilities: 1) save all the content in a single column: create table content(id integer not null primary key, text blob not null); 2) split the content in lines: create table

Re: [sqlite] Common index for multiple databases

2018-08-03 Thread Richard Hipp
On 8/3/18, John R. Sowden wrote: > I have the xbase type of databases down tight, having been using them > since I bought my copy of dBASE II from George Tate of Ashton-Tate at a > West Coast Computer Faire in 1981. Are you using indexes to impose uniqueness constraints across multiple tables?

[sqlite] mmap, madvise, mlock and performance

2018-08-03 Thread Shevek
Hi, We are running a 100Gb sqlite database, which we mmap entirely into RAM. We are having trouble with parts of the disk file being evicted from RAM during periods of low activity causing slow responses, particularly before 9am. Has anybody played with mlock and/or madvise within the

Re: [sqlite] Save text file content in db: lines or whole file?

2018-08-03 Thread Simon Slavin
On 3 Aug 2018, at 8:04pm, Abramo Bagnara wrote: > Some queries will need to extract the whole file, while other queries > will need to extract the text for a range of lines. Can you give us an idea of how many lines you expect per text file ? Minimum and maximum for 90% of the files would be

Re: [sqlite] Common index for multiple databases

2018-08-03 Thread Warren Young
On Aug 3, 2018, at 12:52 PM, John R. Sowden wrote: > > I have the xbase type of databases down tight I’d be careful trying to apply your knowledge directly to SQLite. dBase comes out of the non-SQL world, so it’s going to have a different outlook in many areas. > I understand what an index

[sqlite] Save text file content in db: lines or whole file?

2018-08-03 Thread Abramo Bagnara
Il 03/08/2018 21:50, Simon Slavin ha scritto: > On 3 Aug 2018, at 8:04pm, Abramo Bagnara wrote: > >> Some queries will need to extract the whole file, while other queries >> will need to extract the text for a range of lines. > > Can you give us an idea of how many lines you expect per text

Re: [sqlite] Save text file content in db: lines or whole file?

2018-08-03 Thread Abroży Nieprzełoży
-- One table with whole files CREATE TABLE content( id INTEGER PRIMARY KEY, data BLOB NOT NULL ); -- And second table with line boundaries CREATE TABLE lines( id INTEGER NOT NULL REFERENCES content(id), line_no INTEGER NOT NULL, bytes_from INTEGER NOT NULL,

Re: [sqlite] mmap, madvise, mlock and performance

2018-08-03 Thread Simon Slavin
On 3 Aug 2018, at 8:36pm, Shevek wrote: > We are running a 100Gb sqlite database, which we mmap entirely into RAM. We > are having trouble with parts of the disk file being evicted from RAM during > periods of low activity causing slow responses, particularly before 9am. Has > anybody played

Re: [sqlite] Using CTE with date comparison

2018-08-03 Thread Kees Nuyt
On Fri, 3 Aug 2018 15:11:06 +0200, Csányi Pál wrote: >The database is so far with only one table: >CREATE TABLE MyLengthOfService ( >id INT PRIMARY KEY > UNIQUE, >WorkPlaceName TEXT, You shouldn't use UNIQUE for the PRIMARY KEY. Any PRIMARY KEY is

[sqlite] virtual table module not found needs better logging

2018-08-03 Thread Ben Manashirov
if( pMod==0 || pMod->pModule->xCreate==0 || pMod->pModule->xDestroy==0 ){ *pzErr = sqlite3MPrintf(db, "no such module: %s", zMod); rc = SQLITE_ERROR; }else{ rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xCreate, pzErr); } That code doesn't tell me I have not implemented xDestroy.. I

Re: [sqlite] Save text file content in db: lines or whole file?

2018-08-03 Thread Abramo Bagnara
Il 03/08/2018 23:53, Abroży Nieprzełoży ha scritto: > -- One table with whole files > CREATE TABLE content( > id INTEGER PRIMARY KEY, > data BLOB NOT NULL > ); > -- And second table with line boundaries > CREATE TABLE lines( > id INTEGER NOT NULL REFERENCES content(id), >