Re: [sqlite] Does julianday work according to the manual?

2007-01-31 Thread Trey Mack
Wikipedia also disagrees with the 24. Nov of 4714 B.C. as start of julian days... http://en.wikipedia.org/wiki/Julian_day (Footnote from that page..) ^ This equals November 24, 4714 BC in the proleptic Gregorian calendar. --

Re: [sqlite] How do I know sqlite_get_table is finished

2007-02-02 Thread Trey Mack
- Original Message - From: "Guy Hachlili" <[EMAIL PROTECTED]> To: Sent: Friday, February 02, 2007 10:13 AM Subject: RE: [sqlite] How do I know sqlite_get_table is finished In any case, I've worked a bit on the function, and here's the result: Thanks alot. It's much appreciated. - T

Re: [sqlite] How do I know sqlite_get_table is finished

2007-02-02 Thread Trey Mack
The function ArrayToSheet has nil to do with SQLite and I left that out. Ah, but that's where you access the variant array. That can be tricksy. Do you always access that variant array (arr) in the range (0 To NumRecords, 0 To NumColumns - 1) where the row arr(0, *) holds the column names, and

Re: [sqlite] Triggers+callbacks = GUI?

2007-02-15 Thread Trey Mack
Wesley wrote: As an example: in an instant messenger a new text message arrives. The application puts it into the message log. The chat window automatically updates with the new text. The statistics window about total # of messages updates. Possibly other things happen. The point is I don't

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

2007-03-07 Thread Trey Mack
It looks all as it should work and it compiles with the same number of warnings, but I get a bad dll calling convention in VB with the extra integer argument iFields. You've changed the signature of the method you're calling, and it looks like you changed it correctly in the VB declaration. May

Re: [sqlite] handling empty table in a callback function to sqlite3_exec

2007-04-16 Thread Trey Mack
Hi, I'm querying a table by writing the query in sqlite3_exec with a callback function that does some operation on the resulting row. Everything is fine when the table has even one row, but when it is empty, my program halts with "segmentation fault". I can add a dummy row to the table to prevent

[sqlite] INSERT OR REPLACE without new rowid

2007-04-24 Thread Trey Mack
Hello all, I'd like to perform an update to a row if it exists (uniquely identified by 3 text columns), otherwise insert a new row with the right data. INSERT OR REPLACE looks good, but it generates a new primary key each time there is a conflict. If the row exists, I need to keep the original

Re: [sqlite] best performance

2007-05-03 Thread Trey Mack
Am I able to perform a transaction where I execute a query with a begin..insert..end and commit? Would that even be faster? Yep, that's the way to go. http://www.sqlite.org/cvstrac/wiki?p=PerformanceConsiderations See Transactions and performance ---

Re: [sqlite] 3.3.17 Source code ZIP file missing most files?

2007-05-07 Thread Trey Mack
The 3.3.17 ZIP file seems to only contain 2 source files, instead of the full SQLite source. Is this on purpose? It is the full source. See http://www.sqlite.org/cvstrac/wiki?p=TheAmalgamation and a big ol' thread at http://www.nabble.com/May-I-ask-why-the-source-distribution-mechanism-was-chang

Re: [sqlite] INSERT OR REPLACE without new rowid

2007-05-08 Thread Trey Mack
lsewhere too.. - Trey - Original Message - From: "B V, Phanisekhar" <[EMAIL PROTECTED]> To: Sent: Tuesday, May 08, 2007 10:59 AM Subject: RE: [sqlite] INSERT OR REPLACE without new rowid Hi Trey, Even I was looking for something like this. But I don't think SQL

Re: [sqlite] A suggestion

2007-05-10 Thread Trey Mack
Works for me straight out of the box on Windows XP. That program does have the capability, but may not be implemented that way on Windows. Why not make the change yourself? A.J.Millan wrote: As a suggestion, and even in the risk to abuse of Mr Hipp's patience. Would it be possible to inclu

Re: [sqlite] Inserting text string with quotes gives an error - php

2007-05-31 Thread Trey Mack
Inside string literals, escape single quotes with 2 single quotes 'test 'test' test' ==> 'test ''test'' test' When I try to insert text containg single quotes via php it gives me syntax error: ... // so query looks like: INSERT INTO version (date,active,category,entry) VALUES ('2007-05-

Re: [sqlite] sqlite function list?

2007-06-04 Thread Trey Mack
Included functions: http://www.sqlite.org/lang_expr.html See the section "Core Functions" near the bottom of the page for the builtin functions. To add more: http://www.sqlite.org/contrib extension-functions.tgz for details on adding functions like ceil. - TM - Original Message - Fr

Re: [sqlite] Why does "SELECT julianday('some_date') AS dateNumber" get me a string via ODBC?

