[sqlite] SELECT syntax?

2005-03-02 Thread mike . griffin
I have a strange problem, I can do this:

UPDATE [Employees] SET
[EMAIL PROTECTED],
[EMAIL PROTECTED],
[EMAIL PROTECTED],
[EMAIL PROTECTED]
WHERE
[EMAIL PROTECTED]

But I can do this,

SELECT [LastName],[FirstName] FROM [Employees]

I have to remove the [] brackets on LastName and FirstName in order for it
to work, are [] even allowed?

I'm confused abit.



Re: [sqlite] Reindexing a table in SQLite

2005-03-02 Thread D. Richard Hipp
On Wed, 2005-03-02 at 16:53 -0800, R S wrote:
> I periodically delete older records from my table (which contains
> hundreds of thousands of entries). I want to reindex the table for
> more efficient access.
> 

That is fully automatic in SQLite.  REINDEX does not help.
REINDEX is only needed if you change a collating sequence.

After a lot of INSERTs and DELETEs, you can sometimes get
slightly better performance by doing a VACUUM.  VACUUM
improves locality of reference slightly.
-- 
D. Richard Hipp <[EMAIL PROTECTED]>



Re: [sqlite] Reindexing a table in SQLite

2005-03-02 Thread Derrell . Lipman
R S <[EMAIL PROTECTED]> writes:

> I periodically delete older records from my table (which contains
> hundreds of thousands of entries). I want to reindex the table for
> more efficient access.

An index is kept up-to-date as you insert and delete records, so there is
generally no need to re-index.  If you want to recover the file space formerly
used by now-deleted records, you can periodically issue the VACUUM command.

Derrell


Re: [sqlite] Reindexing a table in SQLite

2005-03-02 Thread R S
I periodically delete older records from my table (which contains
hundreds of thousands of entries). I want to reindex the table for
more efficient access.

Thanks!


On Wed, 02 Mar 2005 18:20:39 -0600, Kurt Welgehausen <[EMAIL PROTECTED]> wrote:
> You can drop an index and later create it again.
> Why do you think you need to do that?
> 
> Regards
>


Re: [sqlite] Reindexing a table in SQLite

2005-03-02 Thread Kurt Welgehausen
You can drop an index and later create it again.
Why do you think you need to do that?

Regards


RE: [sqlite] Any successful VxWorks ports out there?

2005-03-02 Thread D. Richard Hipp
On Wed, 2005-03-02 at 22:04 +, Mr. Tezozomoc wrote:
> Does this mean that the in memory database can be accessed by more than one 
> task without giving schema corruption?
> This is the problem I was having the 2.8.x... version...
> 

No.  You will still need to protect the accesses using mutexes
in order to get that to work.
-- 
D. Richard Hipp <[EMAIL PROTECTED]>



RE: [sqlite] Any successful VxWorks ports out there?

2005-03-02 Thread Mr. Tezozomoc
Does this mean that the in memory database can be accessed by more than one 
task without giving schema corruption?
This is the problem I was having the 2.8.x... version...

Tezo
Original Message Follows
From: "D. Richard Hipp" <[EMAIL PROTECTED]>
Reply-To: sqlite-users@sqlite.org
To: sqlite-users@sqlite.org
Subject: RE: [sqlite] Any successful VxWorks ports out there?
Date: Wed, 02 Mar 2005 15:13:18 -0500
On Wed, 2005-03-02 at 19:35 +, Mr. Tezozomoc wrote:
> I have successfully port 2.8.15 to vxworks
> The in memory database is very problematic
>
Note that the in-memory database for version 3.x is
completely new and uses a different approach than the
in-memory database in version 2.8.x.  So whatever the
problems were that Mr. Tezozomoc had, they may well
be gone now.
--
D. Richard Hipp <[EMAIL PROTECTED]>



[sqlite] Reindexing a table in SQLite

2005-03-02 Thread R S
Hi,
  How do I programatically reindex a table in SQLite? Is it possible?
I did a search but didn't find much. I am using version 3.0.8
Thanks!


[sqlite] correct use of sqlite3_get_table

2005-03-02 Thread Richard Boyd








Hi all,

 

I’m trying to use sqlite3_get_table() to execute SQL commands on a database. I’ve
included a code snippet below. 

 

The problem I’m having is that when I execute
the "SELECT MAX(time_stamp)
FROM table32;” command using sqlite3_get_table() I only get one column
and 1 row returned and the result contains “MAX(time_stamp)”
rather than the value I’m after. When I run the same command in
sqlite3.exe shell I get the desired result (a single number). 

 

