Re: [sqlite] Embedded SQL in C

2007-05-27 Thread Peter Wu
> --- Leif Jensen <[EMAIL PROTECTED]> wrote:
> > I thought about the "fake" library myself 
> > even though our project is more like 20 - 30k lines, but I'm not sure 
> > how bad it would be. 

Another easy way to embed is to use embedded C/C++ Ch.

All sqlite APIs are already supported in Ch and they can run in 
C/C++ interpreter Ch without compilation. You can use embedded Ch
and then call all sqlite APIs.

Ch Sqlite is open source and freely available from
  http://chsqlite.sourceforge.net/

More about Embedded Ch can be found at:
  http://www.softintegration.com/products/sdk/embedch/
  http://www.softintegration.com/support/faq/embed.html
  http://www.softintegration.com/solution/embedded/

Peter

> May not be worth the hassle given the size of your project.
> 
> Since you're using C, consider rewriting your code using TrollTech's Qt 
> library so you could hook up any database for which they've written a driver.
> There may be other multi-database libraries for C/C++.
> 

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



Re: [sqlite] Embedded SQL in C

2007-05-27 Thread John Stanton
We have an application server which incorporates Sqlite.  It implements 
a proprietary language to generate embedded server pages and these use 
regular embedded SQL compiled into the executables.  It also has a 
remote procedure call interface which accesses a repository of SQL using 
embedded SQl syntax bound to variable names in Javascript running in 
browsers.


To implement a preprocessor which intercepts SQL in a C program and 
embeds calls to the Sqlite API would provide what you want.  The Sqlite 
Bind call seems to have been implemented in such a way as to facilitate 
embedded SQL.


Leif Jensen wrote:
  That sounds very interesting. Could you please elaborate a little more 
on that ?


Leif


John Stanton wrote:

The Sqlite BIND capability makes implementing an embedded SQl 
interface quite a simple operation.


We use embedded SQL with Sqlite but do it within a proprietary 
language.  It was almost trivial to implement.


Leif Jensen wrote:


 Hi,

  In a larger project we are using PostgreSQL database and Embedded 
SQL in C (using ECPG) in a server daemon. We would like to be able to 
have this to work with SQLite for a stand-alone application. The 
Embedded SQL in C standard is as used by Oracle (and former Informix) 
and of course PostgreSQL.


  Does anyone know of an Embedded SQL in C (pre-compiler/interface) 
that will work with SQLite ?


Leif


- 


To unsubscribe, send email to [EMAIL PROTECTED]
- 






- 


To unsubscribe, send email to [EMAIL PROTECTED]
- 






- 


To unsubscribe, send email to [EMAIL PROTECTED]
- 






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



Re: [sqlite] Embedded SQL in C

2007-05-27 Thread Joe Wilson
--- Leif Jensen <[EMAIL PROTECTED]> wrote:
> I thought about the "fake" library myself 
> even though our project is more like 20 - 30k lines, but I'm not sure 
> how bad it would be. 

May not be worth the hassle given the size of your project.

Since you're using C, consider rewriting your code using TrollTech's Qt 
library so you could hook up any database for which they've written a driver.
There may be other multi-database libraries for C/C++.



   
Get
 the free Yahoo! toolbar and rest assured with the added security of spyware 
protection.
http://new.toolbar.yahoo.com/toolbar/features/norton/index.php

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



Re: [sqlite] Embedded SQL in C

2007-05-27 Thread Leif Jensen
  That sounds very interesting. Could you please elaborate a little 
more on that ?


Leif


John Stanton wrote:
The Sqlite BIND capability makes implementing an embedded SQl 
interface quite a simple operation.


We use embedded SQL with Sqlite but do it within a proprietary 
language.  It was almost trivial to implement.


Leif Jensen wrote:

 Hi,

  In a larger project we are using PostgreSQL database and Embedded 
SQL in C (using ECPG) in a server daemon. We would like to be able to 
have this to work with SQLite for a stand-alone application. The 
Embedded SQL in C standard is as used by Oracle (and former Informix) 
and of course PostgreSQL.


  Does anyone know of an Embedded SQL in C (pre-compiler/interface) 
that will work with SQLite ?


Leif


- 


To unsubscribe, send email to [EMAIL PROTECTED]
- 






- 


To unsubscribe, send email to [EMAIL PROTECTED]
- 






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



Re: [sqlite] Embedded SQL in C

2007-05-27 Thread John Stanton
The Sqlite BIND capability makes implementing an embedded SQl interface 
quite a simple operation.


We use embedded SQL with Sqlite but do it within a proprietary language. 
 It was almost trivial to implement.


Leif Jensen wrote:

 Hi,

  In a larger project we are using PostgreSQL database and Embedded SQL 
