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 » SQLCommander make program crash
SQLCommander make program crash [message #17657] Sun, 24 August 2008 22:31 Go to next message
TeCNoYoTTa is currently offline  TeCNoYoTTa
Messages: 138
Registered: July 2008
Location: Egypt
Experienced Member

why when i add
SQLCommander();

to my code

the program crash and this message is viewed

http://img170.imageshack.us/img170/3828/errorww6.jpg
Re: SQLCommander make program crash [message #17659 is a reply to message #17657] Mon, 25 August 2008 00:22 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Are you connected to db?

Mirek
Re: SQLCommander make program crash [message #17663 is a reply to message #17659] Mon, 25 August 2008 08:32 Go to previous messageGo to next message
TeCNoYoTTa is currently offline  TeCNoYoTTa
Messages: 138
Registered: July 2008
Location: Egypt
Experienced Member

I use Sqlite3 and in this is the constructer of my window
CISL::CISL()
{
	CtrlLayout(*this, "CISL");
	
	this->WhenClose = THISBACK(Hide);
	this->MinimizeBox();
	///////Opening DataBase

	if (!sqlite3.Open(ConfigFile("simple.db")))
	{
		Exclamation("Can't Open Dataabse");
		return;
	}
	SQL = sqlite3;

	SqlSchema sch(SQLITE3);
	StdStatementExecutor se(sqlite3);
	All_Tables(sch);
	if (sch.ScriptChanged(SqlSchema::UPGRADE))
		Sqlite3PerformScript(sch.Upgrade(),se);
	if (sch.ScriptChanged(SqlSchema::ATTRIBUTES))
	{
		Sqlite3PerformScript(sch.Attributes(),se);
	}
	if (sch.ScriptChanged(SqlSchema::CONFIG))
	{
		Sqlite3PerformScript(sch.ConfigDrop(),se);
		Sqlite3PerformScript(sch.Config(),se);
	}
	sch.SaveNormal();

	tray.WhenBar = THISBACK(TrayMenu);
	btn_download <<= THISBACK(OpenDownloadManager);
	btn_add <<= THISBACK(OpenAddWindow);

	list_items.AddKey();
	list_items.Add("title");
	list_items.Add("Author");
	list_items.Add("Status");

	SQL*Select(SUBJECT_ID,SUBJECT_NAME).From(CIS_SUBJECTS);
	while (SQL.Fetch())
	{
		droplist_subject.Add(SQL[0],SQL[1]);
	}
	SQL*Select(TYPE_ID,TYPE_NAME).From(SUBJECTS_TYPES);
	while (SQL.Fetch())
	{
		droplist_type.Add(SQL[0],SQL[1]);
	}

	/////////////////////////////////////////////////////
	droplist_subject.WhenAction = THISBACK(droplist_change);
	droplist_type.WhenAction = THISBACK(droplist_change);
	//////////////////////////////////////////////
	if (!droplist_subject.IsNullInstance())
		droplist_subject.SetIndex(0);
	if (!droplist_type.IsNullInstance())
		droplist_type.SetIndex(0);
	droplist_change();
	list_items.WhenLeftDouble = THISBACK(OpenItemNotesWindow);
	
	SQLCommander();//This make it crash
}

Re: SQLCommander make program crash [message #17664 is a reply to message #17663] Mon, 25 August 2008 10:49 Go to previous messageGo to next message
TeCNoYoTTa is currently offline  TeCNoYoTTa
Messages: 138
Registered: July 2008
Location: Egypt
Experienced Member

strange

when i commented this function ( i mean commented it's call in constructor)
void CISL::droplist_change()
{
	text_title.SetText(droplist_subject.Get().ToString() +"-"+ droplist_type.Get().ToString());
	SQL*Select(ITEM_ID,ITEM_TITLE,ITEM_AUTHOR
			   ,Count(Select(SqlAll()).From(FILES).Where(FILE_ITEM_ID == ITEM_ID && IS_DOWNLOADED == true))
			   ,Count(Select(SqlAll()).From(FILES).Where(FILE_ITEM_ID == ITEM_ID))).GroupBy(ITEM_ID,ITEM_TITLE,ITEM_AUTHOR);

	while (SQL.Fetch())
	{
		list_items.Add(SQL[0],SQL[1],SQL[2],(SQL[3].ToString()+"/"+SQL[4].ToString()));
	}

}

code worked
Re: SQLCommander make program crash [message #17678 is a reply to message #17664] Mon, 25 August 2008 18:07 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
TeCNoYoTTa wrote on Mon, 25 August 2008 04:49

strange

when i commented this function ( i mean commented it's call in constructor)
void CISL::droplist_change()
{
	text_title.SetText(droplist_subject.Get().ToString() +"-"+ droplist_type.Get().ToString());
	SQL*Select(ITEM_ID,ITEM_TITLE,ITEM_AUTHOR
			   ,Count(Select(SqlAll()).From(FILES).Where(FILE_ITEM_ID == ITEM_ID && IS_DOWNLOADED == true))
			   ,Count(Select(SqlAll()).From(FILES).Where(FILE_ITEM_ID == ITEM_ID))).GroupBy(ITEM_ID,ITEM_TITLE,ITEM_AUTHOR);

	while (SQL.Fetch())
	{
		list_items.Add(SQL[0],SQL[1],SQL[2],(SQL[3].ToString()+"/"+SQL[4].ToString()));
	}

}

code worked


Usually, the error is a sign that you are trying to Fetch after errornous SQL.

I recommend you to activate log ("SetTrace") and check it after the crash.

Mirek
Re: SQLCommander make program crash [message #17679 is a reply to message #17678] Mon, 25 August 2008 18:08 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
P.S.: Thinking about it, the most likely cause is that SQLite does not perhaps support nested Select in Count...

[Updated on: Mon, 25 August 2008 18:08]

Report message to a moderator

Previous Topic: Count error
Next Topic: SQL_ProgreSQL example building problems
Goto Forum:
  


Current Time: Sat Apr 27 17:15:14 CEST 2024

Total time taken to generate the page: 0.02728 seconds