Any one any ideas where I’m going wrong with
this??

 

TIA

-Richard.

 



 

rc
= sqlite3_open("testdb", &db);

  if( rc )

  {

    fprintf(stderr, "Can't open database: %s\n",
sqlite3_errmsg(db));

   
sqlite3_close(db);

    exit(1);

  }

 

  printf ("about to execute the
rxd command\n");

  printf ("%s\n",
command);

  rc = sqlite3_get_table(db,

 "SELECT MAX(time_stamp) FROM
table32;",//command,

 &tresults->results,  //&zResult,

 &tresults->numrows,  //&numrows,

 &tresults->numcols,  //&numcols,

 &tresults->err_msg); //&zErrMsg);

 



 






No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.5.2 - Release Date: 28/02/2005


RE: [sqlite] Any successful VxWorks ports out there?

On Wed, 2005-03-02 at 19:35 +, Mr. Tezozomoc wrote:
> I have successfully port 2.8.15 to vxworks
> The in memory database is very problematic
> 

Note that the in-memory database for version 3.x is
completely new and uses a different approach than the
in-memory database in version 2.8.x.  So whatever the
problems were that Mr. Tezozomoc had, they may well
be gone now.
-- 
D. Richard Hipp <[EMAIL PROTECTED]>



Re: [sqlite] Adding a column to an sqlite database through the sqlite utility interface

I just recreated the table. Thanks for your input Jan.
Steve
Jan Ekström wrote:
Try this
13) How do I add or delete columns from an existing table in SQLite.
 SQLite does yes not support the "ALTER TABLE" SQL command. If you 
what to change the structure of a table, you have to recreate the 
table. You can save existing data to a temporary table, drop the old 
table, create the new table, then copy the data back in from the 
temporary table.

 For example, suppose you have a table named "t1" with columns names 
"a", "b", and "c" and that you want to delete column "c" from this 
table. The following steps illustrate how this could be done:

BEGIN TRANSACTION;
CREATE TEMPORARY TABLE t1_backup(a,b);
INSERT INTO t1_backup SELECT a,b FROM t1;
DROP TABLE t1;
CREATE TABLE t1(a,b);
INSERT INTO t1 SELECT a,b FROM t1_backup;
DROP TABLE t1_backup;
COMMIT;
.Jan- Original Message - From: "Ulrik Petersen" 
<[EMAIL PROTECTED]>
To: 
Sent: Wednesday, March 02, 2005 8:03 PM
Subject: Re: [sqlite] Adding a column to an sqlite database through 
the sqlite utility interface


Steve Frierdich wrote:
Does anyone know how to add a column to an sqlite database through the
sqlite utility interface. I tried the SQL statement , ALTER TABLE table
Name ADD column variable, and it did not work. Anyone know any other 
way?
Thanks
Steve

http://www.sqlite.org/faq.html#q13




[sqlite] Thanks!


I've gotten my first application up and running nicely with sqlite.
I wanted to say thanks to everyone for their hard work that made it
possible more quickly than I had imagined.

My project:

* An event management web site for a convention.
* Gentoo 2004
* Linux 2.4 kernel
* AMD Duron 600mhz w/ 256 meg RAM
* lighttpd web server
* C++ cgi
* sqlite backend database





__ 
Celebrate Yahoo!'s 10th Birthday! 
Yahoo! Netrospective: 100 Moments of the Web 
http://birthday.yahoo.com/netrospective/


Re: [sqlite] Adding a column to an sqlite database through the sqlite utility interface

Try the following
Jan
...
13) How do I add or delete columns from an existing table in SQLite.
 SQLite does yes not support the "ALTER TABLE" SQL command. If you what to 
change the structure of a table, you have to recreate the table. You can 
save existing data to a temporary table, drop the old table, create the new 
table, then copy the data back in from the temporary table.

 For example, suppose you have a table named "t1" with columns names "a", 
"b", and "c" and that you want to delete column "c" from this table. The 
following steps illustrate how this could be done:

BEGIN TRANSACTION;
CREATE TEMPORARY TABLE t1_backup(a,b);
INSERT INTO t1_backup SELECT a,b FROM t1;
DROP TABLE t1;
CREATE TABLE t1(a,b);
INSERT INTO t1 SELECT a,b FROM t1_backup;
DROP TABLE t1_backup;
COMMIT;
...- Original Message - 
From: "Steve Frierdich" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, March 02, 2005 7:26 PM
Subject: [sqlite] Adding a column to an sqlite database through the sqlite 
utility interface


