Example #1
0
void UnitCfg::QueryResponse (QObject *p, const QString &c, int State, QObject*caller) // notify transaction completerequestrt needs the name record addedivityLled int2);, tion text,repprint int2);ate text);
{
	if(p != this) return;

	IT_IT("UnitCfg::QueryResponse");

	switch (State)
	{
		case tList:
		{
			// fill the name list box
			GetConfigureDb ()->FillComboBox (Name, "NAME");
			Name->setCurrentItem (0);
			SelChanged (0);
			Name->setFocus ();
			ButtonState (true);
		};
		break;
		case tItem:
		{
			IT_COMMENT("Received User Data");
			// fill the fields     
			Comment->setText (UndoEscapeSQLText(GetConfigureDb()->GetString ("COMMENT")));
			SetComboItem (UnitType, GetConfigureDb ()->GetString ("UNITTYPE"));
			Enabled->setChecked (GetConfigureDb ()->GetString ("ENABLED").toInt ());
			Comment->setFocus ();
			ButtonState (true);
		};
		break;
		case tDrop:
		{
			int n = GetConfigureDb()->GetNumberResults();
			
			QStringList list;
			QString point_list = "(";
			if (n)
			{
				for(int i = 0; i < n; i++,GetConfigureDb()->FetchNext())
				{
					if(i)
					{
						point_list += ",";
					};
					point_list += "'" + GetConfigureDb()->GetString("NAME") + "'";
					//
					list << GetConfigureDb()->GetString ("NAME");
				};

				point_list += ");";
			}

			QString cmd ="delete from TAGS_DB where NAME in " + point_list;
			GetCurrentDb ()->DoExec (0,cmd,0);
			//
			cmd ="delete from CVAL_DB where NAME in " + point_list;
			GetCurrentDb ()->DoExec (0,cmd,0);

			
			if(!list.isEmpty())
			{
				QStringList::Iterator it = list.begin();
				for(;it != list.end();++it)
				{
					QString cmd = "drop table "+ (*it) + ";";
					GetResultDb()->DoExec(0,cmd,0);
				}
			}

			//TO DO APA caricare tutti i Driver *p in un dizionario come fa il monitor
			//e poi usarli quando e' necessario
			Driver * p = FindDriver(UnitType->currentText());
			if(p)
			{
				DOAUDIT(tr("Drop Unit Tables:") + Name->currentText());
				p->DropAllSpecTables(list); // invoked the unit level drop tables 
			}

		}
		break;
		case tNew:
		case tDelete:
		case tApply:
		ButtonState (true);
		default:
		break;
	};
};