Re: [sqlite] Do I need to migrate to MySQL?

2011-06-03 Thread Igor Tandetnik
CASE" for symmetry. I don't think that could cause the slowdown, though. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] How to search column ascii containing chr(0)

2011-06-05 Thread Igor Tandetnik
iip <iip.umar.ri...@gmail.com> wrote: > As subject, I want to know how search column that contain ascii chr(0) select * from MyTable where hex(MyField) like '%00%'; -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite

Re: [sqlite] How to search column ascii containing chr(0)

2011-06-05 Thread Igor Tandetnik
Robert Myers <rob.my...@ziften.com> wrote: > On 6/5/2011 8:47 AM, Igor Tandetnik wrote: >> iip <iip.umar.ri...@gmail.com> wrote: >>> As subject, I want to know how search column that contain ascii chr(0) >> select * from MyTable where hex(MyField) like

Re: [sqlite] [mlist] How to search column ascii containing chr(0)

2011-06-05 Thread Igor Tandetnik
That's the first thing I tried. It seems that the LIKE operator treats NUL character as end-of-string, so the test becomes LIKE '%', which of course matches everything. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org

Re: [sqlite] Bug in .indices

2011-06-06 Thread Igor Tandetnik
ices t sqlite_autoindex_t_1 If you are talking about INTEGER PRIMARY KEY column, then no index is shown for it because none is created. See also http://sqlite.org/lang_createtable.html#rowid -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@s

Re: [sqlite] Problem with create table and strftime

2011-06-06 Thread Igor Tandetnik
EFAULT (Datetime('now')), > > The UNIQUE constraint is disappeared and the DEFAULT is changed. This sounds extremely unlikely. If I had to guess, I'd suspect you already have the table in the database, with the old schema, and the new CREATE TABLE statemen

Re: [sqlite] Handling of IEEE-754 nan and +/-inf in SQLite?

2011-06-06 Thread Igor Tandetnik
be terminated, diagnostic information is to be made available, and execution of the statement is to have no effect on SQL-data or schemas. So SQLite behaves neither in the way expected by the OP, nor in the way prescribed by the standard (I'm not arguing that's a bad thing, just stating the fact). --

Re: [sqlite] Bug in .indices

2011-06-06 Thread Igor Tandetnik
Cecil Westerhof <cldwester...@gmail.com> wrote: > 2011/6/6 Igor Tandetnik <itandet...@mvps.org>: >> If you are talking about INTEGER PRIMARY KEY column, then no index is shown >> for it because none is created. See also >> http://sqlite.org/lang_createtable.h

Re: [sqlite] cross join very slow, which is better select virtually using cross join, or create physically data output from cross join?

2011-06-12 Thread Igor Tandetnik
table? Again, you are contemplating a table of 4 billion records. What do you think you need it for? What's the ultimate goal of the exercise? -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Store result of calculation or not

2011-06-12 Thread Igor Tandetnik
e=1 AND player1 = '?' AND player2 > = '?'", 0, %opp, %username); Why do you need two? It seems that the only difference between them is the order of columns in SELECT clause. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Query help

2011-06-12 Thread Igor Tandetnik
ivity < datetime('now', -ping_timeout || ' seconds', 'localtime'); -- or select id from Clients where (julianday('now', 'localtime') - julianday(last_activity)) * 86400 > ping_timeout; -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Store result of calculation or not

2011-06-12 Thread Igor Tandetnik
records into the table in the first place. So that, whenever a game between players A and B is recorded, A will always be player1 and B player2. Even if the order is significant, I'd still consider doing this, and recording in a separate field whether the or

Re: [sqlite] Store result of calculation or not

2011-06-12 Thread Igor Tandetnik
dex, ie: > > where player1 = ? and player2 = ? and complete = 1 SQLite is smart enough to automatically reorder expressions combined with AND to match an index. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Breaking a string into two

2011-06-16 Thread Igor Tandetnik
), 'abc...xyz') to extract the second part (spell out the rest of the alphabet in place of '...'). The first part is left as an exercise for the reader. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] need help with a query using datetime

2011-06-17 Thread Igor Tandetnik
-31 09:00|2011-12-30 21:00 > 2011-12-31 12:15|2011-12-31 00:15 In place of datetime and substr, consider strftime('%Y-%m-%d %H:%M', d, '-12 hours') -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] select (partly) url-encoded strings?