Does anyone know how to add a column to an sqlite database through the
sqlite utility interface. I tried the SQL statement , ALTER TABLE table
Name ADD column variable, and it did not work. Anyone know any other way?
Thanks
Steve
Shum [Ming Yik] wrote:
Hi,
I would like to ask ...:
1.) Add dummy  DTOS() ... and other functions into SQLite
So that perform same syntax with other SQLs...
ie.:  SELECT * mytable where DTOS(TSTDATE)>='20050101' ...
Shum
www.mingyik.com






Re: [sqlite] Adding a column to an sqlite database through the sqlite utility interface

Try this
13) How do I add or delete columns from an existing table in SQLite.
 SQLite does yes not support the "ALTER TABLE" SQL command. If you what to 
change the structure of a table, you have to recreate the table. You can 
save existing data to a temporary table, drop the old table, create the new 
table, then copy the data back in from the temporary table.

 For example, suppose you have a table named "t1" with columns names "a", 
"b", and "c" and that you want to delete column "c" from this table. The 
following steps illustrate how this could be done:

BEGIN TRANSACTION;
CREATE TEMPORARY TABLE t1_backup(a,b);
INSERT INTO t1_backup SELECT a,b FROM t1;
DROP TABLE t1;
CREATE TABLE t1(a,b);
INSERT INTO t1 SELECT a,b FROM t1_backup;
DROP TABLE t1_backup;
COMMIT;
.Jan- Original Message - 
From: "Ulrik Petersen" <[EMAIL PROTECTED]>
To: 
Sent: Wednesday, March 02, 2005 8:03 PM
Subject: Re: [sqlite] Adding a column to an sqlite database through the 
sqlite utility interface


Steve Frierdich wrote:
Does anyone know how to add a column to an sqlite database through the
sqlite utility interface. I tried the SQL statement , ALTER TABLE table
Name ADD column variable, and it did not work. Anyone know any other way?
Thanks
Steve
http://www.sqlite.org/faq.html#q13




Re: [sqlite] Mem-Structure

Hello again,

your answer in fact means that - although I specify my string is zero
terminated - the n-Member of the Mem-structure is indispensable when
inserting data to the DB?

Bernhard

- Original Message - 
From: "D. Richard Hipp" <[EMAIL PROTECTED]>
To: "Bernhard DÃbler" <[EMAIL PROTECTED]>
Cc: 
Sent: Monday, February 28, 2005 10:03 PM
Subject: Re: [sqlite] Mem-Structure


On Mon, 2005-02-28 at 20:03 +0100, Bernhard DÃbler wrote:
>
> vdbemem.c (2004 May 26) reads at about line 650:
>
>   if( pMem->enc==SQLITE_UTF8 && (flags & MEM_Term) ){
> assert( strlen(pMem->z)<=pMem->n );
> assert( pMem->z[pMem->n]==0 );
>   }
>

Strictly speaking, assert() is never needed.  These two asserts
were probably put in at different times.  The second assert is
the more restrictive of the two.  If either were eliminated it
would be the first.



RE: [sqlite] Any successful VxWorks ports out there?

I have successfully port 2.8.15 to vxworks
I have ported over to PPC604 and PENTIUM
The main catch here is the ... that there is no file locking in vxworks
This is the major problem.
You have to write your own wrapper to prevent multiple tasks accessing the 
database...

I wrote my own busy handler that pends on the database when it is busy and 
throws 1 task delay...

On a pentium 200 MHZ I was able to achieve extremely fast responses using 
pre-compile queries.

Another big gotcha... is that sqlite uses a lot of Mallocs... this will 
cause problems in VXworks... eventually... the memory becomes fragmented and 
it cause problems... so I switched to using memory pools... this reduced 
this problem...

The pure 'c' version is very easy to compile.
The in memory database is very problematic
If you want to do an in memory database and are going to access it with more 
than one task, i recommend the following

I implemented a ramdrive and trick sqlite into thinking it is running from a 
real drive...

This will give the best of both worlds without lossing to much 
performance

