Re: [sqlite] last modified time or version of sqlite database

2006-04-03 Thread Kurt Welgehausen
Regards

Re: [sqlite] how to fix problem of lock

2006-04-03 Thread Kurt Welgehausen
"Cesar David Rodas Maldonado" <[EMAIL PROTECTED]> wrote: > but is posible open several DATABASE with a programm and do transaccion > without locked the table??? No. A transaction will always lock the database at some point. Regards

Re: [sqlite] Does Substr() use index?

2006-04-16 Thread Kurt Welgehausen
Paul Gaspar <[EMAIL PROTECTED]> wrote: > Hello, just a short question: Does this use the index on f > > select * from t where SUBSTR(f,1,1) = 'a' > > so that it is an alternative for > > select * from t where ( f >= 'a' and f < 'b' ) > > > Thanks a lot > > Paul No, but you can read about

Re: [sqlite] sqlite puzzle

2006-05-02 Thread Kurt Welgehausen
JP <[EMAIL PROTECTED]> wrote: > SQLite provides a way to get the N-th row given a SQL statement, with > LIMIT 1 and OFFSET . > > Can the reverse be done in an efficient way? For example, given a table > with 1million names, how can I return the row number for a particular > element? No, you c

Re: [sqlite] How do you unsubscribe?

2006-06-01 Thread Kurt Welgehausen
Richard Battagline <[EMAIL PROTECTED]> wrote: > How do you unsubscribe? Read the headers of any message from the group.

Re: [sqlite] Binary compatibility

2006-06-01 Thread Kurt Welgehausen
Nikki Locke <[EMAIL PROTECTED]> wrote: > > Given that I am using SQLite.Net, if I execute this pragma as the first > command > passed over the connection, before creating any tables, will it work? Or do I > really have to execute it "before creating the database"? I think you're confusing creatin

Re: [sqlite] Query performance issues - index selection

2006-06-01 Thread Kurt Welgehausen
Steve Green <[EMAIL PROTECTED]> wrote: > CREATE UNIQUE INDEX pk_data on data( utime, r_id, u_id ); > ... > CREATE INDEX ix_data_ut on data( u_id, utime ); Wouldn't a unique index on (u_id, utime, r_id) get you the pk constraint and better performance on your query with no other index to confuse t

Re: [sqlite] sqlite too slow for me?

2006-06-16 Thread Kurt Welgehausen
"P?ter Szab?" <[EMAIL PROTECTED]> wrote: > Dear SQLite Developers, > > I am seeking help for optimizing my SQLite SQL query, which seems to > be running unreasonably slow. The query is: > > SELECT col2 FROM t WHERE col1='foobar' AND > col4='foobarfoobarfoobarfoob'; > > My schema is the follo

Re: [sqlite] Avoiding duplicate record insertion

2006-06-18 Thread Kurt Welgehausen
[EMAIL PROTECTED] wrote: > I have a related question. Suppose I have a table containing rows each with > values and a counter. If the new row is unique in the table it should be > INSERTed and the counter set to 1; otherwise the counter for the matching > row should be incremented. It's a classi

Re: [sqlite] "NOT IN (Select..)" vs "EXCEPT Select"

2006-06-18 Thread Kurt Welgehausen
"Alexey Petrovsky" <[EMAIL PROTECTED]> wrote: > select e164 from lcr15 except select e164 from lcr16 order by ... > > select e164 from lcr15 where e164 not in (select e164 from lcr16) ... > > ... > I thought that those queries provide the same result. > ... > Any guess? > > Alexey. It's not neces

Re: [sqlite] Functions embedded in SQL statements

2006-06-18 Thread Kurt Welgehausen
Bud Beacham <[EMAIL PROTECTED]> wrote: > I have the book SQLite by Chris Newman and it has examples of > functions embedded within SQL statements. > > For example on page 38 the ifnull() function is used. > > SELECT code, ifnull(due_date, 'Ongoing') FROM projects; > > Also, on page 81 the strftime

