[sqlite] Changing the default page_size in 3.12.0

2016-03-04 Thread jose isaias cabrera
Ever-since you suggested to me to change the default page size to 4096, a few years back, I have always set my default to that size. jos? -Original Message- From: Richard Hipp Sent: Friday, March 04, 2016 10:48 AM To: General Discussion of SQLite Database ; sqlite-dev Subject:

[sqlite] How to use sqlite3_blob_open when the blob column is empty?

2016-03-04 Thread zhangkai.gis
Thanks,I have set a value for the blob.Then sqlite3_blob_open returns SQLITE_OK.Then I use sqlite3_blob_write to update the blob.I notice that.It must have enough capacity to hold the writes. 2016-03-04 zhangkai.gis

[sqlite] Assertion hit in sqlite3VarintLen

2016-03-04 Thread Martin Raiber
Hi, I have used sqlite3VarintLen outside of SQLite and noticed that the assertion in this function is hit if the highest bit is set (and it returns 10 when it should return 9). E.g. with sqlite3VarintLen(0xF000); It could be that this is not relevant to SQLite as it is guaranteed

[sqlite] Changing the default page_size in 3.12.0

2016-03-04 Thread Richard Hipp
On 3/4/16, tonyp at acm.org wrote: > I ran some tests and almost all of my databases (about 100 of them with > different content mix and with the biggest one being around 500MB) inflated Can you run sqlite3_analyzer on some of your databases and send me the output? > > by a lot while only a

[sqlite] SQLite Corruption By Writing NULL Data

2016-03-04 Thread sanhua.zh
I use the C API. I think it is not possible to get the hole call stack if continue using the released SQLite pointer. ???:Simon Slavinslavins at bigfraud.org ???:SQLite mailing listsqlite-users at mailinglists.sqlite.org :2016?3?4?(??)?17:50 ??:Re: [sqlite] SQLite Corruption By Writing

[sqlite] Changing the default page_size in 3.12.0

2016-03-04 Thread Dominique Devienne
On Fri, Mar 4, 2016 at 4:48 PM, Richard Hipp wrote: > https://www.sqlite.org/draft/releaselog/3_12_0.html - from 2000 to -2000 + from 2000 to 500 [OT] The PRAGMA defer_foreign_keys=ON statement now also disables RESTRICT actions on foreign key. I've confused by that Richard. Does that

[sqlite] Are BLOB stored inline with the rest of the record fields?

2016-03-04 Thread Dominique Devienne
On Fri, Mar 4, 2016 at 4:45 PM, Eric Grange wrote: > [...] why can't we both have our cake and eat it? :) > Exactly. That's why I've been asking/advocating for out-of-row (large) blobs for a while now. See for example http://permalink.gmane.org/gmane.comp.db.sqlite.general/97686. --DD

[sqlite] Understanding conditional triggers

2016-03-04 Thread R Smith
On 2016/03/03 2:55 AM, Sam Carleton wrote: > I am working on a trigger that only needs to be fired when the value for > the column 'Selected' is 1. How exactly do I write that trigger? Here is > what I have come up with: > > CREATE TRIGGER IF NOT EXISTS tu_Favorite_add_to_SlideShowImage AFTER

[sqlite] Are BLOB stored inline with the rest of the record fields?

2016-03-04 Thread Eric Grange
Thanks for all the details! I was already storing the really large blobs in their own tables. However I will have to review the situations for smallish blobs (about as large as the rest of the fields in a record), as moving them to another table would halve the number of pages involved for

[sqlite] Mixing text and numeric values in comparisons

2016-03-04 Thread R Smith
On 2016/03/04 4:29 PM, Paul van Helden wrote: > On Fri, Mar 4, 2016 at 4:23 PM, Igor Tandetnik wrote: > >> On 3/4/2016 9:15 AM, Paul van Helden wrote: >> >>> So I have to detect integers in order to avoid the .0 >>> >> WHERE CAST(A as integer) = 1 >> >> > Not quite going to work either. I

[sqlite] Mixing text and numeric values in comparisons

2016-03-04 Thread Paul van Helden
On Fri, Mar 4, 2016 at 4:23 PM, Igor Tandetnik wrote: > On 3/4/2016 9:15 AM, Paul van Helden wrote: > >> So I have to detect integers in order to avoid the .0 >> > > WHERE CAST(A as integer) = 1 > > Not quite going to work either. I should have said the values are _nearly_ always integers, but