2011-06-17 Thread Igor Tandetnik
(table.name)='some file name'; > > So I guess my question is: is there such a function "urldecode()" No. > and > if not, what is the best way to solve this problem? http://sqlite.org/c3ref/create_function.html > Can I define my > ow

Re: [sqlite] select (partly) url-encoded strings?

2011-06-17 Thread Igor Tandetnik
e3 (and have it dropped on exit)? create temp table decoded(decodedUrl); insert into decoded(decodedUrl) select urldecode(name) from "table"; You can create indexes on temp table - they will be dropped together with the table when you close the connecti

Re: [sqlite] How to use LIKE wildcards and bound parameters?

2011-06-18 Thread Igor Tandetnik
e3_bind_parameter_index(stmt, ":bp"), > "%myvar%", .. > > Other than the literal string? char myexpandedvar[10]; sprintf(myexpandedvar, "%%%s%%", myvar); sqlite3_bind_text(..., myexpandedvar, ...); In other words, you can use string manipulati

Re: [sqlite] Howto...multi-sqlite command string through sqlite3_prepare_v2() to create SINGLE statement

2011-06-21 Thread Igor Tandetnik
statements like this in a single call. You do need to terminate each statement with a semicolon. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Multiple Process problem

2011-06-21 Thread Igor Tandetnik
erform INSERT or UPDATE or DELETE, initiate such transactions with BEGIN IMMEDIATE statement. This lets SQLite know that the transaction intends to write at some time in the future, which allows SQLite to avoid deadlock situations. -- Igor Tandetnik

Re: [sqlite] Problem with Read/Write concurency

2011-06-23 Thread Igor Tandetnik
if the read uncommitted pragma and shared_cache are > enabled that the select will not take any locks? It will not take any in-memory locks within the shared cache. It will still take the regular SHARED locks on the database file. -- Igor Tandetnik _

Re: [sqlite] Ordered group by

2011-06-23 Thread Igor Tandetnik
m to work right and I am not sure whether it should or not. It is not guaranteed, but it'll probably work. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Indexes on columns

2011-06-24 Thread Igor Tandetnik
issue? What issue? Why is having an explicit index, separate from that built into the table itself, important to you? What exactly do you feel is wrong with the way things are now? -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.or

Re: [sqlite] Indexes on columns

2011-06-24 Thread Igor Tandetnik
, the table itself essentially acts as an index on this column, no additional external data structure is necessary. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] ISNULL in sqlite

2011-06-25 Thread Igor Tandetnik
logan...@gmail.com wrote: > How do I check for a null or empty string in SQLite. SQL server has ISNULL > but it doesn't seem to be supported in SQLite. where MyField is null -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.or

Re: [sqlite] Selecting indexes to use & NOT INDEXED

2011-06-27 Thread Igor Tandetnik
can suppress the index on CAT with a unary plus operator, like this: ... AND +CAT=25; -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Using Unicode to display data?

2011-06-28 Thread Igor Tandetnik
x(name) from varmod_stent2010 limit 5; where 'name' is the name of the third column, the one with long text. You need to convert the text to UTF-8 before inserting it into SQLite. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sql

Re: [sqlite] Query Alternatives

2011-06-29 Thread Igor Tandetnik
nt - the first one may return more rows. In those cases where they are equivalent, I strongly doubt you'll notice any performance difference. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Defining a relationship as unique

2011-06-30 Thread Igor Tandetnik
f I > could in some way let SQLite know that? create unique index ... > Also... it does seem weird that id is the primary key when I'll never > actually use it. Then make it create table tournamentParticipantTable ( user INTEGER, tournamentId INTEGER, primary

Re: [sqlite] WHERE clause inspection

2011-06-30 Thread Igor Tandetnik
BY, LIMIT, ON and other clauses - whenever an expression is allowed by the syntax. Seems to be just what you need. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] WHERE clause inspection

2011-06-30 Thread Igor Tandetnik
values in the column 'otherColumnName' can't affect the > results-list for a query only dependent on the column 'columnName'. What do you mean, can't affect? The SELECT statement is returning the values from otherColumnName in the resultset. If changing those doesn't affec

Re: [sqlite] sqlite-users Digest, Vol 42, Issue 30

2011-06-30 Thread Igor Tandetnik
JOIN query may return more than one row from TableB for each row of TableA, while the subselect query will only ever return one (even if more exist). The first query will always return the same number or more rows than the second, never fewer. --

Re: [sqlite] How to search for multiple values in a column including null without repeating column name ?

