[sqlite] /tmp

2012-11-03 Thread Ivan Shmakov
> Richard Hipp writes: > On Fri, Nov 2, 2012 at 6:44 PM, Tod Olson wrote: […] >> This is fine on small data, but when I load 1.8GB of data (8.8 >> million rows) the second CREATE fails, reporting a disk I/O error. > You might be running out of /tmp space. Do you have plenty of /tmp

Re: [sqlite] INSERT OR IGNORE safety?

2012-11-02 Thread Ivan Shmakov
>>>>> Igor Tandetnik writes: >>>>> Ivan Shmakov <oneing...@gmail.com> wrote: >>>>> Igor Tandetnik writes: >>> Note that ending up in the IGNORE branch of INSERT OR IGNORE >>> statement doesn't constitute failure, but normal ex

Re: [sqlite] INSERT OR IGNORE safety?

2012-11-02 Thread Ivan Shmakov
> Igor Tandetnik writes: […] > Note that ending up in the IGNORE branch of INSERT OR IGNORE > statement doesn't constitute failure, but normal execution. The same > is true for INSERT ... SELECT statement where SELECT returns zero > rows so nothing is actually inserted. Thus

Re: [sqlite] INSERT OR IGNORE safety?

2012-11-02 Thread Ivan Shmakov
>>>>> Ivan Shmakov writes: >>>>> Simon Slavin writes: >>>>> On 2 Nov 2012, at 8:58am, Ivan Shmakov wrote: >>> INSERT OR IGNORE INTO "foo" ("foo") >>> VALUES (?1); >>> INSERT INTO "bar"

Re: [sqlite] INSERT OR IGNORE safety?

