Re: [sqlite] to encrypt sqlite db

2013-09-02 Thread Clemens Ladisch
Ulrich Telle wrote: > Am 02.09.2013 06:11, schrieb Etienne: >> wxSQLite3 does implement AES in ECB mode > > Wrong. CBC mode is used. Inside one page. If we ignored the actual block size, and viewed the entire database as a stream to be encrypted by a cipher with a block size identical with the

Re: [sqlite] Is SQLite a DBMS?

2013-09-02 Thread Clemens Ladisch
Simon Slavin wrote: > On 2 Sep 2013, at 1:17pm, itli...@schrievkrom.de wrote: >> At university I learned, that a RDBMS also have these management >> functionality like "user access", "user roles", "user password", >> access restrictions ... and all that stuff. > > Whoever told you that was wrong.

Re: [sqlite] SQLite - potential bug with multiple leftjoin/groupby/count

2013-09-04 Thread Clemens Ladisch
Harry Beezhold wrote: > Sqlite - What a cool product! Do you really think buggy products are cool? ;-) > The following is a description of an apparent bug in > the calculation of a row count of a left joined table. > The leftjoin/count technique seems to work for each join/count, separately.

Re: [sqlite] sqlite support not recognized on debian lighttpd

2013-09-06 Thread Clemens Ladisch
GoogleWell wrote: > I installed sqlite on my debian lighttpd (sqeeze) server. It is needed for > an application (business directory) used on a Joomla installation. This > particular component (SOBIPro) keeps telling me that sqlite is not > installed on my server. SQLite is an embedded database

Re: [sqlite] FTS4 + INSERT OR REPLACE = Not replacing but adding item

2013-09-10 Thread Clemens Ladisch
klo wrote: > Just changed a table of mine to support fts4 so that I can do searches > on it Please note that, depending on the implementation, virtual tables are not a full replacement for 'normal' SQLite tables and will not support all features. > and noticed that INSERT OR REPLACE is not

Re: [sqlite] Question about aggregate functions used multiple times

2013-09-11 Thread Clemens Ladisch
James Powell wrote: > SELECT MAX(X) AS MaxX, MAX(X)/MIN(X) AS RatioX > > does the MAX(X) get calculated twice, or does SQLite identify that it > is the same number and do it only once? At least in version 3.8.0.2, it gets calculated only once. Please note that SQLite can optimize MIN/MAX

Re: [sqlite] Query preperation time does not scale linearly with growth of no. of tables

2013-09-11 Thread Clemens Ladisch
Harmen de Jong - CoachR Group B.V. wrote: > http://www.coachrdevelopment.com/share/callstack_tree.html > > This shows most time is spend on sqlite3CodeRowTriggerDirect. I'd guess the actual culprit is the loop in getRowTrigger (which does not show up because it is inlined): /* It may be that

Re: [sqlite] select with date

2013-09-12 Thread Clemens Ladisch
jwzumwalt wrote: > I have valid entries for the current month, what am I doing wrong? > > SELECT * FROM "entry" WHERE > bankdate > date('now','end of month','-1 month') > AND bankdate < date('now','start of month','+1 month') What you are doing wrong is that you have not

Re: [sqlite] COMMIT or ROLLBACK failure

2013-09-20 Thread Clemens Ladisch
Igor Korot wrote: > I need to check if the COMMIT is successful. > But what should I do if it fails? If the database is currently locked, you should try again later. (But this would be better handled with a busy handler.) If there is some I/O error that prevents you from writing, the COMMIT

Re: [sqlite] WAL files and PERL question

2013-09-22 Thread Clemens Ladisch
Larry Brasfield wrote: > If I go into the firefox add on and run a checkpoint , the 2 new invoices > get flushed from the WL to the db file and then my program sees them > what am I doing wrong where my script is only looking at the db file and not > the WAL file? An explanation would be that

Re: [sqlite] EncFs + sqlite3

2013-09-23 Thread Clemens Ladisch
Paolo Bolzoni wrote: > I was wondering, is using sqlite3 under EncFs safe? > For "safe" I mean is the db is strong against data corruption > as in a usual filesystem? EncFS implements the .fsync callback but not .fsyncdir, so the deletion of the master journal is not synchronized, so your data

Re: [sqlite] EncFs + sqlite3

2013-09-23 Thread Clemens Ladisch
Paolo Bolzoni wrote: > What do you mean with "if you do not ATTTACH databases"? EncFS does not implement .fsyncdir, which is used by SQLite when deleting the master journal file. Such a file is used for transactions when there are multiple database files, i.e., when you have used ATTACH. But I

Re: [sqlite] Major performance difference when joining on FTS4 table's docid column versus custom id column

2013-10-03 Thread Clemens Ladisch
Per Vognsen wrote: > Am I wrong to think that joining on docid should be as fast as joining on > indexed integer columns in other tables? Looking up a record by docid is faster than non-FTS lookups on other columns, but the virtual table implementation still has to go through a separate query to

