[sqlite] Re: Does SQLite support user-defined data-types ?

2007-01-30 Thread Igor Tandetnik
Jerome CORRENOZ <[EMAIL PROTECTED]> wrote: I'm starting with SQLite and I would like to know if it is possible to create user-defined data-types through the following SQL command: create type MyType ... ? No. Igo

[sqlite] Re: How to specify collating sequences in an expression.

2007-02-01 Thread Igor Tandetnik
maybe it's also supported. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: How to specify collating sequences in an expression.

2007-02-01 Thread Igor Tandetnik
maybe it's also supported. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: special characters in sqlite3_bind_text

2007-02-02 Thread Igor Tandetnik
OM t WHERE comp=?; Should I be calling sqlite3_mprintf("abc'def") and passing that string off to bind? No you shouldn't. You should pass the text to sqlite3_bind_text as is, with no escaping. The pro

[sqlite] Re: DROP TABLE IF EXISTS my_table

2007-02-05 Thread Igor Tandetnik
supported with SQLite v3.3.0 and up. It appears that you are using an earlier version. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: newbie ask saving

2007-02-05 Thread Igor Tandetnik
Mr.X"); - x = Select no_id FROM A where name = 'Mr.X' - Insert B (no_id, Alamat, Telp) VALUES (x, 'x', '123'); Can't you use sqlite3_last_insert_rowid API? Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Newbie SQL question

2007-02-06 Thread Igor Tandetnik
See sqlite3_changes, sqlite3_total_changes Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: help with understanding the C interface

2007-02-06 Thread Igor Tandetnik
particular database connection (the client may open more than one, to the same or different files). When the client is done with this database connection, it calls sqlite3_close passing the handle. After that, the handle is invalid and doesn't need to be stored any longer.

[sqlite] Re: Busy timeout and prepare statements

2007-02-07 Thread Igor Tandetnik
qlite3_step (prepare and reset cannot encounter busy state). Note that sqlite3_exec is implemented in terms of sqlite3_step et al. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: ATTACH and :memory: databases

2007-02-07 Thread Igor Tandetnik
Dave Gierok <[EMAIL PROTECTED]> wrote: I would like to attach a :memory: database to another :memory: database. How is this possible As far as I can tell, this is not possible. Why would you want to? What are you trying to achieve? Igor Tan

[sqlite] Re: Leading zeros in strings

2007-02-08 Thread Igor Tandetnik
w.sqlite.org/datatype3.html In particular the notion of column type affinity. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: SQL syntax issue?

2007-02-08 Thread Igor Tandetnik
.cl_id = price_profiles.pp_client) LEFT JOIN prices ON price_profiles.pp_id = prices.pr_pp SQL error: no such column: clients.cl_lname Known SQLite limitation. Just drop the parentheses, you don't need them here. Igo

[sqlite] Re: Need help on build query.

2007-02-09 Thread Igor Tandetnik
Artem Yankovskiy wrote: I like delete some of table. DROP TABLE tableName; http://sqlite.org/lang_droptable.html Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: converting 1,234,567 to a number

2007-02-10 Thread Igor Tandetnik
rker. For instance: sqlite> SELECT CAST('1,234,567' AS REAL); 1.0 Your best bet is probably to clean up the data before passing it on to SQLite. Just strip non-digit characters and convert to a number in whatever language your application is written. SQL is ill suited for string manipula

[sqlite] Re: Re: Need help on build query.

2007-02-11 Thread Igor Tandetnik
a separate DROP TABLE query for each table name. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: New (ish) to C== and new to SQLite error with prepare.

2007-02-13 Thread Igor Tandetnik
length(), &pStmt, &pzTail); When you pass in pointers, they should actually point to a valid locaction in memory. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: UPDATE base on certain values

2007-02-13 Thread Igor Tandetnik
null, parent = ifnull(parent, '1171291314642') Same idea. Unless "parent" is null, this just does parent=parent children = '', login = 'blah', notes = 'blah-blah' if null, status = 'o' WHERE ProjID = '88'; Igor

[sqlite] Re: another

2007-02-14 Thread Igor Tandetnik
strip off the alias qualifier and create the table as col_1, col_2 What do you think it should do for something like create table C as select A.col, B.col from A, B; Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: SQL query - TOP

