コード例 #1
0
ファイル: mal_scenario.c プロジェクト: sekcheong/monetdb
str
defaultScenario(Client c)
{
#ifdef NEED_MT_LOCK_INIT
	if (c == mal_clients)
		MT_lock_init(&scenarioLock, "scenarioLock");
#endif
	return initScenario(c, scenarioRec);
}
コード例 #2
0
ファイル: mal_scenario.c プロジェクト: sekcheong/monetdb
/*
 * @-
 * Setting a new scenario calls for saving the previous state
 * and execution of the initClientScenario routine.
 */
str
setScenario(Client c, str nme)
{
	int i;
	str msg;
	Scenario scen = scenarioRec;

	scen = findScenario(nme);
	if (scen == NULL)
		throw(MAL, "setScenario", SCENARIO_NOT_FOUND " '%s'", nme);

	if (c->scenario) {
		c->oldscenario = c->scenario;
		for (i = 0; i < 7; i++) {
			c->oldstate[i] = c->state[i];
			c->oldphase[i] = c->phase[i];
		}
	}
	for (i = 0; i < 7; i++)
		c->state[i] = 0;

	msg = initScenario(c, scen);
	if (msg) {
		/* error occurred, reset the scenario , assume default always works */
		c->scenario = c->oldscenario;
		for (i = 0; i < 7; i++) {
			c->state[i] = c->oldstate[i];
			c->phase[i] = c->oldphase[i];
			c->oldstate[i] = NULL;
			c->oldphase[i] = NULL;
		}
		c->oldscenario = NULL;
		return msg;
	}
	return MAL_SUCCEED;
}
コード例 #3
0
ファイル: mal_scenario.c プロジェクト: Clay-Birkett/monetdb
str
defaultScenario(Client c)
{
    return initScenario(c, scenarioRec);
}