[NEW] VKERNEL now can create journal at a specified location + Sandboxed Mac Apps with V4CC.

Frank have contact us with request add ability for V4CC (Valentina for Cocoa) developers to specify the location of journal of a database. This is important for sandboxed applications, which on default can access only their sandbox folder and a file(s) that user specify explicitly.

PROBLEM is that if a user choose somedb.vdb file in the SelectFile dialog , then Valentina engine needs yet to create a journal file near to .vdb file. But for a sandboxed application this is prohibited by OS X. This is why developer want to be able specify another location for journal file.

Btw, this problem exists more of year for SQLite database that is used e.g. in CoreData of Apple, when it is used by a sandboxed app. Strange, but the only advice from Apple is – disable journal file.

We have spend couple of days to add into C++ level  and into V4CC ADK this feature. Rest ADKs soon.

Now you can write the following in V4CC:

NSString* dbPath = [selectedUrl path];

mpDatabase = [[VDatabase alloc] initWithStorageType:EVStorageType_kDisk];

[mpDatabase setRBJournalFolder:[self pathToStoreJournal]];
[mpDatabase open:dbPath];

where

- (NSString*)pathToStoreJournal
{
    NSURL* url = [[[NSFileManager defaultManager]URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask] lastObject];
    return [url path]; 
}

Note 1: you should use Valentina database in mode=1, i.e. one .vdb file contains all: scheme + data + blb + indexes. Only journal is a separate file, that should be payed attention

Note 2: do not forget, that in RELEASE build of your application you should disable and Valentina logs, i.e. Valentina.DebugLevel = 0  and on start of application do SqlExecute( “SET WarningMode TO FALSE” ).

New example “Cocoa Features/Sandbox” is added into V4CC archive .

Published by

Ruslan Zasukhin

VP Engineering and New Technology Paradigma Software, Inc

Leave a Reply