Author Topic: 軟件介面資料庫載入到記憶體當中  (Read 4420 times)

admin

  • Administrator
  • *****
  • Posts: 0
    • View Profile
軟件介面資料庫載入到記憶體當中
« on: October 23, 2011, 01:43:13 AM »
Code: [Select]
Function LoadUItoMemory() As Boolean
  Dim tmpResult As Boolean=false
  dim tmpUIFileName as  new FolderItem
  gUIConnection = New REALSQLDatabase
 
  #if DebugBuild then
    tmpUIFileName =GetFolderItem(app.ExecutableFile.Parent.Parent.AbsolutePath +cashierxtra.gcntuifilename)
  #else
    tmpUIFileName =GetFolderItem(app.ExecutableFile.parent.AbsolutePath + cashierxtra.gcntuifilename)
  #endif
   
  gUIConnection.AutoCommit=true
 
  if gUIConnection.connect Then
    call gUIConnection.Attachdatabase(tmpUIFileName,"tempdb","***EncryptKey***")
    if gUIConnection.Error=true then
      return false
    end if
   
    gUIConnection.SQLExecute ("CREATE TABLE UIFormat AS SELECT * FROM tempdb.UIFormat")
    if gUIConnection.Error=true then
      return false
    end if
   
    gUIConnection.SQLExecute ("CREATE TABLE UILanguage AS SELECT * FROM tempdb.UILanguage")
    if gUIConnection.Error=true then
      return false
    end if
   
    gUIConnection.SQLExecute ("CREATE TABLE UIImage AS SELECT * FROM tempdb.UIImage")
    if gUIConnection.Error=true then
      return false
    end if
   
    gUIConnection.SQLExecute ("DETACH tempdb")
    if gUIConnection.Error=true then
      return false
    end if
   
    tmpResult = True
   
  End If
 
  Return tmpResult
 
Exception Err
  CatchErrorType(Err,CurrentMethodName)
  return false
End Function