2012-11-02 Thread Ivan Shmakov
>>>>> Simon Slavin writes: >>>>> On 2 Nov 2012, at 8:58am, Ivan Shmakov wrote: >> INSERT OR IGNORE INTO "foo" ("foo") >> VALUES (?1); >> INSERT INTO "bar" ("foo") >> VALUES ((SELECT f.&qu

Re: [sqlite] INSERT OR IGNORE safety?

2012-11-02 Thread Ivan Shmakov
>>>>> Clemens Ladisch writes: >>>>> Ivan Shmakov wrote: >> I wonder if I'm on safe side when I use, say: >> INSERT OR IGNORE INTO "foo" ("foo") >> VALUES (?1); >> I mean, if the first INSERT fails for

[sqlite] INSERT OR IGNORE safety?

2012-11-02 Thread Ivan Shmakov
I wonder if I'm on safe side when I use, say: INSERT OR IGNORE INTO "foo" ("foo") VALUES (?1); INSERT INTO "bar" ("foo") SELECT f."rowid" FROM "foo" f WHERE f."foo" = ?1; (within a transaction) against the following schema: CREATE TABLE "foo" ("foo" TEXT

Re: [sqlite] BLOB concatenation?

2012-01-20 Thread Ivan Shmakov
> Pavel Ivanov writes: [...] >> Unfortunately, the string concatenation operator, when applied to >> two BLOB's, results in a text string instead of a BLOB, like: >> SELECT quote (X'5445' || X'5354'); => 'TEST' > Maybe the following? > SELECT quote(cast(X'5445' || X'5354' as blob));

[sqlite] BLOB concatenation?

2012-01-20 Thread Ivan Shmakov
With substr (), it's possible to split a BLOB, like: SELECT quote (substr (X'1337cafe', 3, 2)); => X'CAFE' However, how do I concatenate two blobs? Unfortunately, the string concatenation operator, when applied to two BLOB's, results in a text string instead of

Re: [sqlite] Efficient usage of sqlite

2012-01-02 Thread Ivan Shmakov
> Baruch Burstein writes: […] > My resources are a bunch of sound and image files, level data files, > script files and other game data stuff. Instead of distributing my > game with about 20-30 small (some very small) files, I thought I > would roll all the files into some kind of

Re: [sqlite] transparent compression implementations for SQLite?

2011-12-31 Thread Ivan Shmakov
>>>>> Simon Slavin <slav...@bigfraud.org> writes: >>>>> On 31 Dec 2011, at 4:56pm, Ivan Shmakov wrote: >> The integers could take up to 32 bits long, but I deem them likely >> to “cluster”, like, e. g.: 1, 1, 1, 1, 2, 2, 2, 3, 3, 3, 101, 101,

Re: [sqlite] transparent compression implementations for SQLite?

2011-12-31 Thread Ivan Shmakov
>>>>> Roger Binns writes: >>>>> On 30/12/11 20:10, Ivan Shmakov wrote: >> The problem is that I have a table, each row holding something like >> 64 bytes of data (of BLOB and INTEGER types), which don't seem too >> compressible, but these rows

Re: [sqlite] transparent compression implementations for SQLite?

2011-12-31 Thread Ivan Shmakov
>>>>> Simon Slavin writes: >>>>> On 31 Dec 2011, at 7:11am, Ivan Shmakov wrote: >> Download the code and prebuilt DLL. > It includes both. In other words, the vfs_compress.c file you asked > for is in there. Indeed

Re: [sqlite] transparent compression implementations for SQLite?

2011-12-30 Thread Ivan Shmakov
>>>>> Simon Slavin writes: >>>>> On 31 Dec 2011, at 4:10am, Ivan Shmakov wrote: >> I wonder, if anyone has any experience with [1] (and where could one >> get the vfs_compress.c file, BTW?), or any other transparent >> compression implementat

[sqlite] transparent compression implementations for SQLite?

2011-12-30 Thread Ivan Shmakov
I wonder, if anyone has any experience with [1] (and where could one get the vfs_compress.c file, BTW?), or any other transparent compression implementations for SQLite? The problem is that I have a table, each row holding something like 64 bytes of data

Re: [sqlite] create sqlite3_value * from scratch?

2011-10-12 Thread Ivan Shmakov
>>>>> Pavel Ivanov writes: >>>>> On Wed, Oct 12, 2011 at 11:12 AM, Ivan Shmakov wrote: […] >> Consider, e. g.: >> sqlite3_value *a >> = sqlite3_int64_value (1); >> assert (a != 0); >> sqlite3_value *b >> = sqlite3_text_

Re: [sqlite] create sqlite3_value * from scratch?

2011-10-12 Thread Ivan Shmakov
>>>>> Igor Tandetnik writes: >>>>> Ivan Shmakov <i...@gray.siamics.net> wrote: >> I wonder, is it possible to create sqlite3_value * from scratch >> from within SQLite library's user code? > There's a circuitous route that leads there.

[sqlite] create sqlite3_value * from scratch?

2011-10-12 Thread Ivan Shmakov
I wonder, is it possible to create sqlite3_value * from scratch from within SQLite library's user code? The idea is as follows. The current dbtriv.c [1] code has a db_triv_exec_bound () function, used roughly as follows: /* sqlite3 *db; */ const char *sql

[sqlite] DISTINCT vs. UNIQUE INDEX, and NOT EXISTS vs. EXCEPT

2011-10-12 Thread Ivan Shmakov
>>>>> Jim Morris writes: >>>>> On 10/6/2011 10:43 PM, Ivan Shmakov wrote: >>>>> Jim Morris writes: […] >>> INSERT INTO fts3_table (a,b,c) >>> SELECT 'an A','a B','a C' >>> WHERE NOT EXISTS >>> (SELE

Re: [sqlite] How to design this table?

2011-10-10 Thread Ivan Shmakov
> Simon Slavin writes: > On 9 Oct 2011, at 3:57am, 张一帆 wrote: >> i have some data like "a and b or c ...",there will be a word 'and' >> or 'or' which means the Logical relations between each item. > If you have "a and b or c" does that mean > (a and b) or cOR > a and (b or c)

Re: [sqlite] ensuring uniqueness of tuples spanning across multipletables?

2011-10-06 Thread Ivan Shmakov
> Jim Morris writes: > The recent thread may relate: "[sqlite] Is there an efficient way to > insert unique rows (UNIQUE(a, b, c)) into an fts3 virtual table?" > INSERT INTO fts3_table (a,b,c) > SELECT 'an A','a B','a C' > WHERE NOT EXISTS > (SELECT DISTINCT a,b,c > FROM fts3_table >

Re: [sqlite] ensuring uniqueness of tuples spanning across multipletables?

2011-10-04 Thread Ivan Shmakov
>>>>> Igor Tandetnik <itandet...@mvps.org> writes: >>>>> Ivan Shmakov <i...@gray.siamics.net> wrote: >> This structure is, obviously, could just as well be represented >> with, e. g.: >> CREATE TABLE "foo" ( >&g

[sqlite] ensuring uniqueness of tuples spanning across multiple tables?

2011-10-04 Thread Ivan Shmakov
Well, this case is somewhat weird. I have a number of tables like: PRAGMA "foreign_keys" = 1; CREATE TABLE "foo-L" ( key INTEGER PRIMARY KEY REFERENCES "foo" (key), value INTEGER NOT NULL); Which are tied to a single table, like: CREATE TABLE

Re: [sqlite] max() with LIMIT

2011-08-31 Thread Ivan Shmakov
>>>>> Igor Tandetnik writes: >>>>> Ivan Shmakov <i...@gray.siamics.net> wrote: >>>>> Tobias Vesterlund writes: >>> Is it possible to get the highest value in a "limited column" when >>> using LIMIT? >> Su

Re: [sqlite] max() with LIMIT

2011-08-31 Thread Ivan Shmakov
> Tobias Vesterlund writes: […] > If I do SELECT max(id) FROM t; it will return 99. > If I do SELECT id FROM t WHERE id > 0 LIMIT 10; it will return > 1,2,3,4,5,6,7,8,9,10 > But If I do SELECT max(id) FROM t WHERE id > 0 LIMIT 10; it will > return 99. > My logic, which may be flawed

Re: [sqlite] Creating a database with a script or SQLite command

2011-08-30 Thread Ivan Shmakov
> Pete Helgren writes: > I may end up going this direction, at the moment I am not having much > luck with the conditional copy in Busybox. Your suggestion: > cp -n newdatabase.db /data/newdatabase.db > Isn't supported in the version of Busybox that I am running. Also > the script

[sqlite] sqlite_temp_master vs. .dump (now a library, too!)

2011-08-28 Thread Ivan Shmakov
>>>>> Roger Binns writes: >>>>> On 08/16/2011 04:59 PM, Ivan Shmakov wrote: […] >> Also, are the .dump and .read commands implemented as part of >> the sqlite3 binary, or are they part of the library? > They are part of the standalone shell (i

Re: [sqlite] SQL ROWNUM option is failed - Want to Read records in chunks from table

2011-08-26 Thread Ivan Shmakov
> Tarun writes: […] > I planned to execute query that works on SQL ROWNUM option > "select * from employee2 where rownum > 1 and rownum < 2" Perhaps: SELECT * FROM employee2 ORDER BY oid LIMIT 1 OFFSET 1 > but i m getting error from sqlite3 that "no such

Re: [sqlite] type of a value bound by sqlite3_bind_blob ()?

2011-08-20 Thread Ivan Shmakov
>>>>> Ivan Shmakov writes: >>>>> Roger Binns writes: […] >> Consequently if you had a trigger pulling a stunt like this, your >> code could try to insert a blob and silently (wrongly) end up with a >> string. SQLite won't even complain if th

Re: [sqlite] type of a value bound by sqlite3_bind_blob ()?

2011-08-19 Thread Ivan Shmakov
>>>>> Roger Binns writes: >>>>> On 08/17/2011 09:25 PM, Ivan Shmakov wrote: >> Somehow, I've assumed that sqlite3_bind_blob () will bind a >> parameter to a blob. > It does. There are no affinity rules that will cause otherwise. > There are

[sqlite] type of a value bound by sqlite3_bind_blob ()?

2011-08-17 Thread Ivan Shmakov
>>>>> Roger Binns writes: >>>>> On 08/16/2011 04:59 PM, Ivan Shmakov wrote: >> In the sqlite3's .dump command's output, the binary blobs may either >> be represented as hexadecimal X''-literals, or as text strings. […] > I suggest using typeof

[sqlite] forcing X'' literals in sqlite3's .dump?

2011-08-16 Thread Ivan Shmakov
In the sqlite3's .dump command's output, the binary blobs may either be represented as hexadecimal X''-literals, or as text strings. I wonder, how do I force sqlite3(1) to exclusively use the X'' representation? Also, are the .dump and .read