in C (using ECPG) in a server daemon. We would like to be able to have 
this to work with SQLite for a stand-alone application. The Embedded SQL 
in C standard is as used by Oracle (and former Informix) and of course 
PostgreSQL.


  Does anyone know of an Embedded SQL in C (pre-compiler/interface) that 
will work with SQLite ?


Leif


- 


To unsubscribe, send email to [EMAIL PROTECTED]
- 






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



Re: [sqlite] Embedded SQL in C

2007-05-27 Thread Leif Jensen
  Thank you for your ideas. I thought about the "fake" library myself 
even though our project is more like 20 - 30k lines, but I'm not sure 
how bad it would be. I'm aware of the SQL dialects, but we have tried to 
make a point of using "standard" SQL syntax. Of course we might have to 
develop some triggers/functions that are not available in SQLite at the 
moment.


  I was hoping someone had already done something along these lines before.

Leif


Joe Wilson wrote:

--- Leif Jensen <[EMAIL PROTECTED]> wrote:
  
   In a larger project we are using PostgreSQL database and Embedded SQL 
in C (using ECPG) in a server daemon. We would like to be able to have this to work with 
SQLite for a stand-alone application. The Embedded SQL in C standard is 
as used by Oracle (and former Informix) and of course PostgreSQL.


   Does anyone know of an Embedded SQL in C (pre-compiler/interface) 
that will work with SQLite ?



I am not aware of such a pre-compiler for SQLite.

If your project is quite large (100,000+ lines of code) then porting 
PostgreSQL's embedded C compiler ECPG to SQLite may be a viable alternative.


 http://doxygen.postgresql.org/dir_45ac211730e8147f7f879781af2b8b2a.html

The main porting effort would be in the ecpglib/ directory, mapping all
PQ-prefixed postgres functions and the PG-prefixed data structures to their 
SQLite equivalents.


 http://doxygen.postgresql.org/dir_9bd0bfe8893f57601e39e3093fd54938.html

A possibly simpler approach may be to construct a "fake" libpq library for 
use by the PostgreSQL ECPG program that does all the mappings to/from sqlite3.
You'd only have to support the subset of libpq functions actually used 
by ECPG.


But even if you did such a port using either approach, be aware that the 
SQL dialects of Postgres and SQLite are not the same - you'd likely have 
to change some of the embedded SQL statements in your code.




   
Sick sense of humor? Visit Yahoo! TV's 
Comedy with an Edge to see what's on, when. 
http://tv.yahoo.com/collections/222


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


  


Re: [sqlite] Embedded SQL in C

2007-05-27 Thread Joe Wilson
--- Leif Jensen <[EMAIL PROTECTED]> wrote:
>In a larger project we are using PostgreSQL database and Embedded SQL 
> in C (using ECPG) in a server daemon. We would like to be able to have this 
> to work with 
> SQLite for a stand-alone application. The Embedded SQL in C standard is 
> as used by Oracle (and former Informix) and of course PostgreSQL.
> 
>Does anyone know of an Embedded SQL in C (pre-compiler/interface) 
> that will work with SQLite ?

I am not aware of such a pre-compiler for SQLite.

If your project is quite large (100,000+ lines of code) then porting 
PostgreSQL's embedded C compiler ECPG to SQLite may be a viable alternative.

 http://doxygen.postgresql.org/dir_45ac211730e8147f7f879781af2b8b2a.html

The main porting effort would be in the ecpglib/ directory, mapping all
PQ-prefixed postgres functions and the PG-prefixed data structures to their 
SQLite equivalents.

 http://doxygen.postgresql.org/dir_9bd0bfe8893f57601e39e3093fd54938.html

A possibly simpler approach may be to construct a "fake" libpq library for 
use by the PostgreSQL ECPG program that does all the mappings to/from sqlite3.
You'd only have to support the subset of libpq functions actually used 
by ECPG.

But even if you did such a port using either approach, be aware that the 
SQL dialects of Postgres and SQLite are not the same - you'd likely have 
to change some of the embedded SQL statements in your code.



   
Sick
 sense of humor? Visit Yahoo! TV's 
Comedy with an Edge to see what's on, when. 
http://tv.yahoo.com/collections/222

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



[sqlite] Embedded SQL in C

2007-05-27 Thread Leif Jensen

 Hi,

  In a larger project we are using PostgreSQL database and Embedded SQL 
in C (using ECPG) in a server daemon. We would like to be able to have this to work with 
SQLite for a stand-alone application. The Embedded SQL in C standard is 
as used by Oracle (and former Informix) and of course PostgreSQL.


  Does anyone know of an Embedded SQL in C (pre-compiler/interface) 
that will work with SQLite ?


Leif


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