• Welcome, Guest. Please login.
 
August 26, 2019, 02:15:17 am

News:

Welcome to the SQLitening support forums!


CopyDB

Started by cj, June 03, 2015, 09:42:11 pm

Previous topic - Next topic

cj

SQLitening has slCopyDatabase which allows more options and others shared access.
This is just a simple  copy that locks everyone out while copying.
How long can a copy take?

#INCLUDE "sqlitening.inc"
%DisplayErrors=99
FUNCTION PBMAIN AS LONG 'sqlback.bas
  result&=CopyDB("sample.db3","sample.backup")
END FUNCTION
'
FUNCTION CopyDB(sFromDatabase AS STRING, sToDatabase AS STRING) AS LONG
  IF ISFILE(sFromDataBase)=0 THEN
     FUNCTION=53
     #IF %DEF(%DisplayErrors)
     ? "Source file is missing" + $CR + UCASE$(sFromDatabase),%MB_SYSTEMMODAL,FUNCNAME$
     #ENDIF
     EXIT FUNCTION
  ELSE
    slopen sFromDatabase    'open source database
    slexe "begin immediate" 'lock others out
    FILECOPY sFromDatabase,sToDataBase
    FUNCTION = ERR
    slexe "end" 'unlock source database
    slClose     'close  source database
    #IF %DEF(%DisplayErrors)
    IF ERR THEN ? ERROR$(ERR),,FUNCNAME$
    #ENDIF
  END IF
END FUNCTION

Fredrick Ughimi

Hello CJ,

Is it possible to backup a db in remote mode outside the use of SQLiteningServerMonitor?

I tried your DBCopy routines and I got the usual error -8 Access Denied.

Best regards, 
Fredrick O. Ughimi<br /><br />fughimi@gmail.com<br />- Freedom lies in being bold -- Robert Frost, Poet