public void open(String strPath, String strSqlScript, String strEncryptionInfo) { try { String dbURI = RHODESAPP().resolveDBFilesPath(strPath); dbURI = CFilePath.removeFirstSlash(dbURI); boolean bEncrypted = strEncryptionInfo != null && strEncryptionInfo.length() > 0; //DatabaseSecurityOptions dbso = new DatabaseSecurityOptions(bEncrypted); boolean bExist = CRhoFile.isFileExist(strPath); int res = Sqlite3.sqlite3_open(dbURI, ref m_db); if (res != Sqlite3.SQLITE_OK) { throw new DBException(res, "Could not open database file: " + strPath); } res = Sqlite3.sqlite3_exec(m_db, "PRAGMA journal_mode=PERSIST", 0, 0, 0); if (res != Sqlite3.SQLITE_OK) { Sqlite3.sqlite3_close(m_db); m_db = null; throw new DBException(res, "Cannot set journal mode to PERSIST: " + strPath); } string[] ar1 = CRhoFile.enumDirectory("db"); if (!bExist) { createSchema(strSqlScript); } Sqlite3.sqlite3_create_function(m_db, "rhoOnDeleteObjectRecord", 3, Sqlite3.SQLITE_ANY, 0, DBAdapter.SyncBlob_DeleteCallback, null, null); Sqlite3.sqlite3_create_function(m_db, "rhoOnUpdateObjectRecord", 3, Sqlite3.SQLITE_ANY, 0, DBAdapter.SyncBlob_UpdateCallback, null, null); Sqlite3.sqlite3_create_function(m_db, "rhoOnDeleteSchemaRecord", 1, Sqlite3.SQLITE_ANY, 0, DBAdapter.SyncBlob_DeleteSchemaCallback, null, null); Sqlite3.sqlite3_create_function(m_db, "rhoOnUpdateSchemaRecord", 2, Sqlite3.SQLITE_ANY, 0, DBAdapter.SyncBlob_UpdateSchemaCallback, null, null); string[] ar2 = CRhoFile.enumDirectory("db"); if (m_bPendingTransaction) { startTransaction(); } m_bPendingTransaction = false; } catch (Exception exc) { throw new DBException(exc); } finally { m_nInsideTransaction = 0; } }
public override bool FileExists(string path) { if (path == "") { return(false); } return(CRhoFile.isResourceFileExist(path) || CRhoFile.isFileExist(path)); }
public boolean isDbFileExists(string strPath) { return(CRhoFile.isFileExist(strPath)); }