[sqlite] SQLite Corruption By Writing NULL Data

2016-03-04 Thread sanhua.zh
I am debugging db corruption. After I get some corrupted db, I found that they all corrupted by writing null data. So, I decide to add some check and dump call stackin the source code in order to find out who corrupts the db. Here is the code I added in the source code. int

[sqlite] Mixing text and numeric values in comparisons

2016-03-04 Thread Paul van Helden
Hi Richard, Thank you for the quick reply. I cannot change the type of the column. The tables are user defined and need to be matched with other user defined tables. The values are always integers but can be in any type of column. So I have to detect integers in order to avoid the .0 How do

[sqlite] attach db limit

2016-03-04 Thread Simon Slavin
On 4 Mar 2016, at 4:02pm, Tim Uy wrote: > So Richard, theoretically, if you use negative numbers, you can get another > x2? Tim, are you actually considering attaching lots of databases at once ? This is a terrible idea. Every time you refer to an attached database SQLite has to find it.

[sqlite] Assertion hit in sqlite3VarintLen

2016-03-04 Thread Richard Hipp
On 3/4/16, Martin Raiber wrote: > Hi, > > I have used sqlite3VarintLen outside of SQLite and noticed that the > assertion in this function is hit if the highest bit is set (and it > returns 10 when it should return 9). E.g. with > > sqlite3VarintLen(0xF000); > > It could be that this

[sqlite] Mixing text and numeric values in comparisons

2016-03-04 Thread Paul van Helden
Hi All, CREATE TABLE test (A TEXT); INSERT INTO test VALUES ('1'); SELECT * FROM test WHERE A=1; // returns 1 SELECT * FROM test WHERE A=1.0; // returns nothing How is the second comparison done? I realize that you can have double values that are too large to convert to int64, but as I

[sqlite] How to use sqlite3_blob_open when the blob column is empty?

2016-03-04 Thread Clemens Ladisch
zhangkai wrote: > insert into device(ieee) values(12345); > int ret = sqlite3_blob_open(db, > "main", > "device", > "endpoint", > 12345, > 1, > ); The documentation says: | This function fails ... if

[sqlite] Understanding conditional triggers

2016-03-04 Thread Clemens Ladisch
Sam Carleton wrote: > I am working on a trigger that only needs to be fired when the value for > the column 'Selected' is 1. How exactly do I write that trigger? Here is > what I have come up with: > > ... WHEN (NEW.Selected = 1) ... Looks OK. What is the problem with that? Regards, Clemens

[sqlite] Changing the default page_size in 3.12.0

2016-03-04 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 04/03/16 07:48, Richard Hipp wrote: > The tip of trunk (3.12.0 alpha) changes the default page size for > new database file from 1024 to 4096 bytes. ... This seems like a > potentially disruptive change, so I want to give you, the user > community,

[sqlite] attach db limit

2016-03-04 Thread Richard Hipp
On 3/4/16, Tim Uy wrote: > > Re: below, what happens if I change the sqlite3_limit to 10 when I have 20 > attached. Will it complain? No. It just won't let you ATTACH new databases until you DETACH enough to get the count down below 10. -- D. Richard Hipp drh at sqlite.org

[sqlite] Can I implement a scrolling window using LIMIT and OFFSET ?

2016-03-04 Thread R Smith
On 2016/03/04 10:35 AM, Darren Duncan wrote: > On 2016-03-03 11:27 AM, James K. Lowden wrote: >> >> You say, "record ... the condition ... to scroll [the table]". I'm >> sure I don't know what "condition" you mean. >> >> You appear to be doing something like: >> >> offset = 0 >> do >>

[sqlite] Changing the default page_size in 3.12.0

