[futurebasic] Re: [FB] Database Front-End

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2008 : Group Archive : Group : All Groups

From: Robert Purves <listrp@...>
Date: Sat, 19 Jan 2008 17:22:43 +1300
Christopher Wyatt wrote:

>> Since the MySQL and SQLite API's in C/C++ are published, I would  
>> assume the C code could be used to add this functionality to FB?  
>> Any thoughts?


> For PostgreSQL the libpq C API is 800K -- source, headers, makefile,  
> etc. It looks pretty clean (relatively) and well-maintained. It's in  
> C, which seems ideal for a port to OS X. MySQL licensing is a tad  
> messy, but they also have several C API models. The SQLite code is  
> for embedding directly into an application.
>
> The SQLite approach might be best, since that would let someone have  
> a "database" without an external server. Downside is that it is  
> single user. Benefit is that OS X uses SQLite in CoreData, so it's  
> already a standard on the Mac.


Here's a complete FBtoC program that interacts, in a limited but  
instructive manner, with SQLite.

'------------------------------------
/*
Demo of calling a function in SQLite.

In FBtoC settings, 'More gcc options' must have this link command:
-lsqlite3
*/

#if ndef _FBtoC
compile shutdown "Build with FBtoC"
#endif

#if def _PASSTHROUGHFUNCTION
#include <sqlite3.h>
#endif


/*
FB translation of
int sqlite3_libversion_number(void);
*/
toolbox fn sqlite3_libversion_number() = long


window 1
print "sqlite3 version: " fn sqlite3_libversion_number()
stop
'--------------------------------------

Robert P.