Re: [sqlite] How to use my own python function in a SQLite WHERE clause?

2013-10-05 Thread Clemens Ladisch
Bao Niu wrote: > SELECT * FROM myTable WHERE MyDate > MyModule.ChineseDate("兔年八月十五") You cannot use Python function directly in SQL. You have to convert from the Python type to the corresponding SQL type. I don't know how the type mapping works exactl, but it should probably look like this:

Re: [sqlite] COMMIT in SQLite

2013-10-08 Thread Clemens Ladisch
Paul Harris wrote: > Many years ago, Igor mentioned that you should always reset/finalize any > prepared statements before calling COMMIT. > > I am wondering, is this still true? Yes. There was a change in 3.7.11, but not with COMMIT itself: | * Pending statements no longer block ROLLBACK.

Re: [sqlite] Using several .commands from a Script

2013-10-10 Thread Clemens Ladisch
John wrote: > I am having problems creating a "do shell script" command which includes > both the import command and the insert command. The reason they need to be > combined is that the shells instance ends with the command. > > do shell script ("sqlite3 " & databasePath & " .separator \"||\" ;

Re: [sqlite] Trigger SQL and database schema

2013-10-15 Thread Clemens Ladisch
Sqlite Dog wrote: > seems like SQLite is not checking trigger SQL for invalid column names > until execution? No. > Is there a way to force this check? Not without compiling the respective INSERT/UPDATE/DELETE statement. > The problem: trying to find out which indices, triggers and views

Re: [sqlite] Feature Request: Binding Arrays

2013-10-16 Thread Clemens Ladisch
Dominique Devienne wrote: > select * from some_table where some_column in (...) > > 2) In other places we synthesize the query text by splicing list.join(", ") > in the in (list) where clause. > > Both solutions are unsatisfactory, because ... 2) constantly reparse and > prepare queries, which can

Re: [sqlite] Table constraints

2013-10-17 Thread Clemens Ladisch
Joseph L. Casale wrote: > CREATE TABLE t ( > id INTEGER NOT NULL, > a VARCHAR NOT NULL COLLATE 'nocase', > b VARCHAR COLLATE 'nocase', > c VARCHAR CHECK (c IN ('foo', 'bar', NULL)) COLLATE 'nocase', > PRIMARY KEY (id) > ); > > How does one

Re: [sqlite] SQLite keeps on searching endlessly

2013-10-19 Thread Clemens Ladisch
Raheel Gupta wrote: > > CREATE INDEX map_index ON map (n, s, d, c, b); > > > > SELECT n, c, b, s FROM map WHERE s <= '326' AND s NOT IN (0) AND d = '15' > > AND n >= '15591116' ORDER BY n ASC LIMIT 0, 32768 > > 0|0|0|SEARCH TABLE map USING COVERING INDEX map_index (n>?) (~4166 rows) >

Re: [sqlite] Covering index scan optimization

2012-09-13 Thread Clemens Ladisch
Eleytherios Stamatogiannakis wrote: > create table t (c1,c2, c3, c4); > create index idxtc1 on t(c1); > > explain query plan select c1 from t; > SCAN TABLE t (~100 rows) > > explain query plan select c1 from t order by c1; > SCAN TABLE t USING COVERING INDEX idxtc1 (~100 rows)

Re: [sqlite] Javascript API for SQLite?

2012-09-14 Thread Clemens Ladisch
Jean-Denis Muys wrote: > I am now looking for a Javascript implementation of the SQLite library. says: | sql.js is a port of SQLite to JavaScript, by compiling the SQLite | C code with Emscripten. It's completely in-memory, but: | Database objects ... have

Re: [sqlite] Covering index scan optimization

2012-09-14 Thread Clemens Ladisch
Elefterios Stamatogiannakis wrote: > On 13/09/12 23:02, Clemens Ladisch wrote: >> Eleytherios Stamatogiannakis wrote: >>> Is there a reason for SQLite to not use a covering index for scans? >> >> The query optimizer does not allow indexes that are not needed for som

Re: [sqlite] Question about the sqlite3_column_bytes