Re: [sqlite] Improving insert speed?

2006-06-24 Thread Kurt Welgehausen
> ... should I be using commit before end ... Commit and end are synonyms; you don't need both. > ... this is single user, I assume using immediate or exclusive is ok ... It's OK but not necessary. A simple begin is just as good, since no one else can apply a lock before yours is upgraded. Reg

Re: [sqlite] How to get column description from table using SQL

2006-06-28 Thread Kurt Welgehausen
blins <[EMAIL PROTECTED]> wrote: > How to get column description from table using SQL pragma table_info() Regards

Re: [sqlite] Problem with WHEN expressions inside CASE statement in SELECT statement

2006-06-30 Thread Kurt Welgehausen
Robert Duff <[EMAIL PROTECTED]> wrote: > I had a problem with inserting bad unicode characters into my database. > ... > Returned by "SELECT locationsFK,variable,logindex, CASE units WHEN units > ISNULL THEN '#!#!#!#!#!#!#!#!#!#!' WHEN units = '??F' THEN > '' WHEN units != '

Re: [sqlite] Re: Multiple SELECTs (and single SELECT) and TRANSACTION ?

2006-08-08 Thread Kurt Welgehausen
"Igor Tandetnik" <[EMAIL PROTECTED]> wrote: > RohitPatel > wrote: > > Scenario 1 > > If action of some user needs to execute multiple SELECT statements > > (read-only, no plan to write), it needs to start explicit transaction > > to get consistent reads across read-only multiple statements. >

Re: [sqlite] Seems like a bug in the parser

2006-08-23 Thread Kurt Welgehausen
> select a from qqq group by b; This question was discussed on the list a year or 2 ago. The column a in the simple query above is meaningless; it's an arbitrary value from each group. There are queries, however, where a non-grouped column is meaningful, such as a join where the grouping column

Re: [sqlite] duplicate primary key

2006-08-25 Thread Kurt Welgehausen
Mario Frasca <[EMAIL PROTECTED]> wrote: > this is a bit surprising; where does the autoincrement-like > behaviour come from? without an explicit autoincrement > definition, I would expect ... > what is going on here? I'm having three records with t

Re: [sqlite] Performance Question

2006-08-28 Thread Kurt Welgehausen
[EMAIL PROTECTED] wrote: > Saying NOT NULL on a PRIMARY KEY is redundant, by the way. > -- > D. Richard Hipp <[EMAIL PROTECTED]> **kaw<~/tdpsa>$ sqlite3 Loading resources from /home/kaw/.sqliterc SQLite version 3.3.7 Enter ".help" for instructions sqlite> .nullvalue '<>' sqlite> create table t

Re: [sqlite] Row count after prepare

2005-03-15 Thread Kurt Welgehausen
> ... guess I will have to use sqlite3_get_table in this case Be aware that sqlite3_get_table is no longer a recommended API and may not do everything you want. See Regards

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread Kurt Welgehausen
> strftime doesn't support the ISO-8601 format ... I does if you give it the correct format string. Regards

Re: [sqlite] Is this possible in SQLite?

