LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
The following code allows me to 'clone' the SQLite database I am currently using and then switch me to that database. It works on my Mac where I developed it but does not work on my PC. Any suggestions?
on cloneDatabase
global gConIDRadi
put the field "Database Name" into tCurrentDB
replace "_GR.db" with "" in tCurrentDB
put tCurrentDB into tOldDB
put "_Clone" after tCurrentDB
ask question "What would you like to name this 'cloned' database?" with tCurrentDB titled "Clone Database"
put it into tCurrentDB
If tCurrentDB is not empty then
if tCurrentDB = tOldDB then
answer Warning "Duplicate name not allowed." titled "Clone Database"
exit cloneDatabase
end if
put "_GR.db" after tOldDB
put "_GR.db" after tCurrentDB
put the directory into tPath
put slash after tPath
put "binfile:" & tPath & tOldDb into tOldFile
put "binfile:" & tPath & tCurrentDB into tNewFile
put URL(tOldFile) into URL(tNewFile)
put the result into tResult
If tResult is empty then
put tCurrentDB into field "Database Name"
refreshMenu
end if
end if
end cloneDatabase
Hi Larry,
I doubled check your code and it looks right.
Is the db open when you try to copy? Microsoft’s Volume Shadow may not be enabled and so not allow the copy of an open db. The quick test I guess would be just to open the db and then from Win Explorer try a manual copy.
What does the tResult say?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
The database is open when I try to do the copy. I did try your quick test and it did allow me to make a copy while the database was open. Could it make any difference that my Windows 7 is running in a Parallels virtual machine on my Mac? I don't suspect that because I have had no other problems with that environment. Is it worth trying to close the database before trying the copy and the connecting to it again? Any other ideas?