2011-07-02 Thread Igor Tandetnik
the values already in the list: select * from table_name where coalesce(column_name, 1) in (1,2,3); Note that, in either case, SQLite won't be able to use an index on column_name (assuming you have one), whereas in the original query it may. -- Igor Tandetnik

Re: [sqlite] Compound update isn't working as I expect

2011-07-03 Thread Igor Tandetnik
ICE_ID = *INVOICE_ID*), where ii.INVOICE_ID = INVOICE.INVOICE_ID -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] optimizing an update

2011-07-03 Thread Igor Tandetnik
bselect. The second would calculate Tax and Total from Sub_Total. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] DROP TABLE yields SQLITE_LOCKED from user-defined function

2011-07-07 Thread Igor Tandetnik
o way to drop a table from a user-defined function. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] using index when using concatination

2011-07-10 Thread Igor Tandetnik
don't create a 2nd field holds the 1st and last char? > and index that? Then your query should be blazingly > fast as it will actually use the index (which I don't believe LIKE uses at > all). It may, under certain limited circumstances. -- Igor Tandetnik

Re: [sqlite] using index when using concatination

2011-07-10 Thread Igor Tandetnik
Igor Tandetnik <itandet...@mvps.org> wrote: > Black, Michael (IS) <michael.bla...@ngc.com> wrote: >> Any particular reason you can't build your own string and just pass one >> parameter? >> >> select * from words where "word" like ?; > >

Re: [sqlite] using index when using concatination

2011-07-10 Thread Igor Tandetnik
llation (e.g. if :first is 'a', then :next is 'b'), and :last is the last letter. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] using index when using concatination

2011-07-10 Thread Igor Tandetnik
us, LIKE works with NOCASE collation while GLOB wants BINARY collation. The document I cited discusses all this in detail. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Header pointers in table callback

2011-07-11 Thread Igor Tandetnik
o in hand, it's trivial to build a map<string, vector > : for (int i = 0; i < data.size(); ++i) { mymap[headers[i]].swap(data[i]); } Actually, I'd not use sqlite3_exec at all, but instead a loop based on sqlite3_prepare and sqlite3_step. -- Igor Tandetnik _

Re: [sqlite] surprising missing query optimization

2011-07-12 Thread Igor Tandetnik
BPNewENTRY and look up in ENTRY_ATTRIBUTES using index. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Index question about index

2011-07-14 Thread Igor Tandetnik
On 7/14/2011 12:01 PM, Pavel Ivanov wrote: >> could the next query use the tsamov_code index ??: >> select * from tsamov where tsamov_code like 'AFG%' > > Only after > pragma case_sensitive_like = true; ... or if the index uses COLLATE NOCASE claus

Re: [sqlite] Query with subqueries: is this the good way to go?

2011-07-15 Thread Igor Tandetnik
.id and m.pub=1) WHERE otopic.categoria=? and otopic.pub=1 group by otopic.id ORDER BY otopic.sticky,otopic.inserito DESC; You certainly want an index on messagi.topic -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://s

Re: [sqlite] Understanding table-level locking in shared-cache mode

2011-07-15 Thread Igor Tandetnik
ty. Does that really just > help with allowing readers to continue against one table while a writer > is writing to some other table? That's my understanding, yes. Note that the stated purpose of shared-cache mode is not to improve concurrency, but to "significantly reduce the quan

Re: [sqlite] Understanding table-level locking in shared-cache mode

2011-07-15 Thread Igor Tandetnik
write to two tables at the same time. That's pretty much what makes it "lite". -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Hidding records from the application

2011-07-15 Thread Igor Tandetnik
know which application is allowed to see these rows and which one isn't? Presumably, *someone* must be able to see them, or else you can just delete them and be done with it. What exactly makes an application "upper user application" (as opposed to "lower system application"

Re: [sqlite] I havn't a clue

2011-07-15 Thread Igor Tandetnik
Excel will be able to import from it. > Even SQLite website say something about SQLite.exe but the Zip file has no > .exe file in it. Does too: http://sqlite.org/sqlite-shell-win32-x86-3070701.zip -- Igor Tandetnik ___ sqlite-users mailing list

Re: [sqlite] Hidding records from the application

2011-07-16 Thread Igor Tandetnik
ence between records that exist but are hidden from you, and records that don't exist at all? -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Hidding records from the application

2011-07-16 Thread Igor Tandetnik
san long <kerneltrap...@gmail.com> wrote: > right, but now I just want to hide these records to all processes. Just delete them. That would have the same observable effect. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite

