[sqlite] CREATE INDEX

2009-01-15 Thread Gregor Brandt
If I call CREATE INDEX on an existing table will the index be
automatically updated if the table is altered or do i have to create
the index again, will this occur between runs?  I also notice that
CREATE INDEX optionally takes a UNIQUE keyword.   If I create a table
from scratch how do I define the column so that it is an index but not
UNIQUE.

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


[sqlite] error from sqlite3_get_table

2008-07-11 Thread Gregor Brandt
I get and SQLITE_ERROR code form sqlite3_get_table.  Upon checking  
sqlite3_errcode and sqlite3_errmsg I get 0 and 'not an error'.

The command SELECT * FROM `alarm_history` ORDER BY `alarm_id`; is very  
simple and most of the time it workswhy am I getting an error  
occasionally?

Gregor


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


Re: [sqlite] -DSQLITE_OMIT_TRIGGER

2008-06-23 Thread Gregor Brandt
scratch that request, found the info...thanks

Gregor

On 23-Jun-08, at 1:06 PM  , Gregor Brandt wrote:

> Are there any docs on how to make the amalgamation.  I have to make
> this executable smaller... 409K is too big.
>
> Gregor
>
> On 23-Jun-08, at 1:01 PM  , Jay A. Kreibich wrote:
>
>> On Mon, Jun 23, 2008 at 12:40:02PM -0600, Gregor Brandt scratched on
>> the wall:
>>> Hi,
>>>
>>> I'm trying to compile the amalgamated src in 3.4.8  with -
>>> DSQLITE_OMIT_TRIGGER and I get the following errors:
>>
>> You can't apply the flags to an existing amalgamation.  You have to
>> build
>> from base sources or re-build the amalgamation using the flags you
>> want.
>>
>>  -j
>>
>> -- 
>> Jay A. Kreibich < J A Y  @  K R E I B I.C H >
>>
>> "'People who live in bamboo houses should not throw pandas.' Jesus
>> said that."
>>  - "The Ninja", www.AskANinja.com, "Special Delivery 10: Pop!Tech
>> 2006"
>> _______
>> sqlite-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
> -
> Gregor Brandt
>
> Marionette Software Group
> Suite 202, 124 - 26 Ave SW
> Calgary, AB, Canada T2S 3G5
> Tel: +1 403 401 4784
> EMail: [EMAIL PROTECTED]
>
> www.marionette.ca
>
>
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

-
Gregor Brandt

Marionette Software Group
Suite 202, 124 - 26 Ave SW
Calgary, AB, Canada T2S 3G5
Tel: +1 403 401 4784
EMail: [EMAIL PROTECTED]

www.marionette.ca





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


Re: [sqlite] -DSQLITE_OMIT_TRIGGER

2008-06-23 Thread Gregor Brandt
Are there any docs on how to make the amalgamation.  I have to make  
this executable smaller... 409K is too big.

Gregor

On 23-Jun-08, at 1:01 PM  , Jay A. Kreibich wrote:

> On Mon, Jun 23, 2008 at 12:40:02PM -0600, Gregor Brandt scratched on  
> the wall:
>> Hi,
>>
>> I'm trying to compile the amalgamated src in 3.4.8  with -
>> DSQLITE_OMIT_TRIGGER and I get the following errors:
>
>  You can't apply the flags to an existing amalgamation.  You have to  
> build
>  from base sources or re-build the amalgamation using the flags you
>  want.
>
>   -j
>
> -- 
> Jay A. Kreibich < J A Y  @  K R E I B I.C H >
>
> "'People who live in bamboo houses should not throw pandas.' Jesus  
> said that."
>   - "The Ninja", www.AskANinja.com, "Special Delivery 10: Pop!Tech  
> 2006"
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

-
Gregor Brandt

Marionette Software Group
Suite 202, 124 - 26 Ave SW
Calgary, AB, Canada T2S 3G5
Tel: +1 403 401 4784
EMail: [EMAIL PROTECTED]

www.marionette.ca





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


[sqlite] -DSQLITE_OMIT_TRIGGER

2008-06-23 Thread Gregor Brandt
Hi,

I'm trying to compile the amalgamated src in 3.4.8  with - 
DSQLITE_OMIT_TRIGGER and I get the following errors:

Undefined symbols:
   "_sqlite3TriggerSelectStep", referenced from:
   _sqlite3Parser in sqlite3.o
   "_sqlite3TriggerUpdateStep", referenced from:
   _sqlite3Parser in sqlite3.o
   "_sqlite3BeginTrigger", referenced from:
   _sqlite3Parser in sqlite3.o
   "_sqlite3FinishTrigger", referenced from:
   _sqlite3Parser in sqlite3.o
   "_sqlite3DropTrigger", referenced from:
   _sqlite3Parser in sqlite3.o
   "_sqlite3TriggerInsertStep", referenced from:
   _sqlite3Parser in sqlite3.o
   _sqlite3Parser in sqlite3.o
   "_sqlite3TriggerDeleteStep", referenced from:
   _sqlite3Parser in sqlite3.o
   "_sqlite3DeleteTriggerStep", referenced from:
   _yy_destructor in sqlite3.o