2007-02-16 Thread Igor Tandetnik
lauses. To select rows starting from th one (it appears that's what you are doing), do SELECT PATIENT_PK From PATIENTS Order By PATIENT_PK LIMIT OFFSET ; Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Update and insert questions

2007-02-16 Thread Igor Tandetnik
ndently, to the same or different values. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: compare open table and attached database table

2007-02-18 Thread Igor Tandetnik
'll get displayas from every record in addresses table, each repeated multiple times. Make it select displayas from main.addresses where displayas not in (select displayas from RemoteDb.addresses) Igor Tandetnik

[sqlite] Re: What is wrong with this SELECT CASE statement?

2007-02-18 Thread Igor Tandetnik
ATE A2IDC21_J SET DATE_OF_BIRTH = CASE (CAST(DATE_OF_BIRTH / 100 AS INTEGER) - CAST(DATE_OF_BIRTH / 1 AS INTEGER) * 100) WHEN 1 THEN 'January' WHEN 2 THEN 'February' ... END Also, the expression in the CASE can be simplified to CAST(DATE_OF_BIRTH AS IN

[sqlite] Re: Looking for equivalent syntax

2007-02-19 Thread Igor Tandetnik
tax like so UPDATE C1_credDerivEvent SET a.CDEvent = a.CDEvent || ',' || b.CDEvent FROM C1_credDerivEvent a JOIN C1_tmp_credDerivEvent b ON a.CDId = b.CDId JOIN tmp_events c ON b.CDEvent = c.CDEvent SQLite doesn't support this syntax either. FROM clause is not part of UPDATE s

[sqlite] Re: Looking for equivalent syntax

2007-02-19 Thread Igor Tandetnik
erivEvent b, tmp_events c where C1_credDerivEvent.CDId = b.CDId and b.CDEvent=c.CDEvent ) Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Looking for equivalent syntax

2007-02-19 Thread Igor Tandetnik
Igor Tandetnik <[EMAIL PROTECTED]> wrote: update C1_credDerivEvent set CDEvent = CDEvent || ',' || (select b.CDEvent from C1_tmp_credDerivEvent b where C1_credDerivEvent.CDId = b.CDId) where exists ( select * from C1_tmp_credDerivEvent b, tmp_e

[sqlite] Re: What query?

2007-02-19 Thread Igor Tandetnik
e rows when No2 change. So the result of such query should look like: IdNo1 No2 11001 11 31003 12 71006 13 91008 14 ... ... select min(Id), min(No1), No2 from TableName group by No2; Igor Tan

[sqlite] Re: Re: Looking for equivalent syntax

2007-02-20 Thread Igor Tandetnik
tmp_credDerivEvent b, tmp_events c where C1_credDerivEvent.CDId = b.CDId and b.CDEvent=c.CDEvent ) Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Unexpected Query Results

2007-02-21 Thread Igor Tandetnik
d within each of those, sub-group them by the third field (name == 'pos'). select * from voting order by cat, pos; Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Using AVG() Correctly

2007-02-21 Thread Igor Tandetnik
mn values within each of the three 'cat' column values. select cat, pos, avg(col1), avg(col2), ... from voting group by cat, pos; Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: how to get field names of empty tables ?

2007-02-23 Thread Igor Tandetnik
Stef Mientki <[EMAIL PROTECTED]> wrote: is there an SQL statement to get the field-names of empty tables ? PRAGMA table_info(tableName); Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Re: how to get field names of empty tables ?

2007-02-23 Thread Igor Tandetnik
Stef Mientki <[EMAIL PROTECTED]> wrote: Igor Tandetnik wrote: Stef Mientki <[EMAIL PROTECTED]> wrote: is there an SQL statement to get the field-names of empty tables ? PRAGMA table_info(tableName); I had seen that command, but I wrote something about that these commands could

[sqlite] Re: trigger with conditions

2007-02-26 Thread Igor Tandetnik
e when new.value = 'something' begin ... end; Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Quotes in SQLite ?

2007-02-27 Thread Igor Tandetnik
utting string literals directly into queries. No other characters need to be escaped. See also sqlite3_mprintf. However, I recommend using parameterized queries and binding your strings to parameters. Then you don't need to worry about escaping at all. Igo

[sqlite] Re: Re: Quotes in SQLite ?

2007-02-27 Thread Igor Tandetnik
Stef Mientki <[EMAIL PROTECTED]> wrote: Igor Tandetnik wrote: You need to escape single quotes if you insist on putting string literals directly into queries. No other characters need to be escaped. I've to translate doublequotes too, possibly because I'm using double quotes a

[sqlite] Re: How to change or add fields to a table ?

2007-02-27 Thread Igor Tandetnik
would need to create a new table and migrate data. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Re: How to change or add fields to a table ?

2007-02-27 Thread Igor Tandetnik
to change the name of a column (shouldn't be difficult to implement) ? Please feel free to submit a patch. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Insert

2007-02-28 Thread Igor Tandetnik
Christian POMPIER <[EMAIL PROTECTED]> wrote: Could i make to insert 10 000 row in my table with a loop ? Yes. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Re: Insert

2007-02-28 Thread Igor Tandetnik
Christian POMPIER <[EMAIL PROTECTED]> wrote: De : Igor Tandetnik [mailto:[EMAIL PROTECTED] Christian POMPIER <[EMAIL PROTECTED]> wrote: Could i make to insert 10 000 row in my table with a loop ? Yes. But what is the good syntax ? The syntax of the INSERT statement is de

[sqlite] Re: Performance problem

2007-03-01 Thread Igor Tandetnik
The query plan used now results in O(M*M') where M=4318 and M'=27058 - a much worse complexity. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: C

2007-03-01 Thread Igor Tandetnik
Lloyd wrote: How can I make an array of bit fields? something like, using the 16 bits of a short as an array of bits You can't. But, if you can use C++ rather than C, there's std::bitset class that does just that. Igor

[sqlite] Re: Performance problem

2007-03-01 Thread Igor Tandetnik
are 12-byte strings. That doesn't seem like an extreme case to me. The result should be 116,836,444. A faster approach would be: SELECT (SELECT count(*) FROM keyword WHERE value='music')* (SELECT count(*) FROM keyword WHERE value='history'

[sqlite] Re: subselect

2007-03-01 Thread Igor Tandetnik
j1 WHERE j1.empl_num = employee.empl_num) - Just to simple - so what am I doing wrong I don't get any syntax errors for this statement. The problem must be in something you don't show. Quote the exact

[sqlite] Re: subselect

2007-03-01 Thread Igor Tandetnik
qlite3 session. I'd check the code for typos, very carefully. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Any way to know the numbers of rows affected by a cmd?

2007-03-01 Thread Igor Tandetnik
Anderson, James H (IT) wrote: For a select, the number of rows selected. Just count them as you step through them. For an update, the number of rows updates. For a delete the number of rows deleted. sqlite3_changes, sqlite3_total_changes Igor Tandetnik

[sqlite] Re: Custom collate - on field or index or both?

2007-03-02 Thread Igor Tandetnik
syntax like "WHERE field = expr COLLATE collation" to expicitly specify collation for individual comparisons. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: sqlite3_total_changes() and multiple connections

2007-03-03 Thread Igor Tandetnik
ection was created using sqlite3_open()." but it seems like only changes made through the connection I call the function on are counted. This is correct. Is there any way to get the total number of changes made through all opened connections? Get the numbers for each connection, and add

[sqlite] Re: Newbie question about LIKE and ESCAPE

2007-03-03 Thread Igor Tandetnik
T someField IN someTable WHERE name LIKE 'xyzetc' ESCAPE ; No. ESCAPE should be followed by a string consisting of exactly one character. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Why it does not work properly?

2007-03-04 Thread Igor Tandetnik
some other? There are many ways to formulate the query you seem to want. E.g. select IdMat, Data from Mieszalnia order by Data desc limit 1; select IdMat, Data from Mieszalnia where Data = (select max(Data) from Mieszalnia); Igo

[sqlite] Re: Re: Why it does not work properly?

2007-03-05 Thread Igor Tandetnik
r this: select IdMat, ..., Data from Mieszalnia m1 where not exists ( select * from Mieszalnia m2 where m2.IdMat = m1.IdMat and m2.Data > m1.Data ); Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Sqlite3_prepare() question

2007-03-05 Thread Igor Tandetnik
ill use parameters in place of any literals you may need in the query. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: What is wrong with this simple query (offset)?

2007-03-06 Thread Igor Tandetnik
-- or LIMIT 2, -1 -1 means no limit. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Re: What is wrong with this simple query (offset)?

2007-03-06 Thread Igor Tandetnik
RB Smissaert <[EMAIL PROTECTED]> wrote: I take it there is no way to make it not return the field name. I'm not sure what you mean by "not return the field name". My wild guess is you are using sqlite3 command line utility. In this case, type .header OFF before run

[sqlite] Re: Re: Re: What is wrong with this simple query (offset)?

2007-03-06 Thread Igor Tandetnik
art of query resultset. If you see such a header, it must have been produced by whatever wrapper or adapter you are using. Consult the documentation or contact the authors of the same. Igor Tandetnik - To unsubscribe

[sqlite] Re: A few (probably) simple questions ...

2007-03-06 Thread Igor Tandetnik
uot; But when I try a RIGHT JOIN, I get an error message ??? SQLite doesn't support right outer joins at this time, only left joins. By the way, SQL syntax supported by SQLite is documented here http://www.sqlite.org/lang.html And here are the li

[sqlite] Re: Re: A few (probably) simple questions ...

2007-03-06 Thread Igor Tandetnik
uot;RIGHT", That's why I pointed you to http://www.sqlite.org/omitted.html. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Re: Re: A few (probably) simple questions ...

2007-03-06 Thread Igor Tandetnik
as expected. Can't reproduce. Can you show a small complete sample - a series of CREATE TABLE statements followed by the query that reports syntax error? Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Case Insensitive Equality Searches

2007-03-08 Thread Igor Tandetnik
ation, you need to provide one yourself (luckily SQLite supports custom collations). Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Argh, this must be a very stupid question ...

2007-03-08 Thread Igor Tandetnik
Stef Mientki <[EMAIL PROTECTED]> wrote: In the (windows) commandline version of sqlite: how do I open / connect an existing database ? Run it with database file name on the command line: sqlite3.exe mydb.db Igor Tan

[sqlite] Re: How do I know what DBs I have attached?

2007-03-09 Thread Igor Tandetnik
particular database file at the same time. It doesn't matter if you open the file directly, or attach it to an existing connection. If two processes attempt the modifying operation at the same time, one of them will proceed and the other will be locked out.

[sqlite] Re: Is there an inverse for .import?

2007-03-09 Thread Igor Tandetnik
Anderson, James H (IT) wrote: I need to "export" a table to a file in the same format as used by .import, but I don't see any such cmd. .dump Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: are nested joins possible ?

2007-03-09 Thread Igor Tandetnik
amen ON Patient.PatNr = Opnamen.PatNr; It will also likely be much more efficient: all these nested subselects pretty much disable SQLite optimizer. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: What is wrong with this UPDATE?

2007-03-10 Thread Igor Tandetnik
when ADDED_DATE = 0 OR ADDED_DATE IS NULL then '' else ADDED_DATE end), START_DATE = (case when START_DATE = 0 OR START_DATE IS NULL then '' else START_DATE end); Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Re: How do I know what DBs I have attached?

2007-03-10 Thread Igor Tandetnik
locked out. Is there a way of telling the DB to UPDATE records after the actual connection has completed its processing? Something like UPDATE queue? I'm not sure I understand the question. Update records after which of possibly multiple connections has completed its process

[sqlite] Re: Re: Re: How do I know what DBs I have attached?

2007-03-10 Thread Igor Tandetnik
s to do an update to his data. At millisecond later, user2 connects to do an update to his data, and here is the question, can user say say something like, UPDATE TAble after database is not busy. Not quite, but you can retry again some time later. See also sqlite3_

[sqlite] Re: Meta Information: How to retrieve the column names of a table ?

2007-03-11 Thread Igor Tandetnik
t;? I'm not familiar with the terms. With that information I may use sqlite3_column_meta_data to get additional information about the coumns ... What's sqlite3_column_meta_data? It doesn't seem to be menti

[sqlite] Re: results from a prepared select statement

2007-03-14 Thread Igor Tandetnik
rieve those results in a loop, I would like to now how many rows I need to retrieve? You can't know that until you retrieve them all. SQLite engine itself doesn't know that. Just keep going until you get SQLITE_D

[sqlite] Re: Re: Meta Information: How to retrieve the column names of a table ?

2007-03-14 Thread Igor Tandetnik
data. Every DBMS provides its own syntax. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: to quote or not ?

2007-03-14 Thread Igor Tandetnik
ider these valid SQL statements: create table Opnamen (PatNr, "Opnamen.PatNr"); insert into Opnamen values (1, 2); select Opnamen.PatNr, "Opnamen"."PatNr", "Opnamen.PatNr", Opnamen."Opname

[sqlite] Re: Adding columns of records and updating the result to a record

2007-03-15 Thread Igor Tandetnik
persistently, create a separate table containing just those totals records. Use triggers to update these totals whenever something changes in the main table. Again, do not put totals records in the main table. Igor Tandetnik ---

[sqlite] Re: 2 questions concerning select statement

2007-03-19 Thread Igor Tandetnik
clause may I use a column which is part of the table but nor part of the result? Yes. In fact, you can use any expression, not just a column name. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: multithread problem

2007-03-20 Thread Igor Tandetnik
ad and modify them in the other? You can create tables on any thread, it doesn't matter. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: data type problem

2007-03-20 Thread Igor Tandetnik
7; but not 'char(32)' SQLite ignores length restriction. Any cell may store a string of arbitrary length (or, indeed, any other supported data type). For more details, see http://sqlite.org/datatype3.html Igor Tandetnik

[sqlite] Re: Raise not working.

2007-03-20 Thread Igor Tandetnik
=new.id) > 0 BEGIN when What is this 'when' doing here? update blocked set hits = hits + 1 where id = new.id; RAISE (IGNORE) RAISE is a function, not a statement. Make it select RAISE(IGNORE); Igor Tandetnik -

[sqlite] Re: Question about multithreading

2007-03-22 Thread Igor Tandetnik
ead has tons of utility methods called from other threads You seem to say "thread" when you mean "class", and this lies at the heart of your confusion. Realize that the two are entirely different, largely unrelated concepts. Igor Tandetnik ---

[sqlite] Re: Holding sqlite connection

2007-03-22 Thread Igor Tandetnik
xecute some statement. SQLITE_MISUSE error doesn't indicate a conflict (SQLITE_BUSY does) - it means you are doing something wrong, like trying to execute a statement that was already finalized. In other words, SQLITE_MISUSE signals a bug in your program. Find it an

[sqlite] Re: SPAM: Re: Question about multithreading

2007-03-22 Thread Igor Tandetnik
currently executes is a method of an object that happened to be created by thread A is immaterial. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Clarification of bound parameter usage

2007-03-22 Thread Igor Tandetnik
n in a loop just call sqlite3_bind_*/step/reset, finalizing after all of my calls have been done? Of course. That's precisely what parameters are for. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Re: Re: Question about multithreading

2007-03-22 Thread Igor Tandetnik
with whatever thread were calling it, and you won't have to keep opening and closing connections all the time. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Missing tables in sqlite_master

2007-03-22 Thread Igor Tandetnik
lt handle. If there are no more rows, returns FALSE, otherwise returns an associative array representing the row data." You need to call it repeatedly to retrieve all the rows. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Store and retreive 0D0A (CRLF) in string field

2007-03-25 Thread Igor Tandetnik
her done by whatever wrapper you use on top of SQLite, or simply an artifact of the way you inspect the data (e.g. you look at the string in a debugger, and the debugger just happens to show only the first line). Use sqlite3_column_bytes[16] to convince yourself that SQLite gives you the complete str

[sqlite] Re: The IN keyword

2007-03-28 Thread Igor Tandetnik
Jonas Sandman <[EMAIL PROTECTED]> wrote: Still, can this be done without knowing how many extensions there are on beforehand? Something like this perhaps: SELECT * FROM Files WHERE :extension like '%!' || extension || '!%'; and build extension list like !mp

[sqlite] Re: Index usage for inequalities and GROUP BY

2007-03-28 Thread Igor Tandetnik
? They are separate, largely unrelated queries. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: what's the fastest way to get the record count of a table?

2007-03-28 Thread Igor Tandetnik
count in a separate table, use triggers to keep it up-to-date as rows get added and deleted in the main table. In fact, instead of polling, you can use the same triggers to notify you of changes, e.g. by having them call a custom function. Igor

[sqlite] Re: Python-Sqlite Unicode characters

2007-03-29 Thread Igor Tandetnik
t. Even if I'm not being malicious, consider what happens if I innocently put text containing quotes into the description field. Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: create or update question

2007-04-03 Thread Igor Tandetnik
to what I need but I can't figure out how to update with a default on the first record and update with a calculation on existing records. I can't think of any way to avoid two requests. Run the update statement, use sqlite3_changes to check whether any row has actually been updated.

[sqlite] Re: SQL help

2007-04-03 Thread Igor Tandetnik
ll_id=?; This returns 0 if there's at least one record with is_complete=0 (min will select it), or if there are no matching records at all (min will produce NULL, coalesce will convert it to 0). Igor Tandetnik - To u

[sqlite] Re: Novice help

2007-04-03 Thread Igor Tandetnik
y existing, right? It is not creating anything for me Or I am not able to find where it is creating one. It delays actually creating the file until you create the first table. Run a valid CREATE TABLE statement. Igor Tandetnik --

[sqlite] Re: What query should I use?

2007-04-04 Thread Igor Tandetnik
13 test05 test98 10 1008 14 test01 test03 ... ..... .. How should this query look like? select * from tableName t1 where t1.Text2 != ( select t2.Text2 from tableName t2 where t2.Id < t1.Id order by t2.Id desc limit 1 ); Igor

[sqlite] Re: Math functions

2007-04-04 Thread Igor Tandetnik
Nathan Biggs <[EMAIL PROTECTED]> wrote: Does anyone know if there is a floor function in sqlite, or of a way to implement it. cast(expr as integer) truncates towards zero, in case it helps. Igor Tandetnik --

[sqlite] Re: What query should I use?

2007-04-05 Thread Igor Tandetnik
ys the first row from original data set? select * from tableName t1 where coalesce( t1.Text2 != (select t2.Text2 from tableName t2 where t2.Id < t1.Id order by t2.Id desc limit 1), 1); Igor

[sqlite] Re: Math functions

2007-04-05 Thread Igor Tandetnik
required for portability, you can try something like this: select case when @float >= 0.0 then cast(@float as int) else cast(@float-1 as int) end This would give wrong answer if @float is negative and whole. Igor Tandetnik -

[sqlite] Re: Currency Formatting within SQLite

2007-04-06 Thread Igor Tandetnik
ormat. Then you can do something like select FormatCurrency(currencyValue) from ...; Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: Re: Currency Formatting within SQLite

2007-04-06 Thread Igor Tandetnik
tion, you can happily use GetCurrencyFormat or any other API. What again seems to be the problem? Igor Tandetnik - To unsubscribe, send email to [EMAIL PROTECTED] -

[sqlite] Re: sqlite3.exe .import command

2007-04-06 Thread Igor Tandetnik
change it with .separator , I would appreciate help on this particular problem and also a URL for any documentation of the sqlite3.exe program. There's a built-in help accessible with ".help" command. Not very extensive, but usually sufficient.

[sqlite] Re: Re: Re: Currency Formatting within SQLite

2007-04-06 Thread Igor Tandetnik
o the DLL, or is it database file specific? It can be compiled into any piece of code that can call sqlite3_create_function[16] API. Custom functions are not permanent, they exist within a particular database connection, the one whose handle you pass as the first parameter to sqlite3_create_

[sqlite] Re: Nested SELECT : Alternative syntax please ?

2007-04-08 Thread Igor Tandetnik
ocations.code LIKE 'B%') WHERE funky_values LIKE '1%' ; select count(*) from locations where locations.code like 'B___1%'; -- or select count(*) from locations where locations.code like 'B%' a