Re: [sqlite] index confusion

2011-07-17 Thread Igor Tandetnik
on the fly for one particular query). It's a regular permanent index, with an automatically generated name. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Performance Improvement

2011-07-18 Thread Igor Tandetnik
t by address then sequence number, probably using some form of the merge sort algorithm (which allows one to sort a data set larger than the available RAM). Then do a single pass over the sorted list, looking for sequences of repeated addresses. -- Igor Tandetnik __

Re: [sqlite] Changing row separator to null when accessing sqlite frombash script

2011-07-19 Thread Igor Tandetnik
ting up > incorectly. Try changing your query to something like select one || x'00' from tbl1 WHERE one LIKE '%this%'; You can add any other separator this way. Note that it will be in addition to, not in place of, the line feed character. -- Igor Tandetnik ___

Re: [sqlite] "override" table?

2011-07-20 Thread Igor Tandetnik
ent you come up with, SQLite will end up doing the same thing - look up the row in override table and then in main table. Might as well do this explicitly. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Select names where occurences are greater than 10

2011-07-21 Thread Igor Tandetnik
only want to include it once? count(distinct track) -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] c-api

2011-07-27 Thread Igor Tandetnik
general, no, there's no special way to handle SELECT statements that return a singleton (one row/one column) resultset. You can always write your own helper function, of course. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] datetime('now') has only per-second resolution?

2011-08-04 Thread Igor Tandetnik
s (...,time) VALUES (...,strftime('%Y-%m-%d > %H:%M:%f','now')); That's one way to do it, yes. > then the results from SELECT queries will contain fractions of a second. Of course. You get back out exactly what you put in. -- Igor Tandetnik ___ sqlit

Re: [sqlite] Problem inserting empty Foreign Key in c++

2011-08-05 Thread Igor Tandetnik
s in the other. '' is not the same as NULL. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Unicode function for collapsing upper/lower case

2011-08-07 Thread Igor Tandetnik
Simon Slavin <slav...@bigfraud.org> wrote: > But I wondered > whether there were patterns in the unicode which made it simple to ignore > string case. http://www.sqlite.org/cvstrac/fileview?f=sqlite/ext/icu/README.txt -- Igor Tandetnik ___

Re: [sqlite] Feature request: extend the IN operator

2011-08-07 Thread Igor Tandetnik
single system does - surely systems exist that do not denormalize their data this way. In fact, I doubt the design you describe is common, let alone universally accepted. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] %Q vs. %q

2011-08-08 Thread Igor Tandetnik
/mprintf.html The %Q option works like %q except it also adds single quotes around the outside of the total string. Additionally, if the parameter in the argument list is a NULL pointer, %Q substitutes the text "NULL" (without single quotes). So, the

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

2011-08-09 Thread Igor Tandetnik
ingle table having MinuteOfDay as an extra column? -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

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

2011-08-09 Thread Igor Tandetnik
ys. I > am currently creating a new data file per day, with hourly tables. Doesn't that defeat the point? Wouldn't that only guarantee uniqueness within the last hour? -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http:

Re: [sqlite] Update one table from matches in another

2011-08-10 Thread Igor Tandetnik
l varieties of these commands with errors, getting mixed > results. You can do both in one pass: update locations set ItemCount = case when Location in (select Location from hive) then '1' else '0' end; -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Data deleted

2011-08-10 Thread Igor Tandetnik
> > However, all the data in one of the other tables also gets deleted > during the operation. Why is this? There's either a trigger doing the deletion, or a foreign key with ON DELETE CASCADE clause. -- Igor Tandetnik ___ sqlite-user

Re: [sqlite] SQLite + unicode

2011-08-10 Thread Igor Tandetnik
On 8/10/2011 11:55 AM, NOCaut wrote: > Where i can find c++ unicode unit for work with SQLite database? Thanks. What kind of "unit"? What is it that you want to do, but cannot, without such a "unit"? -- Igor Tandetnik ___ sq

Re: [sqlite] SQLite + unicode

2011-08-10 Thread Igor Tandetnik
On 8/10/2011 12:08 PM, NOCaut wrote: > in the other forum say: "You can get the SQLite source code and compile it > directly with C++ Builder (2010 and XE tested)." If you need SQLite source code, it's here: http://sqlite.org/download.html . See also http://sqlite.org/amalgamati

Re: [sqlite] SQLite + unicode

