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 » U++ Library support » U++ SQL » SQLite crashes
Re: SQLite crashes [message #16965 is a reply to message #16517] Wed, 23 July 2008 18:31 Go to previous messageGo to previous message
Mindtraveller is currently offline  Mindtraveller
Messages: 917
Registered: August 2007
Location: Russia, Moscow rgn.
Experienced Contributor

OK, I switched to MySQL from SQLite and have the same error.

Usually one checks Execute() before doing Fetch:
MySqlSession session;
String q = ".....";
if (!session.Connect(...))
	return;
Sql sql(session);
if (sql.Execute(q))
	while(sql.Fetch())
	{
		for (int i=0; i<sql.GetColumns(); ++i)
			ShowDBMessage(sql.GetColumnInfo(i).name + " : " + (String)sql[i]);
	}

But if you forget to check Execute() and start fetching, the Fetch() call will throw an exception:
sql.Execute(q);
while(sql.Fetch()) //<-- throws an exception if Execute() failed
{
	for (int i=0; i<sql.GetColumns(); ++i)
		ShowDBMessage(sql.GetColumnInfo(i).name + " : " + (String)sql[i]);
}


I think Fetch() should not throw an exception, instead it should return no results if latest Execute() failed.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Difference between INT_ and INT?
Next Topic: underflow in bool Sql::fetch()
Goto Forum:
  


Current Time: Sun May 12 14:30:30 CEST 2024

Total time taken to generate the page: 0.01628 seconds