[sqlite] Re: Nested SELECT : Alternative syntax please ?

2007-04-08 Thread Igor Tandetnik
ething like: SELECT COUNT(cust.id) FROM (SELECT cust.id, COUNT(order.id) AS order_count FROM cust, order WHERE order.cust_id=cust.id GROUP BY cust.id) WHERE order_count>10 ; select count(cust.id) from cust where ( select count(*) from order where order.cust_id = cust.id) > 10

[sqlite] Re: Re: Nested SELECT : Alternative syntax please ?

2007-04-08 Thread Igor Tandetnik
Jay Sprenkle <[EMAIL PROTECTED]> wrote: On 4/8/07, Igor Tandetnik <[EMAIL PROTECTED]> wrote: Jaime Castells <[EMAIL PROTECTED]> wrote: Hmm, I think the only time you really can't avoid a nested query is when you want to do a grouping function on the result of a groupi

[sqlite] Re: SQLite and nested transactions

2007-04-09 Thread Igor Tandetnik
7;); BEGIN child; insert into t values ('b'); ROLLBACK child; insert into t values ('c'); COMMIT parent; As a result of this sequence, the table should have two new rows with values 'a' and 'c', but not 'b'. As far as I can tell, this is impossi

[sqlite] Re: SQLite and nested transactions

2007-04-09 Thread Igor Tandetnik
ble DBMS), but what happens on _rollback_. A full implementation would roll back to the state at which nested transaction originated, and keep the enclosing transaction(s) open. A simple implementation would roll back all outstanding transactions and discar

  1   2   3   4   5   6   7   8   9   10   >