Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri Aug 18, 2017 3:52 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: SQL Lite SaveAs new file
PostPosted: Sat Apr 21, 2012 8:55 am 
Offline
User avatar

Joined: Sat Jun 04, 2011 8:29 am
Posts: 387
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.

_________________
Currently using:
Windows XP Pro SP3
Real Studio 2011 Release 4.3 Enterprise
and
Mac OS 10.7.4
Real Studio 2011 Release 4.3 Enterprise
(finally also compiled on Mac)


Top
 Profile  
Reply with quote  
 Post subject: Re: SQL Lite SaveAs new file
PostPosted: Sat Apr 21, 2012 9:44 am 
Offline
User avatar

Joined: Sun Aug 05, 2007 10:46 am
Posts: 4931
Location: San Diego, CA
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.

_________________
Dave Sisemore
iMac I7[2012], OSX Mountain Lion 10.8.3 RB2012r2.1
Note : I am not interested in any solutions that involve custom Plug-ins of any kind


Top
 Profile  
Reply with quote  
 Post subject: Re: SQL Lite SaveAs new file
PostPosted: Sat Apr 21, 2012 12:42 pm 
Offline

Joined: Sat Oct 01, 2005 5:19 pm
Posts: 3216
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: SQL Lite SaveAs new file
PostPosted: Sat Apr 21, 2012 2:42 pm 
Offline
User avatar

Joined: Sat Jun 04, 2011 8:29 am
Posts: 387
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


Top
 Profile  
Reply with quote  
 Post subject: Re: SQL Lite SaveAs new file
PostPosted: Sat Apr 21, 2012 3:02 pm 
Offline

Joined: Sat Oct 01, 2005 5:19 pm
Posts: 3216
Look up SpecialFolder in the LR


Top
 Profile  
Reply with quote  
 Post subject: Re: SQL Lite SaveAs new file
PostPosted: Thu May 16, 2013 9:33 am 
Offline
User avatar

Joined: Sat Jun 04, 2011 8:29 am
Posts: 387
How do I throw the dialog to ask them the name to save the file to.... file B?


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group