2012-09-15 Thread Clemens Ladisch
kjell.gunnars...@sungard.com wrote: > sqlite3_column_bytes returns an "int" Yes. > that can contain values in the interval -32768 to +32767. It is assumed that any platform SQLite runs on has as least 32 bits. (And if you'd want to run SQLite on MS-DOS, the type of sqlite3_column_bytes's

Re: [sqlite] Count(*) help

2012-09-16 Thread Clemens Ladisch
John Clegg wrote: > I have a table Members with 896 rows and a text field "Year2012". It > contains "Paid" 156 times, "Comp" 13 times and the rest are null (confirmed > in sqlitebrowser as "empty") > > Back in the olden days when this table was in Access, select > count("Year2013") from Members

Re: [sqlite] Count(*) help

2012-09-17 Thread Clemens Ladisch
Simon Slavin wrote: > What does length(NULL) mean ? When there is no string, there is no string length. > I don't think the answer is in SQL92. | 6.6 | [...] | General Rules | [...] | 4) If a is specified, then |Case: |a) Let S be the . If the value of S is | not the null value,

Re: [sqlite] index has higher cache priority than data?

2012-09-21 Thread Clemens Ladisch
John Bachir wrote: > i've read other posts on this list that say that we can't guess what sqlite > will do with cache. It uses a simple LRU algorithm to determine which pages to kick out of the page cache first (so at least it's somewhat deterministic). > however, could i be relatively confident

Re: [sqlite] Virtual tables are driving me insane!

2012-09-21 Thread Clemens Ladisch
Jörgen Hägglund wrote: > I'm trying to implement virtual tables, but I seem to be in over > my head with this. > I get an access violation in SQLite3.dll (reading of address 0008) > > Does anyone have any ideas to what I'm doing wrong? Not really. But one mistake I had made was to read this

Re: [sqlite] DELETE Query Assistance Please

2012-09-23 Thread Clemens Ladisch
Don Goyette wrote: > The first problem I'm running into is that the timestamp in these tables is > NOT a standard Unix timestamp. Rather, it's an Excel timestamp, which is > the number of Days since Jan 1, 1900. An example is '41051.395834' (May > 22, 2012), but the DELETE query will only

Re: [sqlite] DELETE Query Assistance Please

2012-09-24 Thread Clemens Ladisch
Don Goyette wrote: > > With 60*60*24 seconds per day, the number of days since the Unix epoch is: > > sqlite> select strftime('%s', '2012-05-22') / (60*60*24); > > 15482 > > The timestamp in the tables I'm reading is not in the format of > '2012-05-22'. Sorry, my explanations were not clear

Re: [sqlite] [Fwd: [FEATURE REQUEST] support of %y in strftime()]

2012-09-25 Thread Clemens Ladisch
LacaK wrote: > some month ago I wrote question about possibility to add support of %y > (2 digit year) to strftime() function. > Patch is very simple (only few lines of code) and I hope, that will be > useful for many users. Two-digit years happend about two thousand years ago, and at that time,

Re: [sqlite] [Fwd: [FEATURE REQUEST] support of %y in strftime()]

2012-09-25 Thread Clemens Ladisch
LacaK wrote: > But why not add %y, when it is only 5 lines of source code, Plus documentation, test cases, etc. > take into account that %y is supported also by C strftime() > or PHP etc. Those languages are not called Clite or PHPlite. > and it is really useful. You still haven't mentioned a

Re: [sqlite] .mode tabs does not work

2012-09-26 Thread Clemens Ladisch
somebody wrote: > .mode tabs does not work: > > sqlite3 < .mode tabs > .show > EOF > ... > separator: "\t" Obviously, it does work. > echo -ne "\"\t" >f && sqlite3 < create table t(a text, b text); > .mode tabs > .import f t ".mode" sets the *output* mode. Regards, Clemens

Re: [sqlite] How much disk space is required to checkpoint?

2012-09-26 Thread Clemens Ladisch
Simon Slavin wrote: > On 26 Sep 2012, at 5:42am, Dan Kennedy wrote: >> So when SQLite requires a temporary >> file, it normally creates and opens a file with a randomized name >> in /tmp then calls unlink() on it immediately - before it starts >> using the file. > > [...]

Re: [sqlite] .mode tabs does not work

2012-09-27 Thread Clemens Ladisch
hpydktvjnksya kfoxwfswkhlhuk wrote: > 1. ".mode tabs" works strange: > > echo -e ".show\n.mode tabs\n.show" | sqlite3 | grep mode > mode: list > mode: list That's how it works. > 2. "separator" changes to "\t", but cannot .import files with "\"": > > echo -ne "\"\t" >f && sqlite3 <

Re: [sqlite] Issue with SQLite3 for WinRT ARM

2012-09-28 Thread Clemens Ladisch
Christian Le Gall wrote: > I have included an example project ... and the mailing list server has stripped it. Please put it somewhere on the web. > The error I am getting is generally "critical error detected c000374" which > my research tells me is a corrupted heap. This typically indicates a

Re: [sqlite] .mode tabs does not work

2012-09-29 Thread Clemens Ladisch
hpydktvjnksya kfoxwfswkhlhuk wrote: > Clemens Ladisch wrote: >> In its import files, sqlite3 always interprets " as quote character. > > No, sqlite3 ".separator \t" does not interpret " before 3.7.11: > > 3.7.10 2012-01-16 13:28:40 ebd01a8deffb5024a5d

Re: [sqlite] sqlite + EF4 + 'on cascade delete' = not working

2012-10-01 Thread Clemens Ladisch
David Richardson wrote: > I’m having some sort of bug with system.data.sqlite. > when I try to delete it should cascade , but 'on cascade delete’ does NOT > work. In SQLite, it's called "on delete cascade": sqlite> pragma foreign_keys=on; sqlite> create table parent(id integer primary key);

Re: [sqlite] Right way to store binary data into a blob

2012-10-03 Thread Clemens Ladisch
Tim Streater wrote: > I've got a temporary database with a blob column. I'm using the PHP > PDO interface, and I'd like to store some binary data into the blob; > it's actually an image. > At the moment I'm using str_replace to change any single-quote to two > single-quotes, and then doing as

Re: [sqlite] Size

2012-10-04 Thread Clemens Ladisch
Alami Omar wrote: > it seems that in a sqlite format 3 file (that i have), the offset > 28 value is not valid(not equal to the file size) Please read the link you were given. This size is in pages. > what i am trying to do, is extract an SQLite Format 3 file from > the hex code of another file

Re: [sqlite] Handled images in database: URL or blob ?

2012-10-08 Thread Clemens Ladisch
Paxdo Presse wrote: > The context: > - Web application > - Billing application > - Sqlite with WAL mode > - The database is shared among many clients. > > Images are handled in the app: photo of products, photos of customers, etc. > Each client can have thousands. > Advise you manage images as

Re: [sqlite] Handled images in database: URL or blob ?

2012-10-08 Thread Clemens Ladisch
Paxdo Presse wrote: > Indeed, I thought as a second database for images. This may be a good > solution. But there are two flaws: > > - With WAL mode, transactions involving multiple databases are no longer > atomic, whole. But files are not atomic at all. Do you actually need this for images?

Re: [sqlite] Feature request: Add pragma CONCAT_NULL_YIELDS_NULL

2012-10-08 Thread Clemens Ladisch
Marcel Wesołowski wrote: > In SQLite when strings are concatenated (with ||) and one of them is null, > the result will be null. > This is not a required behaviour It *is* required by all SQL standards. > (not intuitive) It's intuitive for everybody with experience with SQL. That is how _all_

Re: [sqlite] C++ - Sqlite3 and Visual Studio 10

2012-10-08 Thread Clemens Ladisch
Arbol One wrote: > error LNK2019: unresolved external symbol _sqlite3_prepare_v2 It appears you forgot to include sqlite3.c in your application. Regards, Clemens > This e-mail is for the sole use of the intended recipient and may contain > confidential or privileged information. Unauthorized

Re: [sqlite] CREATE INDEX on huge DB fails with SQLITE_NOMEM

2012-10-09 Thread Clemens Ladisch
Marcus Grimm wrote: > I can see that the application increases memory up to appx. 600 MB > while the database is populated - That is the cache_size=50, > I assume. cache_size=50 corresponds to: 255 MB (page size 512 bytes) 488 MB (page size 1 KB) 977 MB (page size 2 KB) 1.9 GB (page

Re: [sqlite] tokenize unicode61

2012-10-09 Thread Clemens Ladisch
Hertwig van Zwietering wrote: > I just compiled the SQLite 3.7.14.1 version because I want to try the > unicode61 tokenizer in FTS4. From how I read the documentation, the > unicode61 tokenizer should be available by default. Does it actually say "by default"? > However, as soon as I try to

Re: [sqlite] SQLite on flash (was: [PATCH 00/16] f2fs: introduce flash-friendly file system)

2012-10-10 Thread Clemens Ladisch
(CC'd sqlite-users ML) Theodore Ts'o wrote: > On Tue, Oct 09, 2012 at 02:53:26PM -0500, Jooyoung Hwang wrote: >> I'd like you to refer to the following link as well which is about >> mobile workload pattern. >> http://www.cs.cmu.edu/~fuyaoz/courses/15712/report.pdf >> It's reported that in Android

Re: [sqlite] SQLite on flash

2012-10-10 Thread Clemens Ladisch
Paul Corke wrote: > On 10 October 2012 13:47, Richard Hipp wrote: >> We would also love to have guidance on alternative techniques for >> obtaining memory shared across multiple processes that does not >> involve mmap() of temporary files. > > In case it's any use, what we use on Linux is: > >

Re: [sqlite] Data type information for derived columns

2012-10-10 Thread Clemens Ladisch
jkp487-sql...@yahoo.com wrote: > New to SQLite. Is there a way to get column data type information for > derived columns in a query or view? For example, if I have something like > this: > > select Customer.LastName || Customer.FirstName as Fullname > > then no data type is returned for that

Re: [sqlite] DatabaseError: database disk image is malformed

2012-10-15 Thread Clemens Ladisch
Larry Knibb wrote: > On 15 October 2012 12:32, Keith Medcalf wrote: >> Define "clients". Do you mean multiple client processes running on >> a single computer against a database hosted on an attached local >> device, such as on a Terminal Server for example? Or do you mean

Re: [sqlite] DatabaseError: database disk image is malformed

2012-10-15 Thread Clemens Ladisch
Larry Knibb wrote: > On 15 October 2012 16:35, Clemens Ladisch <clem...@ladisch.de> wrote: >> Which network protocol? And what are the OSes on the clients and on the >> file server? > > The server and clients are Windows machines so I guess (not my area of > exper

Re: [sqlite] DatabaseError: database disk image is malformed

2012-10-16 Thread Clemens Ladisch
Keith Medcalf wrote: > Note that according to the Microsoft documentation opportunistic > locking is only used when overlapped I/O is enabled. That applies only to oplocks that are requested manually by an application through FSCTL_ control codes:

Re: [sqlite] escape sequences for GLOB

2012-10-18 Thread Clemens Ladisch
Tristan Van Berkom wrote: > What is the proper default escape sequence to be used for GLOB > pattern matching in SQLite ? There are different escape mechanisms for different characters. A comment hidden in the source code explains: | Globbing rules: | | '*' Matches any sequence of zero

Re: [sqlite] a question about data synchronization

2016-06-02 Thread Clemens Ladisch
Gelin Yan wrote: >> In Process A >> >> insert a value into a table XX and commit. >> >> In Process B >> >> select from the same table XX >> >>and I didn't find the inserted record. > >I used python & its sqlite3 module for this trial, the autocommit mode > is default on. After I

Re: [sqlite] Conversion failure

2016-06-23 Thread Clemens Ladisch
Igor Korot wrote: > I am trying to find out why the following code fails to do proper conversion. > It works if the tableName have "abcd", but fails if it has "abcß" (the > German letter for the "ss" (looks like Greek letter beta)). > > const unsigned char *tableName = sqlite3_column_text( stmt, 0

Re: [sqlite] Locking semantics are broken?

2016-06-28 Thread Clemens Ladisch
dandl wrote: >> Do not use SQLite for concurrent access over a network connection. Locking >> semantics are broken for most network filesystems, so you will have >> corruption issues that are no fault of SQLite. > > I have seen this comment made more than once on this list. Is there any > reliable

Re: [sqlite] [Windows] 3.13.0 recreate db from .dump file corrupts records with extended characters

2016-07-13 Thread Clemens Ladisch
S.Ajina wrote: > Can confirm that sqlite3.exe version 3.8.6 works ok restoring database from a > .dump dump.sql file using these commands > > echo .dump | sqlite3_v3.8.6 test.original.db > dump_v3.8.6.sql > sqlite3_v3.8.6 -init dump_v3.8.6.sqltest.restored.v3.8.6.db > > Doing the

Re: [sqlite] Exec vs Prepare, step, finalize.

2016-08-11 Thread Clemens Ladisch
Michael Falconer wrote: > So what exactly is the issue with the string building if it does not > include sql derived from user input? That somebody will change the code later, or use it as a template. Regards, Clemens ___ sqlite-users mailing list

Re: [sqlite] SQLite 3.12.2 SCALARS NOT VISIBLE TO CORRELATED SUBQUERY LIMIT CLAUSE

2016-08-10 Thread Clemens Ladisch
petern wrote: > I am eager to read comments. I would call this a bug report rather than > feature request > since the expected result is reasonable and the choice of subquery scalar > scoping > for LIMIT seems arbitrary. > > Is there some documentation I may read which explains this design

Re: [sqlite] Odd behavior when using ORDER BY on a VIEW with a LIMIT clause

2016-08-10 Thread Clemens Ladisch
jef wrote: > CREATE VIEW v1 AS SELECT x FROM t1 ORDER BY y DESC; > CREATE VIEW vv1 AS SELECT x FROM v1 LIMIT 3; > > SELECT x FROM vv1 ORDER BY x; > > With vv1, the query planner/optimizer seems to push the LIMIT clause > all the way to the "end" of the query. Is this the desired behavior? A

Re: [sqlite] Percentage instead of count in GROUP BY

2016-08-10 Thread Clemens Ladisch
Cecil Westerhof wrote: > SELECT idletime, COUNT(*) > FROM vmstat > GROUP BY idletime > > But because there are about 400.000 records (and counting) it is not the > most convenient information. Instead of the number of records I would like > to have the percentage of the records. Is this

Re: [sqlite] insert or replace on PK and UNIQUE INDEX

2016-07-12 Thread Clemens Ladisch
Dominique Devienne wrote: > sqlite> select * from t; > 1|one bis > 2|two > sqlite> insert or replace into t (name) values ('one bis'); > sqlite> select * from t; > 2|two > 3|one bis > > In the session above, we can see that an insert or replace w/o an id (the PK) > value, > results in the id

Re: [sqlite] Question on Join in Virtual Tables

2016-07-15 Thread Clemens Ladisch
Jain, Punit wrote: > Since we are performing a join on a column name of a table, we cannot > give a fixed value. In a nested loop join, the database simply goes through one table, and for each row, searches the matching rows in the other table. Your virtual table module must optimize that search

Re: [sqlite] Question on Join in Virtual Tables

2016-07-15 Thread Clemens Ladisch
Jain, Punit wrote: > We have implemented virtual tables > > E.g. a query such as "select * from t1 join t2 on t1.name=t2.name" > > We tried to optimize it using xBestIndex and xFilter but to no avail. > We couldn't find a way to pass the value of t1.name (for each row) > to the filter of t2.

Re: [sqlite] Query question: order by ascending, return the two largest values in ascending order

2016-07-12 Thread Clemens Ladisch
Clemens Regards, 2. Sorting the entries before LIMIT is applied. 1. Sorting the entries before group_concat() is applied; or Chris Locke wrote: > Whats the benefit of getting a sorted query and then sorting that query > again? > > On Tue, Jul 12, 2016 at 12:45 AM, Stephen Chrzanowski

Re: [sqlite] Query Flattener vs. result-set column names

2016-07-07 Thread Clemens Ladisch
Simon Slavin wrote: > On 7 Jul 2016, at 3:37pm, Josef Kučera wrote: >> Imagine a query like "SELECT A.F1, B1.F FROM A JOIN (SELECT F2 AS F FROM B >> WHERE F3=0) B1". > > your natural JOIN is a little dangerous since it can collapse if you > change column names or

Re: [sqlite] ENABLE_UPDATE_DELETE_LIMIT

2016-07-11 Thread Clemens Ladisch
Janos Levai wrote: > Are there any downsides to setting ENABLE_UPDATE_DELETE_LIMIT when creating > the official amalgamation? Will users of the amalgamation, not > needing ENABLE_UPDATE_DELETE_LIMIT, see any issues? They might be tempted to use it. Regards, Clemens

Re: [sqlite] Get Table names from Database in C++?

2016-08-05 Thread Clemens Ladisch
Domonic Tom wrote: > Would anyone know how to get the table names from a specific database in C++ > or just using the C API for sqlite? You execute the query "SELECT name FROM sqlite_master WHERE type='table';". > I have tried the below but I get nothing. > > string exec_string = "SELECT name

Re: [sqlite] switching from WAL to DELETE mode

2016-08-07 Thread Clemens Ladisch
Andrii Motsok wrote: > Is that possible to switch database from WAL to DELETE mode when holding more > than one connection? No. There is no mechanism to tell the other connections about the change. > If no, which workaround could we use Don't do it. What problem do you think you can solve

Re: [sqlite] REFERENCES from TEMPORARY table to main database table?

2016-07-23 Thread Clemens Ladisch
Smith, Randall wrote: > Is it impossible to have references from temp tables to main tables? Yes. > If so, aren't TEMPORARY tables largely useless? Only if you want to use foreign key constraints. > Is there another idiom in SQLite for managing tables that are intended > to have a short life

Re: [sqlite] C API - Parameterized Atomic Transactions

2016-08-09 Thread Clemens Ladisch
Paulo Roberto wrote: > I need some help to do a simple operation, increment a counter and get its > former value. > I could have some race condition, so the transaction must be atomic. > > I also would like to use prepared statements to accomplish that, so I have > less effort sanitizing inputs.

Re: [sqlite] switching from WAL to DELETE mode

2016-08-09 Thread Clemens Ladisch
Andrii Motsok wrote: >> What problem do you think you can solve with this? > > I have one readonly connection. Is being used for reading. > From time to time I need to modify data So this connection is _not_ readonly. Why do you think you cannot use a single read/write connection all the time?

Re: [sqlite] update or replace ...

2016-06-30 Thread Clemens Ladisch
Simon Slavin wrote: > On 30 Jun 2016, at 8:24am, Olivier Mascia wrote: >> Of course writing straight code in C/C++ it's rather simple to emulate >> situations where you want to update some values in an existing row, >> creating the row if needed. > > The standard way of doing

Re: [sqlite] builtin functions and strings with embedded nul characters

2016-07-01 Thread Clemens Ladisch
Rob Golsteijn wrote: > Due to a bug in our own code we inserted a string with embedded nul > character in the database. says: | The result of expressions involving strings with embedded NULs is | undefined. > I investigated how the builtin functions

Re: [sqlite] builtin functions and strings with embedded nul characters

2016-07-04 Thread Clemens Ladisch
Rob Golsteijn wrote: > It is indeed documented that the behaviour is undefined when using a > bind_text variant. No. The documentation says: | The result of expressions involving strings with embedded NULs is undefined. Using a bind_text variant is just one of the ways to construct a string

Re: [sqlite] How to customize "Bytes of unused 'reserved' space at the end of each page" ?

2016-08-16 Thread Clemens Ladisch
sanhua.zh wrote: > It describles the"Bytes of unused‘reserved' space at the end of each page”. I > think it’s the exact thing what I need. > But I have no idea how to use it. It seems that there is no interface to do > this. sqlite3_test_control(), or a hex editor:

Re: [sqlite] How to customize "Bytes of unused 'reserved' spaceat the end of each page" ?

2016-08-17 Thread Clemens Ladisch
sanhua.zh wrote: > sqlite3_test_control() is an interface for testing. Is it safe to use it in > released product? This question does not make sense. You need to modify your copy of the SQLite library to actually do something with the reserved bytes, so you have complete control over setting

Re: [sqlite] page_size on ATTACH-ed databases

2016-08-17 Thread Clemens Ladisch
Ward WIllats wrote: > sqlite> attach database '/tmp/RareData.db' as rd; < ATTACH SECOND DB > sqlite> pragma page_size=512; <- SET MAIN DB PAGE SIZE > ... > sqlite> pragma journal_mode=WAL; This sets the journal mode of _both_ databases to WAL. This requires that both database

Re: [sqlite] Help with custom collation

2017-02-01 Thread Clemens Ladisch
x wrote: > int Compare(void* Data, int Len1, const void *s1, int Len2, const void *s2) > { > const UTF8String *S1 = static_cast(s1), > *S2 = static_cast(s2); > return 0; > } > > if (sqlite3_create_collation(SQLiteDB, "Compare", SQLITE_UTF8, NULL, > ) != SQLITE_OK)

Re: [sqlite] Exposing compile-time limits?

2017-02-06 Thread Clemens Ladisch
Richard Newman wrote: > `sqlite3_limit` allows callers to discover the run-time value of limits > such as `SQLITE_LIMIT_VARIABLE_NUMBER`. > > Callers can also *set* each limit, so long as the value is smaller than a > compile-time define, in this case `SQLITE_MAX_VARIABLE_NUMBER`. > > But callers

Re: [sqlite] Retrieve INTEGER PRIMARY KEY

2017-02-06 Thread Clemens Ladisch
Clyde Eisenbeis wrote: > Perhaps there is no equivalence to OLE DB ... oledbCmd.CommandText = > "Select @@Identity" ... int iKeyID = (int)oledbCmd.ExecuteScalar()? This has *nothing* to do with OLE DB; @@Identity is an SQL Server specific thing. SQLite's is last_insert_rowid(), and both have

Re: [sqlite] Bug using aggregate functions

2017-02-06 Thread Clemens Ladisch
Radovan Antloga wrote: > select min(A) > from TEST > where B is null > and A > 3; > > if you replace min(A) with * you get empty result set as expected > but with min or max or avg you get one record This is just how aggregate functions in SQL work. When you're using GROUP BY, you get exactly

Re: [sqlite] Patch Etiquette

2017-02-06 Thread Clemens Ladisch
Ziemowit Laski wrote: > [...] > I DO care about being acknowledged as the author of the patch, however. But you are not the author. You reported the problem, but the actual patches that got applied (http://www.sqlite.org/cgi/src/info/50e60cb44fd3687d,

Re: [sqlite] Transactions

2017-02-05 Thread Clemens Ladisch
Michele Pradella wrote: > I have a question about transactions and SQLite: http://www.sqlite.org/faq.html#q19 Regards, Clemens ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org

Re: [sqlite] FOREIGN KEY question

2017-02-08 Thread Clemens Ladisch
Igor Korot wrote: > Does SQLite supports the FK name? > If yes, what is the proper syntax? CREATE TABLE t ( x PRIMARY KEY, y, CONSTRAINT this_is_the_name FOREIGN KEY (y) REFERENCES t(x) ); or CREATE TABLE t ( x PRIMARY KEY, y CONSTRAINT this_is_the_name REFERENCES t(x)

Re: [sqlite] Help with Backup API please

2017-02-08 Thread Clemens Ladisch
Brett Goodman wrote: > When I call sqlite3_backup_init it throws this error: _/"library /__/ > /__/routine called out of sequence"/_. To you get an error code, or an exception? In the first case, try calling sqlite3_errmsg(). The documentation says: | A call to sqlite3_backup_init() will fail,

Re: [sqlite] SQLite3 Pros / Cons

2017-02-04 Thread Clemens Ladisch
Clyde Eisenbeis wrote: > What are the pros / cons of SQLite3? http://www.sqlite.org/whentouse.html > If I switched from "using System.Data.SQLite" to SQLite3, are all of > the functions in a .dll I could download and use? http://www.sqlite.org/howtocompile.html

Re: [sqlite] IS NULL and IS NOT NULL constraints not passed into virtual table's xBestIndex

2017-02-03 Thread Clemens Ladisch
Daniel Kamil Kozar wrote: > I'd like to ask why using a IS NULL or IS NOT NULL constraint in a > query made to a virtual table does not result in these constraints > being present in the sqlite3_index_info structure passed to the > virtual table's xBestIndex. Because there is no

Re: [sqlite] How to circumvent UNIQUE constraint

2017-01-23 Thread Clemens Ladisch
Cecil Westerhof wrote: >> UPDATE desktops >> SET indexNo = indexNo + 1 >> >> But it does not, it gives: >> Error: UNIQUE constraint failed: desktops.indexNo > > ​It is actually quite simple: > PRAGMA ignore_check_constraints = ON A UNIQUE constraint is not a CHECK constraint. Regards, Clemens

Re: [sqlite] Finding the largest TOTAL() of numerous GROUP totals

2017-01-24 Thread Clemens Ladisch
Jeffrey Mattox wrote: > Can (1) and (3) be combined to return grandTotalCount and > largestSubTotalCount? In the general case, you can combine them in two columns: SELECT (SELECT ...) AS grandTotalCount, (SELECT ...) AS largestSubTotalCount; or in two rows: SELECT ... UNION ALL SELECT

Re: [sqlite] BUG: Illegal initialization in icu.c : sqlite3IcuInit

2017-01-26 Thread Clemens Ladisch
Hick Gunter wrote: > On ILP_32 architectures, the integer 0 What integer 0? The message is about initializing scalars[11].pContent (a "void*") with "(void*)db", which is "sqlite3*". > Oh? What exactly is illegal about this? > >> struct IcuScalar { >> const char *zName;

Re: [sqlite] BUG: Illegal initialization in icu.c : sqlite3IcuInit

2017-01-27 Thread Clemens Ladisch
David Empson wrote: > Perhaps SQLite’s test procedure should be enforcing strict ANSI C mode? > If this is already being done, then the compiler(s) used might not be > enforcing this particular rule. "gcc -pedantic -std=c90" (or gnu90) would check for this error: test.c:6:3: warning: initializer

Re: [sqlite] BUG: Illegal initialization in icu.c : sqlite3IcuInit

2017-01-27 Thread Clemens Ladisch
I wrote: > David Empson wrote: >> Perhaps SQLite’s test procedure should be enforcing strict ANSI C mode? >> If this is already being done, then the compiler(s) used might not be >> enforcing this particular rule. > > "gcc -pedantic -std=c90" (or gnu90) would check for this error And

Re: [sqlite] Using with clause in update statement

2017-01-25 Thread Clemens Ladisch
x wrote: > If I replace the following statement > > UPDATE SomeTable SET SomeCol = Col1 * (LongWindedFormala) + Col2 * > (LongWindedFormala) + ... > > with > > WITH CTE(X) AS (SELECT LongWindedFormula) > UPDATE SomeTable SET SomeCol = Col1 * (SELECT X FROM CTE) + Col2 * (SELECT X > FROM

Re: [sqlite] BUG: Illegal initialization in icu.c : sqlite3IcuInit

2017-01-25 Thread Clemens Ladisch
Ziemowit Laski wrote: > Visual C++ Which one? > correctly catches this. Oh? What exactly is illegal about this? > struct IcuScalar { > const char *zName;/* Function name */ > int nArg; /* Number of arguments */ > int enc;

Re: [sqlite] SQLite as a Delphi unit (was: SQLite Options)

2017-02-17 Thread Clemens Ladisch
Stephen Chrzanowski wrote: > Ever since I found SQLite3 and a decent wrapper that does exactly what I've > needed it to do, I've ALWAYS wanted to do a direct port of the Amalgamation > into a Delphi/Pascal unit so I can just include it and have the > functionality built in, period, built by the

Re: [sqlite] sqlite3_blob_bytes64() ?

2017-02-14 Thread Clemens Ladisch
Olivier Mascia wrote: > What is the purpose of sqlite3_bind_blob64() and sqlite3_bind_zeroblob64()? To allow 64-bit types (but not necessarily 64-bit values). IIRC some language binding needed this. Regards, Clemens ___ sqlite-users mailing list

Re: [sqlite] sqlite3 hangs on query

2017-02-14 Thread Clemens Ladisch
Jens-Heiner Rechtien wrote: > SELECT count(*) > FROM spacefavorite, album_asset, albums, assetProfileLinks, > avatarCacheReferences, > cacheReferences, comment, conflicts, coreInfo, coreMD5, errors, flags, > importSource, missingBinariesOnOz, profileRegistration, quota_exceeded, >

Re: [sqlite] thousand separator for printing large numbers

2017-02-10 Thread Clemens Ladisch
Dominique Devienne wrote: > On Fri, Feb 10, 2017 at 6:53 PM, Stephen Chrzanowski > wrote: >> The date and time are stored as a number, not >> "Friday, February 10, 2017 12:43:33pm". > > And that's exactly why SQLite has date and time functions. > Notably the one converting a

Re: [sqlite] thousand separator for printing large numbers

2017-02-11 Thread Clemens Ladisch
James K. Lowden wrote: > I doubt you'll win that argument. You should have checked before writing this. ;-) http://www.sqlite.org/cgi/src/info/064445b12f99f76e Regards, Clemens ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org

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