ld: symbol(s) not found


I get errors like this with a number of the OMIT defines.  I am trying  
to make my executable smaller by removing stuff I do not use.

Thanks,
Gregor







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


Re: [sqlite] SQL question

2008-06-17 Thread Gregor Brandt
I did change it to:

UPDATE `table` SET `id` = `id` + 32768 WHERE `id` >= x

and then I decrement everything over 32768 by 32767 to get it back in  
line.

This was required because a single update on a primary key did return  
an error about a key conflict when only incrementing by 1!

Thanks,
Gregor


On 16-Jun-08, at 11:53 AM  , Darren Duncan wrote:

> Gregor, why did you do that more complicated version with the  
> subquery and
> sorting et al?  The short version that RBS would have worked a lot  
> better;
> you just need to say?
>
>   update binary_report_fmt
>   set column_id = column_id + 1
>   where column_id > 1;
>
> ... and then insert a new row with column_id = 2.  All that other  
> stuff you
> did just makes things unnecessarily more complicated, and possibly  
> buggy.
>
> On a related matter, UPDATE statements are atomic operations, so the  
> fact
> that the id is a primary key doesn't matter.  Since you're  
> incrementing all
> the id values simultaneously, there are no duplicate values at any  
> time, so
> the primary key constraint would remain happy.
>
> -- Darren Duncan
>
> Gregor Brandt wrote:
>> Hi, thanks this is great.  Of course I forgot to mention that the id
>> is a primary key, so I get an error about duplicate primary keys.
>>
>> I tried this:
>>
>> update binary_report_fmt set column_id = column_id + 1 where  
>> column_id
>> = (select column_id from binary_report_fmt where column_id >= 3 order
>> by column_id desc);
>>
>> but it only updates the last item.   I guess I can make it a non-
>> primary key..then it works perfectly.
>>
>> Gregor
>>
>> On 16-Jun-08, at 10:04 AM  , [EMAIL PROTECTED] wrote:
>>
>>> update
>>> table
>>> set id = id + 1
>>> WHERE
>>> id > 1
>>>
>>> RBS
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

-
Gregor Brandt

Marionette Software Group
Suite 202, 124 - 26 Ave SW
Calgary, AB, Canada T2S 3G5
Tel: +1 403 401 4784
EMail: [EMAIL PROTECTED]

www.marionette.ca





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


Re: [sqlite] SQL question

2008-06-16 Thread Gregor Brandt
Hi, thanks this is great.  Of course I forgot to mention that the id  
is a primary key, so I get an error about duplicate primary keys.

I tried this:

update binary_report_fmt set column_id = column_id + 1 where column_id  
= (select column_id from binary_report_fmt where column_id >= 3 order  
by column_id desc);

but it only updates the last item.   I guess I can make it a non- 
primary key..then it works perfectly.

Gregor

On 16-Jun-08, at 10:04 AM  , [EMAIL PROTECTED] wrote:

> update
> table
> set id = id + 1
> WHERE
> id > 1
>
> RBS
>
>
>> Sorry about this, but this is a SQL question and not a SQLite  
>> specific
>> question.
>>
>> Is there a way to increment a value in a table in-situ.   Without
>> reading it, incrementing it, writing it?
>>
>> I need to insert an entry into a table, it has an id, all entries  
>> with
>> id's >= the id need to be incremented to keep the id's unique
>>
>> ie
>>
>> 1 bob
>> 2 joe
>> 3 irene
>>
>> someone wants to insert 2 sarah, I need the table to look like this
>>
>> 1 bob
>> 2 sarah
>> 3 joe
>> 4 irene
>>
>>
>> Any help would be great.
>> thanks
>>
>> -
>> Gregor
>>
>>
>> ___
>> 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-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQL question

2008-06-16 Thread Gregor Brandt
Sorry about this, but this is a SQL question and not a SQLite specific  
question.

Is there a way to increment a value in a table in-situ.   Without  
reading it, incrementing it, writing it?

I need to insert an entry into a table, it has an id, all entries with  
id's >= the id need to be incremented to keep the id's unique

ie

1 bob
2 joe
3 irene

someone wants to insert 2 sarah, I need the table to look like this

1 bob
2 sarah
3 joe
4 irene


Any help would be great.
thanks

-
Gregor


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


[sqlite] quick transaction question

2008-06-10 Thread Gregor Brandt
When doing transactional commits I do

int error = sqlite3_Exec( .., "BEGIN TRANSACTION;", ... )   
// can  
this ever return an error?
int error = sqlite3_exect( ..., "some update command", ... )

if I get an error code, must I never do the "COMMIT;".  what if I do?

Thanks
Gregor

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