Let me know if you need any more info...
Tezo.
Original Message Follows
From: "Andrew Lukasik" <[EMAIL PROTECTED]>
Reply-To: sqlite-users@sqlite.org
To: "'sqlite-users@sqlite.org'" 
Subject: [sqlite] Any successful VxWorks ports out there?
Date: Wed, 2 Mar 2005 14:19:49 -0500
I'm currently using SQLite on Linux but I'm considering a port to VxWorks.
Has anyone done this successfully?  Care to comment? I took a look thru the
archives, there wasn't a whole lot there. I'd be interested in knowing:
a) how difficult/lengthy was the port
b) pitfalls/got-chas
c) performance - does sqlite perform as well here as other known OS's?
d) eperience w/ in-memory databases on VxWorks?
e) other db alternatives you rejected, and why.
Thanks,
/Andrew
Andrew J. Lukasik
Nortel Networks
Phone:(978)-288-6861, ESN 248-6861
Email: [EMAIL PROTECTED]



[sqlite] Any successful VxWorks ports out there?

Title: Message



 
I'm currently using 
SQLite on Linux but I'm considering a port to VxWorks.  Has anyone done 
this successfully?  Care to comment? I took a look thru the archives, there 
wasn't a whole lot there. I'd be interested in knowing:
a) how 
difficult/lengthy was the port
b) 
pitfalls/got-chas
c) performance - 
does sqlite perform as well here as other known OS's?
d) eperience w/ 
in-memory databases on VxWorks?
e) other db 
alternatives you rejected, and why.
 
Thanks,
/Andrew
 
Andrew J. Lukasik
Nortel Networks
Phone:(978)-288-6861, ESN 
248-6861
Email: 
[EMAIL PROTECTED]
 

 
 


Re: [sqlite] Adding a column to an sqlite database through the sqlite utility interface

Steve Frierdich wrote:
Does anyone know how to add a column to an sqlite database through the
sqlite utility interface. I tried the SQL statement , ALTER TABLE table
Name ADD column variable, and it did not work. Anyone know any other way?
Thanks
Steve
 

http://www.sqlite.org/faq.html#q13



[sqlite] Adding a column to an sqlite database through the sqlite utility interface

Does anyone know how to add a column to an sqlite database through the
sqlite utility interface. I tried the SQL statement , ALTER TABLE table
Name ADD column variable, and it did not work. Anyone know any other way?
Thanks
Steve

Shum [Ming Yik] wrote:

>Hi,
>
>I would like to ask ...:
>
>1.) Add dummy  DTOS() ... and other functions into SQLite
>So that perform same syntax with other SQLs...
>
>ie.:  SELECT * mytable where DTOS(TSTDATE)>='20050101' ...
>
>Shum
>www.mingyik.com
>
>
>  
>


Re: [sqlite] Ticket 1153: make test on 3.1.3 throws 11 errors

On Tue, 2005-03-01 at 12:59 -0500, G. Roderick Singleton wrote:
> On Tue, 2005-03-01 at 12:37 -0500, D. Richard Hipp wrote:
> > On Tue, 2005-03-01 at 11:36 -0500, G. Roderick Singleton wrote:
> > > I tried posting via gmane and was unsuccessful as this mailing list
> > > rejected the posting. I subsequently entered this ticket for evaluation.
> > > I tried combing the list archives and the docs but found nothing that
> > > would indicate that the failure of test was expected. Can someone please
> > > let me know.
> > 
> > The ticket fails to mention some important facts:
> > 
> > * What operating system you are using
> 
> FC3
> 
> > * What compiler you are using
> 
> gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)
> 
> I would have update the ticket but am only on the mailing lists.

Found how to update the ticket and the problem is solved. I discovered
that sqlite should be compiled and tested as a user rather than as root.
I tend to build system level stuff as root out of long habit and this is
not documented in the README or externally.

> > 
> > All the tests pass on the developer's platforms.  We are going
> > to need some hints if you want us to look into your problem.
> 
> Consider the above hints.
-- 
G. Roderick Singleton <[EMAIL PROTECTED]>
PATH tech



RE: [sqlite] Database Version 2 or 3, can you query for it?

The only way is to query one of the exported functions (sqlite3_version
or something like this). I agree, however, that it would be nice to have
a
version resource in the DLL. Also, If somebody would take the trouble to
do it, I would very much appreciate it if a proper MsVC project file ,
with appropriate config options (and version resource) could be part of
the distribution. I would do it, only I am not a good user of MSVC so
would probably botch it.

> Is it possible to determine what the version number of the DLL
> (Windows) is? The DLL doesn't seem to contain any version information
> 
> 
> 



[sqlite] Ask for same sytanx with other SQL Back-end ...?

Hi,

I would like to ask ...:

1.) Add dummy  DTOS() ... and other functions into SQLite
So that perform same syntax with other SQLs...

ie.:  SELECT * mytable where DTOS(TSTDATE)>='20050101' ...

Shum
www.mingyik.com