Re: [sqlite] ftruncate implementation

2012-01-24 Thread David Garfield
From the ftruncate page: If the file size is increased, the extended area shall appear as if it were zero-filled. It doesn't have to write zeros, just act like it did. --David Garfield On Tue, Jan 24, 2012 at 08:19, Simon Slavin slav...@bigfraud.org wrote: On 24 Jan 2012, at 6:43am, David

Re: [sqlite] ftruncate implementation

2012-01-24 Thread David Garfield
, without actually zero filling anything. Having said that, I would expect certain operating systems (like DOS) to actually do the zero-filling and complete it before returning from the call. --David Garfield On Tue, Jan 24, 2012 at 14:00, Simon Slavin slav...@bigfraud.org wrote: On 24 Jan 2012

Re: [sqlite] Bin parameters by name - generic function

2012-01-17 Thread David Garfield
the datatype listed on the column as a hint, then I can't help you. --David Garfield On Tue, Jan 17, 2012 at 19:32, Bill McCormick wpmccorm...@gmail.com wrote: I'm trying to write a function with a sig like this: int BindParameter(sqlite3_stmt* stmt, int sqlType, const char* pname, char

Re: [sqlite] Using non-aggregate columns in group by (with an additional issue)

2012-01-14 Thread David Garfield
know how this compares in terms of performance with Igor's solution. --David Garfield On Fri, Jan 13, 2012 at 06:07, Dilip Ranganathan misc.us...@gmail.comwrote: I have a table that looks like something like this: timestampvalue person

Re: [sqlite] Named parameters and spaces.

2012-01-12 Thread David Garfield
are there only so that the SQL command and the API user can be matched up, particularly when one or more value need to be reused. --David Garfield On Wed, Jan 11, 2012 at 19:01, Steven Michalske smichal...@gmail.comwrote: On Tue, Jan 10, 2012 at 4:11 PM, Simon Slavin slav...@bigfraud.org wrote: On 10

Re: [sqlite] primary key and rowid

2011-12-19 Thread David Garfield
http://www.sqlite.org/lang_createtable.html#rowid Simon. If I am reading that page correctly, AUTOINCREMENT is not permitted in this context. Is that right? Or are the diagrams incomplete in this? (I will admit that it doesn't really make sense for a multi-column constraint.) --David

Re: [sqlite] PHP SQLite examples

2011-11-14 Thread David Garfield
software, but in communications, you can't even trust yourself.) http://xkcd.com/327/ --David Garfield Simon Slavin writes: On 14 Nov 2011, at 5:53pm, Dotan Cohen wrote: I recommend against formulating the SQL statements in Javascript. Because if I find that page, I _will_ try to inject my

Re: [sqlite] Help with sqlite3OsRead - porting to a new OS

2011-10-25 Thread David Garfield
Sounds like it could be a difference in calling convention... Check compile options and function declaration modifiers. --David Stuart Thomson writes: Hi, I'm in the middle of porting sqlite3 to a new Operating System and have come across a problem with the sqlite3OsRead function in the

Re: [sqlite] Help with sqlite3OsRead - porting to a new OS

2011-10-25 Thread David Garfield
Also, if this is debugger output (as it appears), it could be that an optimizer is confusing the parameters. I see that all the time on GCC i386 when I set a breakpoint at the start of a function. --David David Garfield writes: Sounds like it could be a difference in calling convention

Re: [sqlite] Order by creating function is not sorting for input order and alphabet

2011-10-24 Thread David Garfield
are at it. (Actually... should it really be a string in the first place?) 3) digits[] may be insufficient in some cases (though not in your samples). --David Garfield ChingChang Hsiao writes: The purpose of function antok is that solve the problem of order by cli_id. Function antok converts

Re: [sqlite] Doc bug in on-line description of round() function

2011-10-21 Thread David Garfield
at least, these are treated as 0. This might be system dependent or undefined behavior. 3) It says nothing about non-integer values of Y. For me at least, they are truncated (not rounded), so round(1.234,1.8) is 1.2. Again, this might be system dependent or undefined behavior. --David

Re: [sqlite] sqlite3_open_v2 vs. *ppDb=NULL

2011-10-12 Thread David Garfield
-dangerous. That sqlite3_errmsg() had to guess and guessed wrong is not surprising. --David Garfield Krystian Bigaj writes: Hi, Documentation says that: The only exception is that if SQLite is unable to allocate memory to hold the sqlite3 object, a NULL will be written into *ppDb instead