2016-03-04 Thread Richard Hipp
On 3/4/16, Dominique Devienne wrote: > > [OT] The PRAGMA defer_foreign_keys=ON statement now also disables RESTRICT > actions on foreign key. > > Does that mean handling of the RESTRICT is > also postponed to commit-time, > or that RESTRICT is not honored in deferred FK mode (and thus violating

[sqlite] SQLite Corruption By Writing NULL Data

2016-03-04 Thread Clemens Ladisch
sanhua.zh wrote: > I am debugging db corruption. After I get some corrupted db, I found that > they all corrupted by writing null data. > > 0x1000f8000 + 2778664 sqlite3KnownError,main.c,line 3192 > 0x1000f8000 + 2554560 unixWrite,os_unix.c,line 3335 > 0x1000f8000 + 2821984

[sqlite] Changing the default page_size in 3.12.0

2016-03-04 Thread Richard Hipp
The tip of trunk (3.12.0 alpha) changes the default page size for new database file from 1024 to 4096 bytes. https://www.sqlite.org/draft/releaselog/3_12_0.html https://www.sqlite.org/draft/pgszchng2016.html This seems like a potentially disruptive change, so I want to give you, the user

[sqlite] Understanding conditional triggers

2016-03-04 Thread Sam Carleton
> > Does this trigger not compute, is not accepted, or does not work once > installed? What is the problem exactly? > It works fine. Initially I was not able to find any good examples of a conditional trigger but after a lot more searching I was able to find one that validated that it might

[sqlite] SQLite Corruption By Writing NULL Data

2016-03-04 Thread Simon Slavin
On 4 Mar 2016, at 8:22am, sanhua.zh wrote: > 3. I guess it could be a problem of operating system. I work on iOS, but I > have no any further idea. Almost all of these problems are caused by your program doing one of these A) Writing its own data into a pointer made by SQLite B) Releasing a

[sqlite] Mixing text and numeric values in comparisons

2016-03-04 Thread Igor Tandetnik
On 3/4/2016 9:29 AM, Paul van Helden wrote: > On Fri, Mar 4, 2016 at 4:23 PM, Igor Tandetnik wrote: > >> On 3/4/2016 9:15 AM, Paul van Helden wrote: >> >>> So I have to detect integers in order to avoid the .0 >>> >> >> WHERE CAST(A as integer) = 1 >> >> > Not quite going to work either. I should

[sqlite] Mixing text and numeric values in comparisons

2016-03-04 Thread Igor Tandetnik
On 3/4/2016 9:15 AM, Paul van Helden wrote: > So I have to detect integers in order to avoid the .0 WHERE CAST(A as integer) = 1 -- Igor Tandetnik

[sqlite] Mixing text and numeric values in comparisons

2016-03-04 Thread Richard Hipp
On 3/4/16, Paul van Helden wrote: > Hi All, > > CREATE TABLE test (A TEXT); > INSERT INTO test VALUES ('1'); > SELECT * FROM test WHERE A=1; // returns 1 > SELECT * FROM test WHERE A=1.0; // returns nothing Because column A has type TEXT, the RHS of the = is converted to text and a text

[sqlite] attach db limit

2016-03-04 Thread Tim Uy
Dear Richard, Re: below, what happens if I change the sqlite3_limit to 10 when I have 20 attached. Will it complain? Can I shift the limit back and forth over time? Thanks, Tim "The maximum number of attached databases can be lowered at run-time using the sqlite3_limit

[sqlite] attach db limit

2016-03-04 Thread Tim Uy
Well, probably only like a dozen, no worries. On Fri, Mar 4, 2016 at 8:07 AM, Simon Slavin wrote: > > On 4 Mar 2016, at 4:02pm, Tim Uy wrote: > > > So Richard, theoretically, if you use negative numbers, you can get > another > > x2? > > Tim, > > are you actually considering attaching lots of

[sqlite] attach db limit

2016-03-04 Thread Tim Uy
(or use unsigned) On Fri, Mar 4, 2016 at 8:02 AM, Tim Uy wrote: > So Richard, theoretically, if you use negative numbers, you can get > another x2? > > On Thu, Mar 3, 2016 at 2:07 PM, Tim Uy wrote: > >> (Thanks Richard for the explanation of "main" and "temp".) >> >> On Thu, Mar 3, 2016 at

[sqlite] attach db limit

2016-03-04 Thread Tim Uy
So Richard, theoretically, if you use negative numbers, you can get another x2? On Thu, Mar 3, 2016 at 2:07 PM, Tim Uy wrote: > (Thanks Richard for the explanation of "main" and "temp".) > > On Thu, Mar 3, 2016 at 2:02 PM, Tim Uy wrote: > >> So comment in sqliteLimit just needs an update? >>

[sqlite] Can I implement a scrolling window using LIMIT and OFFSET ?

2016-03-04 Thread Darren Duncan
On 2016-03-03 11:27 AM, James K. Lowden wrote: > On Thu, 3 Mar 2016 10:43:26 +0800 (CST) > ?? wrote: > >>> Can anyone describe a situation for which this style of LIMIT & >>> OFFSET is advisable from the application's point of view? (The >>> DBMS costs are obvious enough.) >> >> For me this is