2011-08-10 Thread Igor Tandetnik
help me? I imagine it should. You might also fine these useful: the API reference http://sqlite.org/c3ref/funclist.html And a very simple sample: http://sqlite.org/quickstart.html > you understand me? No, I don't think I do, I must admit. --

Re: [sqlite] SQLite + unicode

2011-08-11 Thread Igor Tandetnik
16 (which accepts wchar_t*), sqlite3_step, sqlite3_finalize. Read text from columns with sqlite3_column_text16 (which returns wchar_t*). -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] SQLite + unicode

2011-08-11 Thread Igor Tandetnik
NOCaut <per...@mail.ru> wrote: > I want use but sqlity3.h NOT have this function. Does not have which function? The one you can download from http://sqlite.org/download.html certainly declares all the functions I've mentioned. -- Igor

Re: [sqlite] Use of VACUUM

2011-08-11 Thread Igor Tandetnik
he ROWIDs might change ? ROWIDs might possibly change if the table doesn't have an explicit INTEGER PRIMARY KEY column, and you run VACUUM commad on the database containing this table. Which part of the statement you quoted do you find unclear? -- Igor Tandetnik __

Re: [sqlite] Singleton C++ Wrapper for SQLite?

2011-08-12 Thread Igor Tandetnik
me to the other, mayhem ensues. I suspect you'd only get it to work if you build SQLite itself as a DLL. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Insert rows into a foreign key table

2011-08-15 Thread Igor Tandetnik
SQL. Try this one: INSERT INTO ORDERS (OrderNo, P_Id) values ( 12345, (select P_Id from persons where LastName = 'Hansen')); The nested select should be enclosed in parentheses. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org htt

Re: [sqlite] Insert rows into a foreign key table

2011-08-15 Thread Igor Tandetnik
cted) always inserts one row, picking one of the Hansens in an unpredictable manner, or inserts NULL if there are none. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] aggregate by break in sequence

2011-08-16 Thread Igor Tandetnik
p the old table. 4) Use ALTER TABLE statement to rename the new table to the old name. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] How to retrieve the Specil characters from the Sql lite

2011-08-17 Thread Igor Tandetnik
or their _16 counterparts, directly. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Last record in db

2011-08-22 Thread Igor Tandetnik
.sqlite.org/cvstrac/wiki/wiki?p=ScrollingCursor -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Last record in db

2011-08-22 Thread Igor Tandetnik
record which is stored at the node with max depth? What's a "node" or a "depth" in this context? -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Last record in db

2011-08-22 Thread Igor Tandetnik
an all others in this ordering. In the other direction, if you have GetLastRecord(set_of_records) function defined somehow, then you can pick the last record, remove it from the set, pick the last of the remaining, remove that one from the set, and so on. This process generates a total ordering of the

Re: [sqlite] Last record in db

2011-08-22 Thread Igor Tandetnik
re efficient this way. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] EXT :Re: Last record in db

2011-08-22 Thread Igor Tandetnik
On 8/22/2011 9:52 AM, Black, Michael (IS) wrote: > No...if you use autoincrement you can guarantee that "last" will be the last > record inserted. There's no contradiction. "Last" is still defined only for ordered sets - you just chose a particular ordering, by

Re: [sqlite] Last record in db

2011-08-22 Thread Igor Tandetnik
2, 'another two'); sqlite> select rowid from t1 where rowid=(select max(rowid) from t1); 4 It seems that the record your statement returns is not the record that was successfully inserted most recently. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Last record in db

2011-08-22 Thread Igor Tandetnik
> above The quote you cite applies to the case where AUTOINCREMENT keyword is not specified. But in your latest example, you do specify one. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Last record in db

2011-08-22 Thread Igor Tandetnik
sqlite> select rowid, data from Auto where rowid=(select max(rowid) from Auto); 3|three Note how the record with data=='most recent' was never selected, despite being inserted by the most recent successful INSERT statement. -- Igor Tandetnik ___ sql

Re: [sqlite] Last record in db

2011-08-22 Thread Igor Tandetnik
e and the same, whether or not AUTOINCREMENT was specified when the table was created. Of course it's possible to construct an example where the same record is both most recently inserted and has the largest rowid. But it's also possible to construct an example where these are two different reco

Re: [sqlite] Simulating the BINARY data type

2011-08-22 Thread Igor Tandetnik
On 8/22/2011 2:34 PM, Pete wrote: > How can I store and retrieve data in the equivalent of mySQL's BINARY > datatype? The collation sequence doesn't matter in this instance. Is BLOB > the appropriate sqlite datatype? Yes, use BLOB. -- Igor

