Re: [sqlite] Can't get MAX value from table

2008-07-02 Thread qinligeng
MAX( ColumnName )>No column name

- Original Message - 
From: "Bob Dennis" <[EMAIL PROTECTED]>
To: "SQLite user gorup" 
Sent: Wednesday, July 02, 2008 4:01 PM
Subject: [sqlite] Can't get MAX value from table


> 
> Hi, I am fairly new to SQLite, and using it to replace Microsoft db in
> PocketPC applications.
> 
> I am having trouble getting a MAX value from a table as follows:-
> 
> SQL = SELECT MAX( ColumnName ) FROM  TableName
> 
> Set Recs = db.Execute(sql) 
> 
> Result = recs(1)(ColumnName) 
> 
> I get nothing in the Result value.
> 
> I have tried putting an index on the column but it made no difference.
> 
> Any ideas would be greatly appreciated
> 
> Thanks
> 
> Bob Dennis
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Help!!! sqlite 3.5.8 crash: access violation

2008-05-16 Thread qinligeng
The attachment size limitation of the bug report is 100k :(
- Original Message - 
From: "Dennis Cote" <[EMAIL PROTECTED]>
To: "General Discussion of SQLite Database" 
Sent: Thursday, May 15, 2008 9:49 PM
Subject: Re: [sqlite] Help!!! sqlite 3.5.8 crash: access violation


> [EMAIL PROTECTED] wrote:
>> 
>> My DB file is too big, how can I provide it to your guys?
> 
> You said a compressed copy of the database file is 18M.
> 
> One possibility is to create a bug report ticket at 
> http://www.sqlite.org/cvstrac/captcha?nxp=/cvstrac/tktnew and attach the 
> compressed database file to the bug report. Then it would be available 
> to anyone who needs to look at it. I don't think there is a limitation 
> on the size of an attached file, but I could be wrong.
> 
>> Even the DB is damaged, sqlite should return an fault result instead of 
>> crashing, shouldn't it?
>> 
> 
> You are correct, it should not crash. That's why it is important to get 
> a copy of the database that is causing the problem so that it can be 
> used to find the bug.
> 
> Dennis Cote
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Help!!! sqlite 3.5.8 crash: access violation

2008-05-15 Thread qinligeng
The sqlite3_analyzer-3_5_4 also crash when analyzing my DB:
AppName: sqlite3_analyzer.exe  AppVer: 0.0.0.0  ModName: sqlite3_analyzer.exe
ModVer: 0.0.0.0  Offset: 00028c72

sqlite3 (3.5.9) crash when excute "PRAGMA integrity_check":
AppName: sqlite3.exe  AppVer: 0.0.0.0  ModName: sqlite3.exe
ModVer: 0.0.0.0  Offset: d17e

My DB file is too big, how can I provide it to your guys?
Even the DB is damaged, sqlite should return an fault result instead of 
crashing, shouldn't it?

- Original Message - 
From: "Teg" <[EMAIL PROTECTED]>
To: "General Discussion of SQLite Database" <sqlite-users@sqlite.org>
Sent: Wednesday, May 14, 2008 10:17 PM
Subject: Re: [sqlite] Help!!! sqlite 3.5.8 crash: access violation


> Hello qinligeng,
> 
> Wednesday, May 14, 2008, 12:58:32 AM, you wrote:
> 
> q1c> When I execute sql statement "delete from Carimages where OpTime
> q1c> <'2008-05-01 00:00:00'"  in my database, sqlite3 crashed.
> q1c> The Exception Information reported by XP is:
> q1c> Code: 0xc005   Flags:0x  
> q1c> Record: 0x   Address: 0x00406652
> 
> q1c> The sqlite3.exe is downloaded from
> q1c> http://www.sqlite.org/sqlite-3_5_8.zip
> q1c> The database file is to big ( about 600M, after compressed by
> q1c> WinRAR, the size is 18M), so I can't upload here.
> q1c> ___
> q1c> sqlite-users mailing list
> q1c> sqlite-users@sqlite.org
> q1c> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> I have a smallish DB that will do that here. It's interesting, the
> commandline tool Sqlite3.exe simply reports it's damaged. The
> statically linked version I use in my program will crash my program. I
> traced it down to "sqlite_step" but, no further.
> 
> I'd try an integrity check on your DB. Mine's definitely damaged.
> 
> 
> 
> -- 
> Best regards,
> Tegmailto:[EMAIL PROTECTED]
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Help!!! sqlite 3.5.8 crash: access violation

2008-05-14 Thread qinligeng
I am sorry that I can not provide any sample records of the table because every 
time I acces the table sqlite will crash.

exceute sql: select * from carimages limit 0,1;
OK!
exceute sql: select * from carimages limit 1,1;
OK!
exceute sql: select * from carimages limit 2,1;
CRASH!!

Maybe the database has been damaged.

The shcema of table "CarImages" is :
CREATE TABLE CarImages(
 CarID char(32) NOT NULL,
 CarNumber char(20) NULL,
 OpTime datetime NOT NULL ,
 TSCode char(6) NOT NULL,
 LaneNum int NOT NULL,
 PicBigPlate Long null,
 PicSmallPlate Long null,
 PicBlackWhitePlate Long null,
 PicLane Long null,
 Constraint CarImages_Key Primary Key (CarID)
);


- Original Message - 
From: "Dennis Cote" <[EMAIL PROTECTED]>
To: "General Discussion of SQLite Database" 
Sent: Wednesday, May 14, 2008 9:50 PM
Subject: Re: [sqlite] Help!!! sqlite 3.5.8 crash: access violation


> [EMAIL PROTECTED] wrote:
>> When I execute sql statement "delete from Carimages where OpTime 
>> <'2008-05-01 00:00:00'"  in my database, sqlite3 crashed.
>> The Exception Information reported by XP is:
>> Code: 0xc005   Flags:0x  
>> Record: 0x   Address: 0x00406652
>> 
>> The sqlite3.exe is downloaded from http://www.sqlite.org/sqlite-3_5_8.zip
>> The database file is to big ( about 600M, after compressed by WinRAR, the 
>> size is 18M), so I can't upload here.
> 
> Please don't hijack other threads. 
> http://en.wikipedia.org/wiki/Thread_hijacking
> 
> What is the schema of Carimages table? Can you provide a couple of 
> sample records instead of the entire database?
> 
> Dennis Cote
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Help!!! sqlite 3.5.8 crash: access violation

2008-05-13 Thread qinligeng
When I execute sql statement "delete from Carimages where OpTime <'2008-05-01 
00:00:00'"  in my database, sqlite3 crashed.
The Exception Information reported by XP is:
Code: 0xc005   Flags:0x  
Record: 0x   Address: 0x00406652

The sqlite3.exe is downloaded from http://www.sqlite.org/sqlite-3_5_8.zip
The database file is to big ( about 600M, after compressed by WinRAR, the size 
is 18M), so I can't upload here.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to change SQLite column definition

2007-05-29 Thread qinligeng
Thanks! But it will take a long time if the table have a large number of rows.
I hope that SQLite will support "Alter Column" in next version!

- Original Message - 
From: "Scott Hess" <[EMAIL PROTECTED]>
To: 
Sent: Monday, May 28, 2007 10:38 PM
Subject: Re: [sqlite] how to change SQLite column definition


> In case it wasn't obvious, the "more complicated way" would probably
> be something like:
> 
> BEGIN;
> ALTER TABLE RENAME MyTable TO MyTableOld;
> CREATE TABLE MyTable (
>  SameColumn INTEGER,
>  NewColumn TEXT
> );
> INSERT INTO MyTable SELECT SameColumn, OldColumn FROM MyTableOld;
> DROP TABLE MyTableOld;
> COMMIT;
> 
> As prose: Within a transaction, create the new table, populate it from
> the old table, and rename it into place.
> 
> -scott
> 
> 
> On 5/28/07, Dennis Povshedny <[EMAIL PROTECTED]> wrote:
>> AFAIK SQLite does not have such functionality.
>>
>> Please see http://sqlite.org/lang_altertable.html . So you have to do it
>> in a bit more complicated way.
>>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Sent: Monday, May 28, 2007 10:50 AM
>> To: sqlite-users@sqlite.org
>> Subject: [sqlite] how to change SQLite column definition
>>
>>
>> Is there any simple way to change the definition of a column in sqlite
>> database? we can do this in sqlserver using a sql statement like this:
>> alter table  alter column 
> 
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
> 
>

[sqlite] how to change SQLite column definition

2007-05-28 Thread qinligeng
Is there any simple way to change the definition of a column in sqlite database?
we can do this in sqlserver using a sql statement like this:
 alter table  alter column 

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

2007-03-28 Thread qinligeng
Hi,
I want to check the record count of a table every 5 seconds.
It seems there's only one way to get a table's record count:
select coun(*) from ATable

but if the table gets big(1,000,000 rows), it will get slow.
Any good idea?

Re: [sqlite] data type problem

2007-03-22 Thread qinligeng
Thanks for you all.
I don't know if [char](32) is valid standard SQL or not. 
But the MS use this type in SQLServer2000(and above?).
The SQL statements that I used to create tables in SQLite3 was auto generated 
by my SQLServer2000 EnterpriseManager.
And SQLite3 did not report any error about this. It likes a trap for me.
What ever, I have reported this as a bug in www.sqlite.org, and, I will also 
choose my columnnames carefully the next time :)
- Original Message - 
From: "Kees Nuyt" <[EMAIL PROTECTED]>
To: 
Sent: Friday, March 23, 2007 4:55 AM
Subject: Re: [sqlite] data type problem


