About Store Forum Documentation Contact



Post Reply 
[my fault] Pak + sqlite
Author Message
Houge Offline
Member

Post: #1
[my fault] Pak + sqlite
Hello!

I faced a problem, is there a way to read sqlite database if it is inside a Pak?
FExist() finds a file in Pak, but sqlite creates empty DB with the same name near my EXE.

In headers description connectSQLite() performs project data connection

Code:
// file exists only in project data, try to connect in read-only mode using callbacks

UPD1:

According to your SQLite VFS implementation, it should work...
(This post was last modified: 12-29-2014 05:18 PM by Houge.)
12-28-2014 12:36 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: [Bug?] Pak + sqlite
Hello,

I've just tested this using following code:
Code:
/******************************************************************************/
ImagePtr logo;
/******************************************************************************/
void InitPre()
{
   EE_INIT();
   App.flag|=APP_FULL_TOGGLE;
   SQL sql;
   //sql.connectSQLite("d:/test.sql");
   sql.connectSQLite(EncodeFileName(UID(3221985849, 1258147776, 3401907373, 3006099455)));
   //sql.createTable("table", SQLColumn().set("test", SDT_STR));
   Memc<Str> tables; sql.getTables(tables); Exit(S+tables.elms());
}
bool Init()
{
   logo=UID(181111025, 1245255428, 320051877, 2205688464);
   return true;
}
void Shut()
{
}
/******************************************************************************/
bool Update()
{
   if(Kb.bp(KB_ESC))return false;
   Gui.update();
   return true;
}
void Draw()
{
   D.clear(WHITE);
   if(logo)logo->drawFs();
   Gui.draw();
   D.text(0, 0, S+Time.frame());
}
/******************************************************************************/
and it works.
I've tested with both compression of PAK and encryption (secure).
12-29-2014 09:31 AM
Find all posts by this user Quote this message in a reply
Houge Offline
Member

Post: #3
RE: [Bug?] Pak + sqlite
Thank you for your answer, please let me test the same code. I will write you back the results.

P.S. Maybe i had an error because i used file name, like sql.connectSQLite("fh8n3r89fn893#-2f437") and not EncodeFileName(UID).
12-29-2014 09:53 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Houge Offline
Member

Post: #4
RE: [Bug?] Pak + sqlite
UPD:
Doesn't work, it creates an empty DB every time. I created SQLite database and imported it to project as a RAW file. Right?

UPD2:

Sorry for bothering you, Greg! That was my fault smile
I created a class for accessing SQLite and created it before InitPre(), so no paks were loaded.

So no problem exists smile
(This post was last modified: 12-29-2014 05:20 PM by Houge.)
12-29-2014 04:47 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply