On 30 Sep 2015, at 12:05am, eluken at pentarch.org wrote: > I am using SQLite as the backend for a table-top wargame aid. One of the > features I am including in the aid is allowing the user to change the name of > the database. What would be the best way to do so? Inside the filesystem? Or > some feature in SQLite to copy the database to a new name? Ideally, all of > the data within the database will be transferred as well.
Are you absolutely sure you want your users to choose filenames ? Do they know all the filename rules for the platform they're using ? Will they try to include question marks, series of dots, backslashes, or other illegal characters ? Will you do the testing for checking to see if there's already a folder or file with the name they select ? If you're sure you want to do it, make sure the database is not open while you rename it, and rename it using normal file commands, not SQLite. There is a SQLite Backup API which can be used to take a copy of the database under a new name. But this is perhaps not what you want if you just want to rename it. Simon.