Re: [sqlite] Conditional execution

2007-09-11 Thread Joe Wilson
insert into tab2 
 select * from tab3 where exists (select * from tab1) 
 union all 
 select * from tab4 where not exists (select * from tab1);

Joe "Igor" Wilson

--- Yuriy Martsynovskyy <[EMAIL PROTECTED]> wrote:
> Is it possible to write a conditional SQL code like this? CASE
> expression does not seem to work here
> 
> IF (exists (Select * from tab1))
> THEN
> Insert into tab2 select * from tab3
> ELSE
> Insert into tab2 select * from tab4
> ENDIF;


   

Building a website is a piece of cake. Yahoo! Small Business gives you all the 
tools to get online.
http://smallbusiness.yahoo.com/webhosting 

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



[sqlite] Re: Conditional execution

2007-09-11 Thread Igor Tandetnik

Yuriy Martsynovskyy
<[EMAIL PROTECTED]> wrote:

Is it possible to write a conditional SQL code like this? CASE
expression does not seem to work here

IF (exists (Select * from tab1))
THEN
Insert into tab2 select * from tab3
ELSE
Insert into tab2 select * from tab4
ENDIF;


Something like this is best done in host application's code. But if you 
insist:


insert into tab2
select * from tab3 where exists (select * from tab1)
union all
select * from tab4 where not exists (select * from tab1);

Igor Tandetnik 



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



[sqlite] monitoring inserts

2007-09-11 Thread Mike Johnston
It seems clunky no real specific reason.  I tried it out today and it's quite 
fast and simple.  I'm not sure I could say the same thing about a lot of IPC 
stuff.
thanks
 
   
-
Boardwalk for $500? In 2007? Ha! 
Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.

[sqlite] Conditional execution

2007-09-11 Thread Yuriy Martsynovskyy
Is it possible to write a conditional SQL code like this? CASE
expression does not seem to work here

IF (exists (Select * from tab1))
THEN
Insert into tab2 select * from tab3
ELSE
Insert into tab2 select * from tab4
ENDIF;

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



Re: [sqlite] Monitoring for inserts

2007-09-11 Thread Dan Kennedy
On Tue, 2007-09-11 at 07:49 -0700, Mike Johnston wrote:
> What is the best way to get notified a table changed?  
> I would like to monitor a table for inserts without 
> resorting to polling.  Anyway to have a trigger call 
> a 'C' function or something?

There is, but it will only be called in the process that
performed the INSERT so cannot be used for IPC.

Polling the database is often a pretty good, efficient, 
solution. Even though it seems a bit clunky. Is there a
special reason you don't want to do it?



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



[sqlite] Monitoring for inserts

2007-09-11 Thread Mike Johnston
What is the best way to get notified a table changed?  I would like to monitor 
a table for inserts without resorting to polling.  Anyway to have a trigger 
call a 'C' function or something?

TIA,
Mike

   
-
Yahoo! oneSearch: Finally,  mobile search that gives answers, not web links. 

Re: [sqlite] Re: data base locked problem

2007-09-11 Thread Armin Steinhoff

"Igor Tandetnik" <[EMAIL PROTECTED]> schrieb am 11.09.2007 13:40:30:
> 
> Armin Steinhoff  wrote:
> > if we are try to create a new data base with sqlite
> > we see the following error outputs:
> >
> > # sqlite x.db
> > OPEN3   /appl/sbin/x.db
> > OPEN-EX 4   /tmp/sqlite_Iihb60vuQk4Nf9D
> > SQLite version 2.8.0
> > Enter ".help" for instructions
> > sqlite> create table yy(xx char(10), x int);
> > SQL error: database is locked
> > sqlite> .q
> > CLOSE   3
> > CLOSE   4
> >
> > What's the problem ??
> 
> My guess is, the user account you are running under doesn't have 
> permissions to create new files under /appl/sbin. 

No, that's not the case. Please see the correct file descriptors
shown by the trace output (OPEN / OPEN-EX)

--Armin

>The error message is 
> somewhat misleading.
> 
> Igor Tandetnik 
> 
> 
> -
> To unsubscribe, send email to [EMAIL PROTECTED]
> -
> 
> 
_
Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
http://smartsurfer.web.de/?mc=100071=0066


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



Re: [sqlite] extension-functions.tgz for sqlite3 3.4.1 ?

2007-09-11 Thread Nuno Lucas
On 9/10/07, Joe Wilson <[EMAIL PROTECTED]> wrote:
> --- Liam Healy <[EMAIL PROTECTED]> wrote:
> > Thanks for the tip Joe.  With sqlite3.h included, I can eliminate os.h and
> > vdbeInt.h, but not sqliteInt.h.  Apparently sqliteInt.h is not included by
> > sqlite3.h, and there are typedefs there that are needed.
>
> It would be nice if people could use the extension functions with
> the amalgamation, consisting of just sqlite3.h and sqlite3.c.
> If you use sqliteInt.h, they can't do that.
>
> Why not just repeat the typdefs for u8, etc, in your module?

Don't know current compiler standard compliance, but maybe including
the "new"  header file and using uint8_t, uint16_t, etc.
could be better yet (instead of every library having it's own typedef
section for basic types).


Regards,
~Nuno Lucas

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



[sqlite] Re: data base locked problem

2007-09-11 Thread Igor Tandetnik

Armin Steinhoff  wrote:

if we are try to create a new data base with sqlite
we see the following error outputs:

# sqlite x.db
OPEN3   /appl/sbin/x.db
OPEN-EX 4   /tmp/sqlite_Iihb60vuQk4Nf9D
SQLite version 2.8.0
Enter ".help" for instructions
sqlite> create table yy(xx char(10), x int);
SQL error: database is locked
sqlite> .q
CLOSE   3
CLOSE   4

What's the problem ??


My guess is, the user account you are running under doesn't have 
permissions to create new files under /appl/sbin. The error message is 
somewhat misleading.


Igor Tandetnik 



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



[sqlite] Re: passing float data types

2007-09-11 Thread Igor Tandetnik

nishit sharma <[EMAIL PROTECTED]>
wrote:

sqlite3_exec(database,"select name, phone, logo from databaseentry
where (x_add > 0.0) and (x_add<3000.0) which is working fine and
giving me results in between these limits.

but how can i pass upper comparison in sqlite3_exec() statement.


Don't use sqlite3_exec. Use prepared parameterized query. See 
sqlite3_prepare, sqlite3_bind_*, sqlite3_step, sqlite3_column_*, 
sqlite3_finalize


Igor Tandetnik 



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



[sqlite] data base locked problem

2007-09-11 Thread Armin Steinhoff


Hello,

if we are try to create a new data base with sqlite 
we see the following error outputs:

# sqlite x.db
OPEN3   /appl/sbin/x.db
OPEN-EX 4   /tmp/sqlite_Iihb60vuQk4Nf9D
SQLite version 2.8.0
Enter ".help" for instructions
sqlite> create table yy(xx char(10), x int);
SQL error: database is locked
sqlite> .q
CLOSE   3
CLOSE   4

What's the problem ??

Best Regards

Armin 
__
XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club!
Jetzt testen! http://produkte.web.de/club/?mc=021130


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



[sqlite] passing float data types

2007-09-11 Thread nishit sharma
Hi All,
first i give an example of what i am doing:
i have taken few data types as:
float logx= x - 2000.0;
loat logx1= x + 2000.0
float logy= y- 3000.0;
float logy1= y + 3000.0;
where x and y are define statements which are 2000.0 and 4000.0
i have an column of x_add  and y_add in my database. i want to print some
values on the basis of compairing of logx and logy with x_add
and y_add like logx