Re: [sqlite] EXT :Re: Last record in db

2011-08-22 Thread Igor Tandetnik
sreekumar...@gmail.com wrote: > How does sqlite insert a record ? More specifically how does sqlite update > the B-tree with the new record . Is there a linkage > made between the newly inserted record and the previous one ? http://www.sqlite.org/autoinc.html -- Igor

Re: [sqlite] Split Function for SQLite?

2011-08-22 Thread Igor Tandetnik
t; Key. Code > -- > 1. V1 > 1. V2 > 1. V3 I don't think you can do this with SQL alone. You'll have to implement the logic in your favorite programming language. -- Igor Tandetnik ___ sqlite-users mailing list

Re: [sqlite] INTEGER PRIMARY KEY and SQLITE_ENABLE_STAT2

2011-08-24 Thread Igor Tandetnik
s expected if itemID is a regular column with an index on it. I don't know the answer to your question, but if you are interested in a workaround, you can write WHERE +itemID BETWEEN 100 AND 200 The unary plus suppresses the use of index o

Re: [sqlite] Split Function for SQLite?

2011-08-24 Thread Igor Tandetnik
On 8/24/2011 9:36 PM, Gregory Moore wrote: > Thanks for answering! Can this not be added as a function? What parameters would such a function take, and more interestingly, what would its return value be? -- Igor Tandetnik ___ sqlite-users mail

Re: [sqlite] SQL-Beginner question about filtering

2011-08-25 Thread Igor Tandetnik
0 1 2 > 5 1 0 2 Any particular reason you are choosing the row with ROWID of 5 and not 2? In other words, if you have duplicates, by what principle do you choose which row to keep? -- Igor Tandetnik ___ sqlite-use

Re: [sqlite] Custom Collation comparing only firt character?

2011-08-25 Thread Igor Tandetnik
th, const void *str2) { > NSString *strA = [NSString hexStringWithData:str1 ofLength:1]; Well, I know nothing about Objective C, but the "ofLength:1" part looks highly suspicious. Shouldn't str1Length appear in there somewhere? -- Igor Tandetnik ___

Re: [sqlite] Custom Collation comparing only firt character?

2011-08-26 Thread Igor Tandetnik
st *choose* not to look at it beyond the first character. > I was expecting it to go further What is "it" in this sentence? Whom, other than yourself, were you expecting to go further? -- Igor Tandetnik ___ sqlite-users mailing list sql

Re: [sqlite] Custom Collation comparing only firt character?

2011-08-29 Thread Igor Tandetnik
uld have passed SQLITE_UTF8 instead). Further, the strings may not be NUL-terminated, that's why you are given their lengths. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] writing data in wrong table

2011-08-29 Thread Igor Tandetnik
difficulty, post here a reasonably small self-contained sample that reproduces the issue. -- Igor Tandetnik ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Clarification about Triggers

2011-08-30 Thread Igor Tandetnik
s. > I have tried something like this: > > create trigger [after_insert_temp_01] > after insert on temp_01 > begin > update total > set val = temp_01.val + temp_02.val > where rowid = old.rowid; > end; old.rowid is not defined in an "after insert" trigger. You are inse

Re: [sqlite] writing data in wrong table

2011-08-30 Thread Igor Tandetnik
in any of the parameters? Note that sqlite3_exec will happily execute multiple statements. Obligatory: http://xkcd.com/327/ > is it possible that this mistake is coming from the nfs? What is the nature of the "mistake", exactly? What data ends up in what table, against your

Re: [sqlite] Create custom function Sqlite Java to use in clause where

2011-08-30 Thread Igor Tandetnik
t '0' or '03' or '031'. This sentense doesn't make any sense to me, sorry. What's a "register" in this context? Anything that starts with '03' or '031' also starts with '0'. It seems that your condition is equivalent to " register (whatever that is) that st

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

2011-08-30 Thread Igor Tandetnik
his from a script so I want to just want to run > the command from a script so that I know the database exists before > issuing other commands. Try something like echo ".exit" | sqlite3 newdatabase.db -- Igor Tandetnik ___ sqlite-user

Re: [sqlite] How to configure any parameter to set max number of records to be added in SQLite DB

2011-08-30 Thread Igor Tandetnik
serted in DB table. No such parameter that I know of. PRAGMA max_page_count comes close, but it works in terms of bytes, not records. If you really want to limit the number of records, you should be able to achieve this with triggers. -- Igor Tandetnik ___ sq

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