> On Tue, 20 Mar 2007 13:24:17 +0800, you wrote:
> 
>>if you create a table use following statement (script generated from MS SQL 
>>Server 2000)
>>CREATE TABLE [XTollData] (
>> [DutyID] [char] (32) NOT NULL ,
>> [CarNumber] [char] (10) NULL 
>>);
>>
>>SQLite3_Column_decltype will treat DutyID as data type 'char' but not 
>>'char(32)'
> 
> I don't think [char] (32) in
> [DutyID] [char] (32) NOT NULL ,
> is valid SQL. Keywords can be quoted with "" or [] to be able to
> use them as identifiers (i.e. objectnames), but IMHO keywords
> that have to stay keywords shouldn't be quoted at all.
> 
> If you choose your columnnames carefully (not contained in the
> collection of reserved words), the [] could easily be filtered
> out with sed or awk.
> -- 
>  (  Kees Nuyt
>  )
> c[_]
> 
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
> 
>

Re: [sqlite] data type problem

2007-03-21 Thread qinligeng
but if you create a table using:

CREATE TABLE XTollData (
  DutyID char (32) NOT NULL ,
  CarNumber char (10) NULL 
 );

SQLite3_Column_decltype will return the result of 'DutyID' as 'char(32)'.
That is, SQLite3_Column_decltype treat '[char](32)' as 'char', treat 'char(32)' 
as 'char(32)'.
I think this IS a bug.
A Delphi compoenent(ASGSQLite3) use SQLite3_Column_decltype to determine the 
data type and data size of a field. And this "feature" makes it get the wrong 
size of '[char](32)' (as 1 byte), and get the right size of 'char(32)' (as 32 
bytes).

- Original Message - 
From: <[EMAIL PROTECTED]>
To: 
Sent: Tuesday, March 20, 2007 7:48 PM
Subject: Re: [sqlite] data type problem


<[EMAIL PROTECTED]> wrote:
> if you create a table use following statement (script generated from MS SQL 
> Server 2000)
> CREATE TABLE [XTollData] (
>  [DutyID] [char] (32) NOT NULL ,
>  [CarNumber] [char] (10) NULL 
> );
> 
> SQLite3_Column_decltype will treat DutyID as data type 'char' but not 
> 'char(32)'


This is a feature, not a bug.  If you want the database to enforce
a maximum string length, then add

   CHECK( length(DutyID)<=32 )

--
D. Richard Hipp  <[EMAIL PROTECTED]>


-
To unsubscribe, send email to [EMAIL PROTECTED]
-



[sqlite] data type problem

2007-03-19 Thread qinligeng
if you create a table use following statement (script generated from MS SQL 
Server 2000)
CREATE TABLE [XTollData] (
 [DutyID] [char] (32) NOT NULL ,
 [CarNumber] [char] (10) NULL 
);

SQLite3_Column_decltype will treat DutyID as data type 'char' but not 'char(32)'