Re: [sqlite] Using COUNT(*) in unusual circumstances

2011-10-07 Thread David Garfield
WHERE or HAVING clauses that refer back to named results could be a problem with the simple replacement. SELECT a,b,a+b AS ab FROM t WHERE ab10 Igor's suggestion work there too. --David Garfield Simon Slavin writes: I'm trying to write some code which has to be useful under many

Re: [sqlite] Using COUNT(*) in unusual circumstances

2011-10-07 Thread David Garfield
COUNT(*) FROM t1, t2; SELECT (SELECT COUNT(*) FROM t1) * (SELECT COUNT(*) FROM t2); Of course, those are special cases. Application programmers should probably watch for this kind of thing, but it probably wasn't what the programmer wanted to count in the first place. --David Garfield

Re: [sqlite] Porting a simple logon script to SQLite3 from MySQL

2011-10-05 Thread David Garfield
is magic for a INTEGER PRIMARY KEY column. Use NULL instead of '0' in both platforms. --David Garfield ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Query Problems - Keyword? Encoding?

2011-09-29 Thread David Garfield
in the first place. Or use a binary blob instead of a hex dump of it, and use (note the x): SELECT * FROM recordings WHERE key = x'4df0247ce1a97685a782d2cb051b48ed952e666c'; --David Garfield Eric Anderson writes: The below statement returns records: SELECT * FROM recordings WHERE key LIKE

Re: [sqlite] feed endless data into sqlite, thru a shell script

2011-09-27 Thread David Garfield
to a terminal. I think the only easy way to externally disable the buffer is to wrap the program in a pseudo-tty. Alternatively, look for an option that lets you explicitly unbuffer. (for instance, in perl, do: $| = 1; ) --David Garfield Patrick Proniewski writes: On 27 sept. 2011, at 18:31, Roger

Re: [sqlite] feed endless data into sqlite, thru a shell script

2011-09-27 Thread David Garfield
Patrick Proniewski writes: On 27 sept. 2011, at 20:14, David Garfield wrote: Any entry in a pipe could be buffering. In a quick test here, awk is buffering. To find the buffering, try using the pieces up to a given stage with | cat added at the end. If this buffers, you've found

Re: [sqlite] NUL handling bugs (was Re: c-api document suggestion)

2011-09-26 Thread David Garfield
Roger Binns writes: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/23/2011 05:51 PM, David Garfield wrote: SQLite's API supports both (mostly). Internally, you must use one or the other (or hideously duplicate code), Not really. If your own code only uses NUL termination

Re: [sqlite] NUL handling bugs (was Re: c-api document suggestion)

2011-09-26 Thread David Garfield
replace the built-in functions. You should not have to. --David Garfield ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] NUL handling bugs (was Re: c-api document suggestion)

2011-09-26 Thread David Garfield
to not have to count the length of strings. --David Roger Binns writes: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/26/2011 01:13 PM, David Garfield wrote: In documented one case (prepare), NULs are string terminators even with the count, and there is an extra optimization you may

Re: [sqlite] NUL handling bugs (was Re: c-api document suggestion)

2011-09-26 Thread David Garfield
___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users --David Garfield ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin

Re: [sqlite] NUL handling bugs (was Re: c-api document suggestion)

2011-09-23 Thread David Garfield
text and would like to have the text portions at least be visible. I suspect that at least part of this problem came from SQLite's history as a TCL add-on. I suspect TCL, at least in it's early days, didn't allow NUL in a string. --David Garfield Richard Hipp writes: On Thu, Sep 22, 2011 at 7

Re: [sqlite] NUL handling bugs (was Re: c-api document suggestion)

2011-09-23 Thread David Garfield
Roger Binns writes: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 09/23/2011 08:47 AM, David Garfield wrote: But that is the point. Strings are generally defined in two ways. Either: 1) a pointer, and count every byte up to but not including a NUL. 2) a pointer and a length

[sqlite] NUL handling bugs (was Re: c-api document suggestion)

2011-09-22 Thread David Garfield
Without the hex() calls, you can't even tell what worked and what didn't. --David Garfield Mira Suk writes: On 9/21/2011 21:22 Igor Tandetnik wrote: You can include the NUL terminator, if you want it to actually be stored in the database. Igor Tandetnik