2005-03-17 Thread Kurt Welgehausen
> Is there a way to do the following: > > INSERT INTO acopy SELECT * FROM a WHERE id = 1 ( SET id = some value X ); > INSERT INTO bcopy SELECT * FROM b WHERE id = 1 ( SET id = X ); http://www.sqlite.org/lang_insert.html sql-statement ::= INSERT [OR conflict-algorithm] INTO [dat

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread Kurt Welgehausen
> Yes, I know it supports it without the "T" ... sqlite> select strftime("%Y-%m-%dT%H:%M:%S", 'now', 'localtime'); strftime("%Y-%m-%dT%H:%M:%S", 'now', 'localtime') - 2005-03-17T16:21:30

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread Kurt Welgehausen
Sorry, I misunderstood the context. sqlite> select * from datetest; k d -- --- 1 2005-03-17T16:21:30 sqlite> select strftime("%m", substr(d,1,10)||' '||substr(d,-8,8)) ...> from datetest; strftime("%m", substr(d,1,10)

Re: [sqlite] Should Unary + Cast to a Number?

2005-03-17 Thread Kurt Welgehausen
> Well, I might as well use the substr() function, then ... Yes, unless you think %m is more expressive than 6,2 or you want to extract more than one component. sqlite> select * from datetest; k d -- --- 1 2005-03-17T16:21:30 2

Re: [sqlite] How do I Register on sqlite.org

2005-03-18 Thread Kurt Welgehausen
You can record the ticket number when you originate the ticket and check the status any time with . Or, just bookmark the url after you submit the ticket. Or, you can scan (search) the timeline for the ticket number to see what action has been taken.

Re: [sqlite] NULL representation/empty value in query results?

2005-03-23 Thread Kurt Welgehausen
> Is there a way to change the NULL representation ... ? No. Tcl has no null value. Usually this is not a problem, but if you really need to distinguish between a missing value and an empty string, you can use default values. sqlite> create table deftest (k integer primary key, ...>

Re: [sqlite] NULL representation/empty value in query results?

2005-03-23 Thread Kurt Welgehausen
> Yeah! I've missed the default option. But is this SQL standard? Yes. > sqlite> insert into deftest (i, s) values (NULL,''); This inserts NULL (not a string) into i and '' into s. When you retrieve that row using tcl, both are represented by empty strings. Default values replace missing values

Re: [sqlite] getting table column names and types programaticly

2005-03-24 Thread Kurt Welgehausen
> Anyone know how I can query the field names and types for a given table? pragma table_info(tablename)

Re: [sqlite] about ROWID after vacuum

2005-03-31 Thread Kurt Welgehausen
> Is it a bug? ... No, it's not a bug. Regards

Re: [sqlite] About field sizes...

2005-04-04 Thread Kurt Welgehausen
> What effect has dimension on field size? ... See and . The dimension(s) has no effect on the actual storage. > And why is it valid when you mention "date" ... ? The type in a create statement serves only to determine

Re: [sqlite] how to get the INTEGER PRIMARY KEY for the row just inserted?

2005-04-05 Thread Kurt Welgehausen
> begin immediate; insert; select max(id) from blah; commit; Or "select last_insert_rowid() from blah limit 1" Regards

Re: [sqlite] malformed 2.1 db

2005-04-08 Thread Kurt Welgehausen
> Unable to open database 1.db > now what? any suggestions? There's probably nothing you can do to fix the file. In the past, you could corrupt a database by vacuuming it in one process and then doing an insert in another process. This has been fixed in V3; I don't know if the bug even existed in

Re: [sqlite] multi threading

2005-04-17 Thread Kurt Welgehausen
> SELECT id, code FROM a WHERE > (code IN > (SELECT code FROM > (SELECT code, COUNT(code) AS c FROM a GROUP BY code) AS aaa > WHERE c > 1) > ) >and ORDER BY code The "and" in your code is illegal, but it is better to use select id, code from a where

Re: [sqlite] Correlated Subqueries not working for me

2005-04-19 Thread Kurt Welgehausen
You don't need a correlated subquery: sqlite> select * from tbl; c1 c2 -- -- 1 a 1 a 1 b 1 a 2 b 2 c 2 a 3 c 3

Re: [sqlite] NFS Query Performance

2005-04-19 Thread Kurt Welgehausen
SQLite is not a client-server database. In the worst case, when you query a database file over NFS, all the tables in your query are sent over the network to be processed on your cpu; so if you want to select one row from a table of a million rows, the million rows are retrieved over the network (i

Re: [sqlite] strftime and the %f option

2005-04-23 Thread Kurt Welgehausen
> ... %f option to strftime ... retu[r]ns '000' ... Is that always true, or just when the date is 'now'? I suspect that 'now' is producing an integer. sqlite> select strftime('%f', 'now'); strftime('%f', 'now') - 52.000 sqlite> select strftime('%f', 'now'); strf

Re: [sqlite] OT: Suitable table schema for object relationship

2005-04-25 Thread Kurt Welgehausen
> A --> B --> C > \ >\--> D --> E You've drawn a tree, but your comments indicate that you want something more general. If you can restrict yourself to trees, you can probably use nested sets (invented by Joe Celko). These are fairly simple to manipulate. A Google search will turn u

Re: [sqlite] Windows question

2005-04-27 Thread Kurt Welgehausen
> Am I right ... sqlite-3_2_1.zip ? Yes, and get the same version of the dll, with or without tcl bindings, if you're going to write programs. Regards

Re: [sqlite] Is threading enabled?

2005-05-06 Thread Kurt Welgehausen
> How can i find out ... whether threading is enabled ... ? grep -in thread Makefile Regards

Re: [sqlite] alter table rename column

2005-05-07 Thread Kurt Welgehausen
> something like this: > >"SQLite's version of the ALTER TABLE command allows the user to >rename _a table,_ or add a new column to an existing table." Or, SQLite's version of the ALTER TABLE command allows the user to rename, or add a new column to, an existing table. (commas added for em

Re: [sqlite] newbie question re indexes

2005-05-11 Thread Kurt Welgehausen
> are indexes used when doing range searches on integer columns? Yes, your simple example will use the index, but it has nothing to do with the data being integers. You can read all about indices at http://www.sqlite.org/php2004/page-041.html and following pages. You can see whether a query

Re: [sqlite] nested functions in select

2005-05-13 Thread Kurt Welgehausen
> ... select count(distinct(something)) ... http://www.sqlite.org/omitted.html BTW, distinct is not a function. Regards

Re: [sqlite] unit tests

2005-05-22 Thread Kurt Welgehausen
> How do I run the unit tests in Linux? make test

Re: [sqlite] Date Comparison

2005-05-24 Thread Kurt Welgehausen
> Already did. > It doesn't talk about date comparison. Dates are stored in SQLite as strings or numbers (your choice). Comparisons of dates are just comparisons of strings or numbers. There is no Date type. Regards

Re: [sqlite] philosophy behind public domain?

2005-05-25 Thread Kurt Welgehausen
> > > I think the gist was that the software couldn't have a disclaimer > > > of liability if it is public domain, and so anyone could sue the > > > author if something went wrong when using it. I don't know how > > > true this is or not, but would like to see it addressed in the answer. > >

Re: [sqlite] Changing default PRAGMA SYNCHRONOUS at compile time

2005-06-01 Thread Kurt Welgehausen
> While I can send 'set pragma synchronous=normal' at every write ... You don't have to execute the pragma for every write. Once you've set synchronous=normal, it stays normal until you close and reopen the database. Regards

Re: [sqlite] Changing default PRAGMA SYNCHRONOUS at compile time

2005-06-01 Thread Kurt Welgehausen
The docs have not caught up with the code. As you guessed, the default for synchronous used to be normal, but it has been changed to full. If you want normal, all you have to do is execute the synchronous pragma after you open the db. As another fellow pointed out, there was an unintended interact

Re: [sqlite] Re: 'int n' parameter in sqlite3_bind_*() functions

2005-06-04 Thread Kurt Welgehausen

Re: [sqlite] Parsing bug with sqlite3.exe ?

2005-06-22 Thread Kurt Welgehausen
The problem seems to be that sqlite is not recognizing as a comment terminator (unless the comment is alone on a line). I think you should write a bug ticket; meanwhile, the work-around is to end your comment with a semicolon. sqlite> select * from t1; -- comment ...> ...> ; a c

Re: [sqlite] how to use the LIMIT and OFFSET?

2005-07-02 Thread Kurt Welgehausen
You should use SQL to get the data you want, then use your host language to display the data. Those are 2 separate operations, and you'll be better off not mixing them. If you're going to let your users go backward, you're going to have to cache the data anyway. Regards

Re: [sqlite] Does SQLite have a fulltext search like MySQL?

2005-07-05 Thread Kurt Welgehausen
> From: Stephen Leaf <[EMAIL PROTECTED]> > Organization: SMiLeaf > To: sqlite-users@sqlite.org > Date: Tue, 5 Jul 2005 18:06:39 -0500 > Subject: Re: [sqlite] Does SQLite have a fulltext search like MySQL? > > On Tuesday 05 July 2005 04:48 pm, Michael Grice wrote: > > If not, are there plans to add

Re: [sqlite] Saving "Unsigned Long"s in database

2005-07-12 Thread Kurt Welgehausen
> SELECT avg(length(domain)) from domains; > > The response is 10 and not 4. >From : length(X) Return the string length of X in characters. If SQLite is configured to support UTF-8, then the number of UTF-8 characters is re

Re: [sqlite] Calculation between rows?

2005-07-18 Thread Kurt Welgehausen
> I suppose I could copy the data table into a temporary > table ... documenataion quarantees AUTOINCREMENT fields > to be "monotonically increasing" ... "Monotonically increasing" does not mean that for every key k there will be a key (k-1). In fact, if you ever delete a row in an autoincrement t

Re: [sqlite] Limit how much data to read

2005-07-25 Thread Kurt Welgehausen
> Where in the documentation that explains how to use the sqlite substr() > function? Go to the SQLite Syntax page, and click on 'expression'.

Re: [sqlite] SQLite 3.2 install on Mac OS X

2005-07-26 Thread Kurt Welgehausen
cd /usr/bin ln -s tclsh8.4.4 tclsh will probably do it for you, or to cover all the bases, cd /usr/bin ln -s tclsh8.4.4 tclsh8.4 ln -s tclsh8.4 tclsh Regards

Re: [sqlite] SQLite 3.2 install on Mac OS X

2005-07-27 Thread Kurt Welgehausen
It looks like libtclsqlite3.dylib either didn't get made or is in the wrong place. You can search your disk to see whether it got made. There's a switch in the Makefile that determines whether it gets made or not. OS X has been discussed several times on this list. You might try searching the arch

Re: [sqlite] ALTER TABLE: Confusing documentation

2005-07-27 Thread Kurt Welgehausen
The docs are correct; you just have to read carefully. They say that you can "rename, or add a new column to, an existing table". Regards

Re: [sqlite] ALTER TABLE: Confusing documentation

2005-07-27 Thread Kurt Welgehausen
> From: Tito Ciuro <[EMAIL PROTECTED]> > Date: Wed, 27 Jul 2005 13:10:45 -0400 > To: sqlite-users@sqlite.org > Subject: Re: [sqlite] ALTER TABLE: Confusing documentation > > On 27/07/2005, at 13:04, Kurt Welgehausen wrote: > > > The docs are correct; you just h

Re: [sqlite] quoting

2005-07-31 Thread Kurt Welgehausen
> How do I quote a null byte? There is no way to quote a null byte in SQL. If you're trying to pass a string with a literal null byte in it to a perl function, it may be that underlying C code is failing because it expects a null-terminated string; in that case, substituting "\000" for the null b

Re: [sqlite] Data/time storing?

2005-08-01 Thread Kurt Welgehausen
> ... gave me enough fodder to waste a bit more time ... FWIW, the SQLite date/time functions were designed so that dates could be stored as astronomical julian-day numbers (floating point). That's the only form that gives millisec precision, but some other form may be more convenient for a partic

Re: [sqlite] how to get notice when database is free after it was busy

2005-08-05 Thread Kurt Welgehausen
> So, you can use something like this: > > if { ! [catch {set selectResult [eval db "select x from y where z = > 'blah'"]} catchErr] } { > puts "Failed - the error is $catchErr" > } else { > puts "selectResult= $selectResult" > } > Except that you've got the if/else clauses reversed (or just r

Re: [sqlite] RFC Beginning digit in column name

2005-08-09 Thread Kurt Welgehausen
> Does MySQL allows [0_xy] to specify column names? > > If I remember correctly, that is the standard SQL way to have columns > with spaces in the middle, and sqlite allows columns starting with a > digit in this way... It's not standard; it's a Microsoft extension. Regards

Re: [sqlite] Finding max of each group?

2005-08-10 Thread Kurt Welgehausen
> select conversation_id, count(*), max(unread), max(updated_on) > from messages > where conversation_id in () > group by conversation_id; > > I use max(updated_on) to get the date of the most recent message in > the conversation. Is there a way to return the ID of this message? Assuming that the

Re: [sqlite] possible documentation error

2005-08-10 Thread Kurt Welgehausen
AS is always optional, i.e., in table names and in column names. Regards

Re: [sqlite] Index and General Optimization Question

2005-08-12 Thread Kurt Welgehausen
Currently, indices are not used to look up either term in an OR expression. See . You could build 2 separate 5-column indices and use a union. Regards

Re: [sqlite] How to update wiki? date/time page misprint

2005-08-16 Thread Kurt Welgehausen
> strftime ... for the %j format ... should specify > 001-366 instead of 000-366 You're correct. You should be able to edit the page by clicking on Edit just below the main heading. Regards

Re: [sqlite] manipulating new.? in triggers

2005-08-18 Thread Kurt Welgehausen
> Is it possible to change the values of certain rows that > are inserted into the database? ... I think everything you need is explained at . If you don't understand how to get the current date in SQLite, look at the wiki page. Regards

Re: [sqlite] modifying insert/updat data in triggers (was: manipulating new.? in triggers)

2005-08-18 Thread Kurt Welgehausen
> create trigger r1 after insert on foo begin > update foo set date_create=current_timestamp where rowid=new.rowid; > end; > create trigger r2 after update on foo begin > update foo set date_lch=current_timestamp where rowid=new.rowid; > end; > > -- > D. Richard Hipp <[EMAIL PROTECTED]> > cre

Re: [sqlite] blocking - busy_timeout vs database is locked(5)

2005-08-19 Thread Kurt Welgehausen
> Using ... Tcl ... how do I even obtain the value ... man n catch > If I use db timeout 2000 ... SQLite will retry for 2 seconds, then if the db is still locked, it should return an error code. Any SQLite command that can fail should be run within a catch command. Regards

Re: [sqlite] SQL for finding non-matching rows

2005-08-19 Thread Kurt Welgehausen
> select a from t1 where a not in (select b from t2) select a from t1 except select b from t2 or (SQLite v3 only) select a from t1 where not exists (select b from t2 where b = a) Which of these is fastest will probably depend on table size and indexing; you'll have to try them out.

Re: [sqlite] malformed database schema - near "AUTOINCREMENT": syntax error

2005-08-23 Thread Kurt Welgehausen
> "malformed database schema - near "AUTOINCREMENT": syntax error" It might help if you published your schema. Also, it would be interesting to know whether your v3.2.3 passed all the tests in the test suite. Regards

Re: [sqlite] "where not exists (union-select)" fails on 2nd where

2005-08-23 Thread Kurt Welgehausen
> SELECT * FROM PRIM AS P > WHERE NOT EXISTS > ( > SELECT REFID FROM REF1 WHERE REF1.REFID=P.ID > UNION > SELECT REFID FROM REF2 WHERE REF2.REFID=P.ID > ); I looks like correct SQL according to the SQLite docs, but I don't understand why you coded the select that way. You should get the same resul

Re: [sqlite] unixepoch seconds issue?

2005-08-31 Thread Kurt Welgehausen
> 2005-08-30 15:19:00 > 2005-08-30 08:19:00 Your time zone is -7. Read the SQLite docs to see how to convert between local time and UTC (they're in the wiki). Regards

Re: [sqlite] Null values in Primary Key

2005-09-05 Thread Kurt Welgehausen
> I tried to see what MS SQL would do but it does not allow creation of the > tables primary key with any NULL segments. This is the correct behavior; I thought SQLite enforced that. You can duplicate the correct behavior by adding to the spec for each PK column. > Does that mean I need to do my

Re: [sqlite] how to check the file is a sqlite database file?

2005-09-05 Thread Kurt Welgehausen
Read the first 31 bytes of the file (or the first 15 bytes in V3). Regards

Re: [sqlite] All transactions are Database locks?

2005-09-07 Thread Kurt Welgehausen
> Are all transactions database locks (not table locks)? Yes. > If I prepare a select statement and start stepping on Table A on process one > and pause before finializing and do an update on Table B with process two or > even the same process I will get a database is locked error? Yes. > Does

Re: [sqlite] any plans for out-of-row blobs?

2005-09-13 Thread Kurt Welgehausen
> There is no way to retrieve part of a > blob value in SQLite. > > From my understanding, most databases store > blob values separate from the rest of the row. The common way to handle this in SQLite is to store the blob in a file and store the file name in the db. Regards

Re: [sqlite] How to load a SQLite schema from file using SQLite C-API

2005-09-16 Thread Kurt Welgehausen
>I have SQLite schema in an ascii file. I would like to be able to load >this schema via SQLite C-API. How do I do this? You can look at the source code for the SQLite shell and see how it implements the .read command, but it may be simpler just to invoke the SQLite shell using system() or exec().

Re: [sqlite] sqlite on embedded board

2005-09-16 Thread Kurt Welgehausen
I can't tell what you've been doing, but probably what you need to do is something like 1. Do all your work in the memory db, without touching the flash db. 2. Then, just before you detach, update the flash db with insert [or replace] into flash.db ... select ... from memor

Re: [sqlite] INSERTing a row only if it doesn't EXIST

2005-09-17 Thread Kurt Welgehausen
If id in your example identifies a row, then by definition it is unique (probably the primary key). If you try to insert another row with the same id, the insert will fail. Why not just catch the exception or error code? Regards

Re: [sqlite] index organized table +compression

2005-09-18 Thread Kurt Welgehausen
> Does anybody know whether it is possible to compress ... I don't recall anyone having claimed to have done this. You can try searching the archives: > ... possible to create index organized tables within SQLite Not really. If you create

Re: [sqlite] help with GROUP BY

2005-09-19 Thread Kurt Welgehausen
> I want the title, the MAX(speed) for each title group, and the date > that occurred. In case, ... I haven't tried this, but I think it's correct. Let me know if it's not. select distinct table.title, table.date, t2.maxsp from table, (select title ttl, max(speed) maxsp from table gro

Re: [sqlite] "Data Dictionary" in SQLite?

2005-09-21 Thread Kurt Welgehausen
pragma table_info (and others). Look at the pragma docs. Regards

Re: [sqlite] Easyer way ?

2005-09-24 Thread Kurt Welgehausen
I believe more than one subscriber to this list have written utilities to manage SQLite databases. I've never used one, but I expect they have GUIs that will allow you to enter and insert data. A Google search will probably turn up something. Regards

Re: [sqlite] locking problem (on insert inside callback)

2005-10-14 Thread Kurt Welgehausen
> SELECT * FROM table1 LEFT JOIN table2 on table1.field=table2.field > WHERE table2.field is NULL > > So far, so good, I get the records I want. Then in the callback, I try > > INSERT INTO table1 etc... I'm not sure I understand your logic. Your left join indicates that there are records missing f

Re: AW: [sqlite] and , or

2005-10-18 Thread Kurt Welgehausen
> Hi Henri, > > On 18.10.2005, at 14:56, Eggert, Henri wrote: > > > I have found that the problem is the column name "Text". > > If I replace the column name "Text" by another all works fine. > > So I wonder : is "Text" a keyword for sqlite ? > > > > It indeed is [1]. :) > > > -Markus > > [1] http:

Re: [sqlite] How to determine if a column is autoincremented?

2005-10-22 Thread Kurt Welgehausen
select sql from sqlite_master where type='table' and tbl_name='my_table' and sql like '%autoincrement%' OR select sql like '%autoincrement%' from (select sql from sqlite_master where type='table' and tbl_name='my_table') Regards

Re: [sqlite] .import null values

2005-10-22 Thread Kurt Welgehausen
If you want all the empty fields to be null, why not just set them, with a single sql statement (per affected column), after the import? Regards

Re: [sqlite] sqlite on SunOS 5.6 (Solaris Sparc 6)

2005-10-25 Thread Kurt Welgehausen
This looks like a problem that has come up several times before on the list. If I remember correctly, it's usually that the awk shipped by Sun doesn't support the extended syntax that Sqlite expects. Try installing gawk if it's not there already, and do whatever is required to use it in place of a

Re: [sqlite] .import null values

2005-10-25 Thread Kurt Welgehausen
> "even numeric data" is imported as text Column types in Sqlite are not strictly enforced. If you import data that 'look' numeric from your text file into a column with a numeric type, the data will be stored in a numeric format; if a particular value cannot be converted to a numeric format, it w

Re: [sqlite] Are DELETE TRIGGERS recursive or not?

2005-10-25 Thread Kurt Welgehausen
If the trigger were recursive, it would invoke itself forever, even if it's not doing anything because the where clause fails. Regards

Re: [sqlite] sqlite on SunOS 5.6 (Solaris Sparc 6)

2005-10-25 Thread Kurt Welgehausen
> Can anyone guide me to where "fdatasync" should be? (maybe) Regards

Re: [sqlite] Is this query optimized?

2005-10-25 Thread Kurt Welgehausen
count() has always done a full table scan. As far as I know, nothing has been done to optimize it, as your observations seem to confirm. Regards

Re: [sqlite] .import null values

2005-10-25 Thread Kurt Welgehausen
> Affinity Modes ... how do you activate these? I don't believe strict affinity has been implemented; someone correct me if that's not right. Regards

Re: [sqlite] Unsupported SQL feature

2005-11-06 Thread Kurt Welgehausen
> What are these constructs suppose to do? x all (select y from t where ...) is equivalent to not exists (select y from t where not (x y) and ...) Any and some are synonyms. x any (select y from t where ...) is equivalent to exists (select y from t where x y and ...) Any can be

Re: [sqlite] Re: Calculating the mode

2005-11-21 Thread Kurt Welgehausen
> select salary, count(*) occurs from payroll > group by salary having occurs = > (select count(*) c from payroll group by salary >order by c desc limit) OR select salary, count(*) from payroll group by salary having count(*) = (select max(cnt) from (select count(*) cnt f

Re: [sqlite] Re: - [sqlite] can anyone reproduce ticket# 1540 (failure to create a primary key)?

2005-11-29 Thread Kurt Welgehausen
> ... and then query the sqlite_master for the > names of other indexes ... Or use PRAGMA index_list(table-name) and PRAGMA index_info(index-name) Regards

Re: [sqlite] Odd query optimization

2005-12-02 Thread Kurt Welgehausen
> Anyone have any thoughts ... ? You've already figured it out. For more info, see . Regards

Re: [sqlite] specifying field type, any benefit?

2006-01-04 Thread Kurt Welgehausen
http://www.sqlite.org/datatype3.html

Re: [sqlite] enum in SQLite

2006-01-05 Thread Kurt Welgehausen
> SQLite doesn't support enums natively. You could emulate it using > triggers, although it would be somewhat hidden and definitely a pain in > the tucus to use. It's not really so hard. create table MainTbl ( ... EnumCol SomeType references EnumVals, ...); create table EnumVals (val SomeT

  1   2   3   >