Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » Sqlite3 database
Sqlite3 database [message #40081] Fri, 07 June 2013 11:59 Go to previous message
idkfa46 is currently offline  idkfa46
Messages: 155
Registered: December 2011
Experienced Member
Hi all,
I'm trying to move schemas file and database file in a different directory.

	bool nodb = false;
	Sqlite3Session db;
	db.LogErrors(true);

#ifdef flagDEBUG
	db.SetTrace();
	nodb = true;
#endif

	FileIn fi("setting.db3");
	if(fi.IsError() || fi.GetSize() <= 0)
		nodb = true;
	fi.Close();
	
	if(!db.Open(ConfigFile("setting.db3")))
	{
		Exclamation(t_("Can't create or open database file"));
		return;
	}
	
	SQL = db;
	
	if(nodb)
	{
		SqlSchema sch(SQLITE3);
		StdStatementExecutor se(db);
		All_Tables(sch);
		
		Progress p;
		p.SetText(t_("Creating database"));
		{
			if(sch.ScriptChanged(SqlSchema::UPGRADE))
			{
				Sqlite3PerformScript(sch.Upgrade(), se, p);
			}
			if(sch.ScriptChanged(SqlSchema::ATTRIBUTES))
			{
				Sqlite3PerformScript(sch.Attributes(), se, p);
			}
			if(sch.ScriptChanged(SqlSchema::CONFIG))
			{
				Sqlite3PerformScript(sch.ConfigDrop(), se, p);
				Sqlite3PerformScript(sch.Config(), se, p);
			}
			sch.SaveNormal();
		}
	}


Atm the are located in the .exe directory. With a sch.SaveNormal(ConfigPath) I'm able to move schemas but not the setting.db3 .
any suggestion?

Regards,
Matteo
 
Read Message
Read Message
Previous Topic: Linking error again
Next Topic: Program loses hover focus
Goto Forum:
  


Current Time: Sun May 05 20:03:05 CEST 2024

Total time taken to generate the page: 0.01568 seconds