2007-06-05 Thread Trey Mack
I see that it is a variant of type VT_BSTR containing "2345678.9123" (or whatever), and I have to use strtod() to convert it to the number I want. Is there a way to write the query to ensure that it will give me a number instead of a string? The type selection is done in your ODBC wrapper, and

Re: [sqlite] Can't update table from itself or multiple tables

2007-06-06 Thread Trey Mack
I checked not implemented features list of sqlite and found nothing about "update ... from". There's no "FROM" on http://www.sqlite.org/lang_update.html, so that's a hint that it's not supported. All the same, maybe this should be added to http://www.sqlite.org/omitted.html update table1 se

Re: [sqlite] SQL query help...

2007-06-08 Thread Trey Mack
Here's what I tried, which didn't work... select name, substr(name,1,length(name)-3) as zone, substr(name,length(name)-2,2) as location, max(thick) - min(thick) as diff from plypoint where diff > 0.0005 group by zone,location That causes a "misuse of aggregate" error. select name, substr(name,

Re: [sqlite] performance question: SELECT max(rowid) - 1

2007-06-14 Thread Trey Mack
> I have a fairly large table (10million rows) with a simple INTEGER > PRIMARY KEY AUTOINCREMENT field. > > Executing 'SELECT max(rowid) FROM MyTable' is very fast, as is > 'SELECT min(rowid) FROM MyTable'. > > However, 'SELECT max(rowid) - min(rowid) FROM MyTable' is slow > (apparently accessi

Re: [sqlite] Trigger update of multiple columns

2007-06-18 Thread Trey Mack
I want to insert the transactions data (product_id, buy, sell, desc) into the sale_products table. But I want a mechanism whereby if I enter the product_id, then the buy, sell, desc columns are auto entered (copied) from their corresponding row in the products table. Given: CREATE TABLE p

Re: [sqlite] Milliseconds

2007-07-12 Thread Trey Mack
I rather thought about retrieving and storing milliseconds in SQL. I mean, a SQL data type which is able to store milliseconds and a SQL function to return the current timestamp including milliseconds. I had no luck with CURRENT_TIMESTAMP for instance. There is no true SQLite DATE data type. It'

Re: [sqlite] UI question

2007-08-02 Thread Trey Mack
When using the command line interface sqlite3, a couple of times I have forgotten to use the "." before a command. After that I get a "...>" prompt that I can't seem to escape from and accepts no commands? My only choice is to shut down that terminal and start a new one.. There must be an e

[sqlite] Index Creation Questions

2007-08-02 Thread Trey Mack
I'm creating some indices, and want to know if it's going to help or hurt me (or be totally irrelevant because of optimization) to include the primary key at the end of the index. All of my tables (in question) have an INTEGER PRIMARY KEY AUTOINCREMENT field, and I have several textual descripto

Re: [sqlite] best way to match a date but not a time?

2007-09-02 Thread Trey Mack
I want to have queries that will match dates but not care about times. The date might be today, anything within the last week, month, year, or a range of dates. I'm using Python's datetime function, so the dates enter the database in this format 2007-09-01 12:00:02. So far, < or > queries seem t

Re: [sqlite] Openinig 1 or more connections to db

2007-09-25 Thread Trey Mack
At the moment I open 1 connection to the SQL Serv.. at the moment of login and I keep it open until the user exit the program. Can I do the same with SQLite, or do you suggest to open and close the connection every time I need it? Will I lose Performance? As I understand it, that's the way t

Re: [sqlite] Openinig 1 or more connections to db

2007-09-25 Thread Trey Mack
At the moment I open 1 connection to the SQL Serv.. at the moment of login and I keep it open until the user exit the program. Can I do the same with SQLite, or do you suggest to open and close the connection every time I need it? Will I lose Performance? As I understand it, that's the wa

Re: [sqlite] Database file size

2007-10-21 Thread Trey Mack
I add records to database tables. Then when i delete them the database do not reduce size. I add BLOB elements. Do you know what can be the problem? Thanks http://www.sqlite.org/lang_vacuum.html - To unsubscribe,

Re: [sqlite] LIKE operator syntax for white space

2007-10-23 Thread Trey Mack
How do I filter out records that contain WHITE SPACE in a field or have this field empty? For example: select * from mytable where fld <> "" and fld LIKE . Do you mean "contain ONLY white space"? Are you after this? select * from mytable where trim(fld) <> "" ---

Re: [sqlite] Resetting a Primary Key

2007-11-20 Thread Trey Mack
INSERT INTO invoice_items (item_id,invoice_id,product_id,product_name,sku,description,quantity,price,cost,taxable,taxable2,format_price,format_total_price) VALUES (NULL,899,1001975,'HD0001 - ASH - YL','','HOUSE DIVIDED',1,800,450,'f','f','$8.00','$8.00') Does this work? INSERT INTO invoice_item

Re: [sqlite] PATCH: compound query column naming and resolving (Ticket #2822)

2007-12-08 Thread Trey Mack
Can you please tell me what other databases do with this: CREATE TABLE t1(a,b,c); INSERT INTO t1 VALUES(1,2,4); SELECT a+b AS c FROM t1 WHERE c==4; SQL Server returns a 3. ORACLE 9 returns a 3. - To unsubscri

Re: [sqlite] Should the next release be 3.5.4 or 3.6.0?

2007-12-13 Thread Trey Mack
3.6.0 in the next release? Or can we call the change a "bug fix" and number the next release 3.5.4? I guess I'm in the minority, but I'd find a change in the meaning of my queries surprising in a bug fix release. That sounds like a 3.6 to me. You may be in the minority, but you're not a

Re: [sqlite] Version 3.2.2

2008-02-06 Thread Trey Mack
UPDATE listings SET buyer = 'Price' WHERE listnum = 12345 Double quotes are for column names. Walt wrote: > I have a table 'listings' with fields 'listnum', 'price' and 'buyer' etc. > > executing the following sql > > UPDATE listings SET buyer = "Price" WHERE listnum = 12345 > > results in the '

Re: [sqlite] Sorting the result of a select. Is this possible?

2008-02-07 Thread Trey Mack
Is this what you're after? create table LSOpenJobs (PSubClass); insert into lsopenjobs values ('DOC-Trans'); insert into lsopenjobs values ('DTP'); insert into lsopenjobs values ('PM'); insert into lsopenjobs values ('Post-Proc'); insert into lsopenjobs values ('Pre-Proc'); select * from lsopenjo

Re: [sqlite] Counting rows in multiple tables and joining on an index

2008-02-18 Thread Trey Mack
create table t1 (rpsIndex INTEGER); create table t2 (rpsIndex INTEGER); create table t3 (rpsIndex INTEGER); insert into t1 values (1); insert into t1 values (1); insert into t1 values (2); insert into t2 values (1); insert into t2 values (2); insert into t2 values (3); insert into t3 values (3); i

Re: [sqlite] Return row order

2008-02-25 Thread Trey Mack
You are not guaranteed any particular order unless you use ORDER BY, even between two runs of the same SQL statement. Roland Romvary wrote: > Hi! > > Can I take it for sure that the order of the rows returned by 2 queries are > the same? > The only difference between the queries is that the selec

Re: [sqlite] Concatenating values from multiple varchar fields

2008-02-26 Thread Trey Mack
Two pipes || Jason Salas wrote: > I'm new to SQLite, coming over from SQL Server. I often do string > concatenation like so: > > lastName + ', ' + firstName as [name] from myTable > > But it tries to run a math computation and returns '0.0' for each > field. I've tried some other concat opera

Re: [sqlite] DATETIME data type

2008-02-28 Thread Trey Mack
Store it in '-mm-dd' format, or use the julian date that's suggested at: http://www.sqlite.org/cvstrac/wiki?p=DateAndTimeFunctions Yong Zhao wrote: > It seems that sqlite3 does not support DATETIME data type. > > If I have the following data in table t1, how do I select people who is > older

Re: [sqlite] sqlite3 lib do not open old sqlite databases

2007-01-22 Thread Trey Mack
From http://www.sqlite.org/formatchng.html "Version 3.0.0 is a major upgrade for SQLite that incorporates support for UTF-16, BLOBs, and a more compact encoding that results in database files that are typically 25% to 50% smaller. The new file format is very different and is completely incompat

Re: [sqlite] SQLite3VB.dll

2007-01-24 Thread Trey Mack
I have just one question. What exactly does this function do: Private Declare Function sqlite3_changes _ Lib "SQLite3VB.dll" (ByVal DB_Handle As Long) As Long It looks it will always give one, unless you have just created a database and done nil with it. Is this how it is? It returns the num

Re: [sqlite] return table data without fields

2007-01-27 Thread Trey Mack
I cannot find a PRAGMA for turning column names on/off either. You may be thinking of ".headers on/off" in the SQLite shell.. I don't think there's a way to turn this off, except rewriting the code for sqlite_get_table (which, thankfully, he's provided). Maybe to include a 4th parameter that w

Re: [sqlite] Re: An SQL question (Not directly related to SQLite)

2007-01-27 Thread Trey Mack
Actually, my query is something like SELECT ... FROM ... WHERE `pid` = (SELECT `id` FROM ...); if i put that group by... will it group all rows, or only those with the same pid? Use a subquery SELECT price, sum(count) FROM ( -- your original query here SELECT price, count FROM ... WHERE `

Re: [sqlite] Getting the last row

2008-09-16 Thread Trey Mack
select * from t order by rowid desc limit 1; Thanks, Trey Mack -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Aravinda babu Sent: Wednesday, September 17, 2008 2:15 AM To: sqlite-users@sqlite.org Subject: [sqlite] Getting the last row Hi all, Is there