Real Software Forums
http://forums.realsoftware.com/

SQL Lite SaveAs new file
http://forums.realsoftware.com/viewtopic.php?f=3&t=43702
Page 1 of 1

Author:  torrid [ Sat Apr 21, 2012 8:55 am ]
Post subject:  SQL Lite SaveAs new file

I need a SaveAs menu item.... user is editing existing sql lite db file.... decides to do SaveAs...

I know how to do the dialog to ask user for the folderitem and name etc.

But do I just save and close the file and copy on the hard drive outside of RB, and then connect to new file?

Or should this be done in memory? If I save and disconnect, and have data objects in memory,
connect to new file and then write them into the new file?

If anyone has any code or suggestions I'd appreciate it.

Author:  DaveS [ Sat Apr 21, 2012 9:44 am ]
Post subject:  Re: SQL Lite SaveAs new file

A database is a file just like any other file....

1) close current database (file A)
2) copy File A to File B
3) connect to File B
4) Delete File A if desired

Everything is the same as it was before except you database is now is a new physical location.

I put similar functionality into all my database oriented programs to give the user the option of where to keep the data... either on the local desktop computer..... or perhaps move it to a LAN oriented server for more secure backup etc.

Author:  Jym [ Sat Apr 21, 2012 12:42 pm ]
Post subject:  Re: SQL Lite SaveAs new file

I would never actually save any information to the 'original' database file until the user chooses either Save or Save As. Many times people can work on a project then realize that it was better before they started working on it, so they want to go back to the time where they started. For many reasons a rollback won't work, so they are screwed.

I set it up so when a user chooses a file to work on I copy it to the temp folder, allow them to make any changes they want(to the temp file) and both Save and Save As are the same thing, I either copy the temp to the original or copy the file to the 'new' spot they want. Like this if the computer crashes I can give them the "found something you were working on" dialog as well when they run the program again.

Author:  torrid [ Sat Apr 21, 2012 2:42 pm ]
Post subject:  Re: SQL Lite SaveAs new file

When you copy to a temp folder....
how do you make that cross-platform?

i.e. what is the temp folder equivalent on the mac?

-T

Author:  Jym [ Sat Apr 21, 2012 3:02 pm ]
Post subject:  Re: SQL Lite SaveAs new file

Look up SpecialFolder in the LR

Author:  torrid [ Thu May 16, 2013 9:33 am ]
Post subject:  Re: SQL Lite SaveAs new file

How do I throw the dialog to ask them the name to save the file to.... file B?

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/