Alaska Software Inc. - Connection with sqlite database
Username: Password:
AuthorTopic: Connection with sqlite database
Salvatore Megna Connection with sqlite database
on Wed, 14 Mar 2018 17:41:11 +0100
there is someone that use alaska to connect a db sqlite?
If yes can you give me an example of connection?

thanks for all
Boris BorzicRe: Connection with sqlite database
on Wed, 14 Mar 2018 19:54:45 +0100
Salvatore Megna <smegna@tiscali.it> wrote in news:50acd986$3831d52b
$1a4a@news.alaska-software.com:

> there is someone that use alaska to connect a db sqlite?
> If yes can you give me an example of connection?

You can use SQLExpress + the SQLite3 ODBC driver to connect to an SQLite 
database.

Links:

SQLExpress (ODBC interface for Xbase++):  http://sqlexpress.net/sqlxpp/
SQLite ODBC driver:  http://www.ch-werner.de/sqliteodbc/
Connection string:  https://www.connectionstrings.com/sqlite3-odbc-driver/


Best regards,
Boris Borzic

http://xb2.net
http://sqlexpress.net
industrial strength Xbase++ development tools
Jim LeeRe: Connection with sqlite database
on Wed, 14 Mar 2018 21:31:44 +0100
> there is someone that use alaska to connect a db sqlite?

do you have Xbase++ v2.x ?
if you still on v1.9x you can use testsqlite.zip from Pablo www.xbwin.com
Frank GrossheinrichRe: Connection with sqlite database
on Thu, 15 Mar 2018 17:30:20 +0100
Salvatore,

If you have Xbase++ 2.0 and you want to have it simple, check out this 
small attached sample 

Frank

PS: BTW this even works with Foundation version.

On 14.03.2018 17:41, Salvatore Megna wrote:
> there is someone that use alaska to connect a db sqlite?
> If yes can you give me an example of connection?
>
> thanks for all


main.prg
Peter AlderliestenRe: Connection with sqlite database
on Mon, 19 Mar 2018 19:26:16 +0100
Frank Grossheinrich wrote:

>    in memory sqlite
>   SELECT * FROM sqlite_master INTO ARRAY aData
>   ? aData
> 
>   WAIT
> 
>    opens db but shuts down Xbase++ internal in memory db. So use it with care?!
>   USqlStatement():openDatabase("C:\Users\Frank\Documents\Xbase++\source\samples\data\northwind\northwind.sqlite3.db")
>    alternative usage
>    USqlStatement():attachDatabase("C:\Users\Frank\Documents\Xbase++\source\samples\data\northwind\northwind.sqlite3.db")
> 
>    get rid of it
>   USqlStatement():detachDatabase("northwind")

Hidden treasures...
Is there a way to get hold of these things (and others) without you being
around?

>    opens db but shuts down Xbase++ internal in memory db. So use it with care?!
I think you owe us an explanation here...

>   of course SQL Statement can be used ...
>  oStmt := DacSqlStatement():fromChar("SELECT * from customers WHERE country = 'Spain' ")
A few more questions here:
-  Which statements currently work with native Xbase++
-  Which statements will eventually work on sqlite with native Xbase++

Peter
Frank GrossheinrichRe: Connection with sqlite database
on Thu, 29 Mar 2018 16:15:31 +0200
Hey Peter,

yes, we have hidden treasures.
But it requires me or someone else from Alaska to shed some light on 
them. Otherwise they were not hidden . And ... this is subject to be 
changed in the future.

I try to explain a little bit: Xbase++ comes with Universal SQL. This 
means that you can write SQL statements running on DBF/NTX tables and 
any other DBE; even against arrays:

#include "Common.ch"
#include "dac.ch"

PROCEDURE Main
    LOCAL aDir
     what is the biggest file in my directory??
    SELECT field1 as name, field2 as size 		;
	FROM ( Directory()) ORDER BY size DESC INTO OBJECTS aDir
    ? aDir[1]:name   is the biggest
RETURN

To allow Universal SQL statements in Xbase++ Xbase++ comes with an 
SQLite In-Momory-Engine. Startung up the Xbase++ runtime also 
initializes the SQLite engine.

When you now load an SQLite DB the engine runs against that DB and not 
the in-momory DB. Of course now a CREATE TABLE will create a table 
within the loaded database. If you do that with the in-memory DB a 
virtual table will be created; and it will be lost as soon the process 
is terminated.

So all Universal SQL statements require a backend. As long you do not 
load an existing SQLite DB all will be processed within the in-memory DB 
and all is lost as soon the application quits.

Did I explain it a bit more?

Regards
Frank

PS: Enjoy Easter!!!


On 19.03.2018 19:26, Peter Alderliesten wrote:
> Frank Grossheinrich wrote:
>
>>    in memory sqlite
>>   SELECT * FROM sqlite_master INTO ARRAY aData
>>   ? aData
>>
>>   WAIT
>>
>>    opens db but shuts down Xbase++ internal in memory db. So use it with care?!
>>   USqlStatement():openDatabase("C:\Users\Frank\Documents\Xbase++\source\samples\data\northwind\northwind.sqlite3.db")
>>    alternative usage
>>    USqlStatement():attachDatabase("C:\Users\Frank\Documents\Xbase++\source\samples\data\northwind\northwind.sqlite3.db")
>>
>>    get rid of it
>>   USqlStatement():detachDatabase("northwind")
>
> Hidden treasures...
> Is there a way to get hold of these things (and others) without you being
> around?
>
>>    opens db but shuts down Xbase++ internal in memory db. So use it with care?!
> I think you owe us an explanation here...
>
>>   of course SQL Statement can be used ...
>>  oStmt := DacSqlStatement():fromChar("SELECT * from customers WHERE country = 'Spain' ")
> A few more questions here:
> -  Which statements currently work with native Xbase++
> -  Which statements will eventually work on sqlite with native Xbase++
>
> Peter
>
Salvatore Megna Re: Connection with sqlite database
on Thu, 15 Mar 2018 18:00:06 +0100
Il 14/03/2018 17:41, Salvatore Megna ha scritto:
> there is someone that use alaska to connect a db sqlite?
> If yes can you give me an example of connection?
> 
> thanks for all

I use 1.9
Frank GrossheinrichRe: Connection with sqlite database
on Thu, 15 Mar 2018 18:13:16 +0100
Then you know now how it would work with a still-supported Xbase++ 2.0. 
Needless to say that Xbase++ 1.9 is not yet supported anymore since years.

Frank

On 15.03.2018 18:00, Salvatore Megna wrote:
> Il 14/03/2018 17:41, Salvatore Megna ha scritto:
>> there is someone that use alaska to connect a db sqlite?
>> If yes can you give me an example of connection?
>>
>> thanks for all
>
> I use 1.9