Re: [sqlite] Bug in GCC - suggestions sought for a backup tool chain

2011-08-23 Thread David Garfield
for this optimization has changed. Having said this, it may well be reasonable to leave the test in place in case you someday choose to stop using the struct hack (which is undefined behavior as well), knowing that the compiler will optimize out the dead test. --David Garfield Richard Hipp writes

Re: [sqlite] EINTR and write() in os_unix.c

2011-08-18 Thread David Garfield
I think you are right, that it is too easy, at least on its own. You also should account for partial writes. I think the general rule is: if it wrote anything, it tells you how much it wrote, which can be everything you asked it to write, or less. If it wrote nothing, it usually returns -1 and

Re: [sqlite] Maximum number of tables in a data file

2011-08-09 Thread David Garfield
ways to waste ones time. Having said that, let me present a database for consideration: Any filesystem. Split the hex of the MD5 into directory levels and make what you need. Might be slower, particularly with some OSes, but the tools are easy. --David Garfield

Re: [sqlite] group_concat and empty strings

2011-08-03 Thread David Garfield
or blob. --David Garfield Jan writes: On http://www.sqlite.org/cvstrac/tktview?tn=3806 this bug is fixed. But I still get a NULL with group_concat(distinct x) with the latest windows sqlite shell: SQLite version 3.7.7.1 2011-06-28 17:39:05 Enter .help for instructions Enter SQL

Re: [sqlite] LevelDB benchmark

2011-07-27 Thread David Garfield
is the batches. --David Garfield Simon Slavin writes: On 28 Jul 2011, at 2:22am, Stephan Wehner wrote: There are some benchmark's at http://leveldb.googlecode.com/svn/trunk/doc/benchmark.html I don't have anything to point to, but I thought sqlite3 does better than stated there. i

Re: [sqlite] Anyway to order query results by in list?

2011-06-15 Thread David Garfield
you know a full table scan is acceptable. --David Garfield Michael Stephenson writes: Wondering if anyone has a way to execute a query that selects rows based on a list of rowids and returns the results in the order of the rowids passed in. Thanks, ~Mike

Re: [sqlite] Dynamic SQL for SQLite?

2011-05-11 Thread David Garfield
Wonderful. The other answer is that one probably should not have a table with seven columns and one row when one could have a table with two columns (day of week and value) and seven rows. Like the view you are suggesting. --David Nico Williams writes: On May 11, 2011 7:14 PM, John

Re: [sqlite] Advice to choose an index for quad tree?

2011-05-03 Thread David Garfield
imagery. --David Garfield Enrico Thierbach writes: Hi, I think an R Tree is what you are after. http://www.sqlite.org/rtree.html /eno ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo

[sqlite] Documentation error was Re: date field with default current date

2011-04-21 Thread David Garfield
http://www.sqlite.org/lang_datefunc.html This page has an error in documenting the range of values when using modifier 'unixepoch'. It says the limit is 10675199167. There should be one more digit in that to get the documented year 5352 result. --David Garfield Mihai Militaru writes: On Thu

Re: [sqlite] Request for help with SQLite Query to return missing Date/Time Ranges

2011-04-20 Thread David Garfield
they are uniform). --David Garfield Simon Slavin writes: On 21 Apr 2011, at 12:34am, Andrew Lindsay wrote: I am trying to search an SQL database that is meant to have entries logged every minute for a period of approximately 15 months. I want to create a query that will search

Re: [sqlite] updating records in table A from joined records in table B

2011-04-01 Thread David Garfield
A bit redundant, but how about: CREATE TABLE table_a (akey integer, avalue float); CREATE TABLE table_b (bkey integer, bvalue float); INSERT INTO table_a (akey, avalue) VALUES (1, 1.0); INSERT INTO table_a (akey, avalue) VALUES (2, 2.0); INSERT INTO table_a (akey, avalue) VALUES (3, 3.0);

Re: [sqlite] Insert BLOB data from the command line

2011-03-30 Thread David Garfield
Nice. For general use, you may also need to include duplicates in od. For the GNU coreutils and Solaris 10 implementations, this would be the -v or --output-duplicates option. --David Garfield Kees Nuyt writes: On Wed, 30 Mar 2011 12:51:11 -0400, Santin, Gloria sant...@westinghouse.com wrote