Beispiel #1
0
bool CdbHandler::dbConnect(char *dbHost, char *username, char *password, char *database)
{
	strncpy(dbHost_, dbHost, MAXHOSTSIZE);
	strncpy(username_, username, MAXNAMESIZE);
	strncpy(password_, password, MAXPASSSIZE);
	strncpy(database_, database, MAXDBSIZE);

	if (!dbInit())
	{
		printf("Couldn't initialize database query structure!\n");
		return false;
	}

#ifdef MYSQL_DB
	return mySQLConnect();
#endif

#ifdef ORACLE_DB
	return oracleConnect();
#endif

	printf("Database Not Supported!\n");

	return false;
};
Beispiel #2
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    ui->tableWidget->setColumnCount(4);
    ui->tableWidget->setHorizontalHeaderLabels(QStringList() << "Id" << "Date" << "Hour" << "Temperature");
    ui->tableWidget->verticalHeader()->setVisible(false);
    ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectItems);
    ui->tableWidget->setSelectionMode(QAbstractItemView::ExtendedSelection);

    connect(ui->tableWidget, SIGNAL(cellClicked(int,int)), this, SLOT(setId(int, int)));
    connect(ui->customPlot, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(showCoordinates(QMouseEvent *)));

    if (!readXML()) {
        qFatal("read XML err");
    }
    dbInit();
    drawData("");

    plotPaint();
    ui->tabWidget->setCurrentIndex(0);
    setWindowTitle("Body Temperature Monitor");
}
Beispiel #3
0
ChinaWeather::ChinaWeather(QObject *parent) :
    QObject(parent)
{
    dbLite = QSqlDatabase::addDatabase("QSQLITE","weather");
    dbLite.setDatabaseName("WeatherCode.db");
    dbLite.open();
    dbInit();
}
Beispiel #4
0
void
floatTestSuite()
{
	osInit();
	dbInit();
	TEST(testFloatSizes);
	dbFini();
}
Beispiel #5
0
int main(void)
{
	GrideDB dbInit("UNIQUECODERS");
	dbInit.init();

	dbInit.add("AnotherOneKey", "AnotherOneVal");

	return 0;
}
Beispiel #6
0
ChinaWeather::ChinaWeather(const QString &location, QObject *parent):
    QObject(parent)
{
    dbLite = QSqlDatabase::addDatabase("QSQLITE","weather");
    dbLite.setDatabaseName("WeatherCode.db");
    dbLite.open();
    dbInit();
    this->setLocation(location);
}
Beispiel #7
0
void
compInit(void)
{
	int	gclevel;

	gclevel = compDoGc     ? StoCtl_GcLevel_Automatic :
		  compDoGcFile ? StoCtl_GcLevel_Demand    :
		                 StoCtl_GcLevel_Never;
	/* If and when to GG. */
	stoCtl(StoCtl_GcLevel, gclevel);
	if (compDoGcVerbose)
		/* Put GC messages on osStdout. */
		stoCtl(StoCtl_GcFile, osStdout);
	else
		stoCtl(StoCtl_GcFile, (FILE *) NULL);
	/* Do not initialize pieces. */
	stoCtl(StoCtl_Wash, false);

	obInit();
	dbInit();
	comsgOpen();
	compInfoAudit();
 
	osSetBreakHandler(compSignalHandler);
	osSetFaultHandler(compSignalHandler);
	osSetLimitHandler(compSignalHandler);
	osSetDangerHandler(compSignalHandler);

	exitSetHandler	 (compExitHandler);
	fileSetHandler	 (compFileError);
	stoSetHandler	 (compStoreError);
	sxiSetHandler	 (compSExprError);
 
	pathInit();
	if (compRootDir) {
		fileAddLibraryDirectory(fileSubdir(compRootDir, "lib"));
		fileAddLibraryDirectory(fileSubdir(fileSubdir(compRootDir, "share"),
						   "lib"));
		fileAddIncludeDirectory(fileSubdir(compRootDir, "include"));
		ccSetRoot(compRootDir);
	}
	fileAddLibraryDirectory(osCurDirName());

	compCfgInit(compRootDir);
	arInit(compLibraryFiles, compLibraryKeys);
 
	sxiInit();
	keyInit();
	ssymInit();
	stabInitGlobal();
	tfInit();
	fmttsInit();
	foamInit();
	optInit();
	tinferInit();
}
Beispiel #8
0
/*
 * Usage: showexports libName type-expression
 * Example: showexports libaldor.al 'List(Integer)'
 */
int
main(int argc, char *argv[])
{
	osInit();
	sxiInit();
	keyInit();
	ssymInit();
	dbInit();
	stabInitGlobal();
	tfInit();
	foamInit();
	optInit();
	tinferInit();
	pathInit();

	sposInit();
	ablogInit();
	comsgInit();

	macexInitFile();
	comsgInit();
	scobindInitFile();
	stabInitFile();

	fileAddLibraryDirectory(".");

	String archive = argv[1];
	String expression = argv[2];

	scmdHandleLibrary("LIB", archive);

	AbSyn ab = shexpParse(expression);
	Stab stab = stabFile();
	Syme syme = stabGetArchive(symInternConst("LIB"));
	AbSyn arAbSyn = abNewId(sposNone, symInternConst("LIB"));

	stabImportTForm(stab, tiGetTForm(stab, arAbSyn));
	abPutUse(ab, AB_Use_Value);
	scopeBind(stab, ab);
	typeInfer(stab, ab);
	TForm tf = tiGetTForm(stab, ab);

	SymeList list = tfStabGetDomImports(stab, tf);

	for (; list != listNil(Syme); list = cdr(list)) {
		Syme syme = car(list);
		aprintf("%s %d %d %s\n", symeString(syme),
			symeDefnNum(syme), symeConstNum(syme), tfPretty(symeType(syme)));
	}

	scobindFiniFile();
	stabFiniFile();
	comsgFini();
	macexFiniFile();

}
Beispiel #9
0
static bool tcInit(void)
{
    SDL_Init(0);

    if (setup.Debug >= ERR_DEBUG) {
        pcErrOpen(ERR_OUTPUT_TO_DISK, "debug.txt");
    } else {
        pcErrOpen(ERR_NO_OUTPUT, NULL);
    }

    InitAudio();

    StdBuffer1 = TCAllocMem(STD_BUFFER1_SIZE, true);
    StdBuffer0 = TCAllocMem(STD_BUFFER0_SIZE, true);

    if (!StdBuffer0 || !StdBuffer1) {
        return false;
    }

    if (setup.CDAudio) {
        if ((CDRomInstalled = CDROM_Install())) {
            CDROM_WaitForMedia();
            return false;
        }
    }

    gfxInit();
    SDL_WM_SetCaption("Der Clou!", NULL);

    sndInit();

    if (!(GamePlayMode & GP_NO_SAMPLES))
        sndInitFX();

    ShowIntro();

    /* Start game. */
    inpOpenAllInputDevs();

    txtInit(AutoDetectLanguage());

    AutoDetectVersion();

    InitAnimHandler();

    dbInit();
    plInit();

    gfxCollToMem(128, &StdRP0InMem);    /* cache Menu in StdRP0InMem */
    gfxCollToMem(129, &StdRP1InMem);    /* cache Bubbles in StdRP1InMem */

    CurrentBackground = BGD_LONDON;
    return true;
}
Beispiel #10
0
void DbService::init()
{
    BfDebug(__FUNCTION__);
    g_sm->checkCurrentOn(ServiceMgr::DB);

    // init env
    leveldb::Env::Default();
    leveldb::BytewiseComparator();

    // dbOpen
    dbOpen();

    // dbInit
    dbInit();
}
Beispiel #11
0
void CompPosition::dbSave(){
	
	if(_obj->getProcessor()){
		if(isInit()){
			pqxx::work w(_obj->getProcessor()->getDB());
			stringstream s; 
			s<<"update CompPosition set "
				"modelId = "<<0<<" "
				"where objId = "<<_obj->getId()<<"";
			w.exec(s);
			w.commit();
		}else{
			dbInit();
		}
		
	}
}
Beispiel #12
0
int
main(int argc, String *argv)
{
	if (argc == 1) {
		osInit();
		sxiInit();
		sxiReadEvalPrintLoop(osStdin, osStdout, SXRW_Default);
	}
	else {
		osInit();
		dbInit();
		while (--argc) testSelf(*++argv);
		dbFini();
	}

	return EXIT_SUCCESS;
}
Beispiel #13
0
void
init()
{
	osInit();
	sxiInit();
	keyInit();
	ssymInit();
	dbInit();
	stabInitGlobal();
	tfInit();
	foamInit();
	optInit();
	tinferInit();

	sposInit();
	ablogInit();
	comsgInit();
}
Beispiel #14
0
void DbService::init()
{
    BfLog(__FUNCTION__);
    g_sm->checkCurrentOn(ServiceMgr::DB);

    // init env
    leveldb::Env::Default();
    leveldb::BytewiseComparator();

    // dbOpen
    dbOpen();

    // dbInit
    dbInit();

    // start timer
    this->pingTimer_ = new QTimer(this);
    this->pingTimer_->setInterval(5 * 1000);
    QObject::connect(this->pingTimer_, &QTimer::timeout, this, &DbService::onPing);
    this->pingTimer_->start();
}
void FacebookPostsDatabase::initDatabase()
{
    dbInit(SocialSyncInterface::socialNetwork(SocialSyncInterface::Facebook),
           SocialSyncInterface::dataType(SocialSyncInterface::Posts),
           QLatin1String(DB_NAME), POST_DB_VERSION);
}
Beispiel #16
0
/*
 * Usage: showexports libName type-expression
 * Example: showexports libaldor.al 'List(Integer)'
 */
int
main(int argc, char *argv[])
{
	osInit();
	sxiInit();
	keyInit();
	ssymInit();
	dbInit();
	stabInitGlobal();
	tfInit();
	foamInit();
	optInit();
	tinferInit();
	pathInit();

	sposInit();
	ablogInit();
	comsgInit();

	macexInitFile();
	comsgInit();
	scobindInitFile();
	stabInitFile();

	fileAddLibraryDirectory(".");

	String archive = argv[1];
	String expression = argv[2];

	scmdHandleLibrary("LIB", archive);

	AbSyn ab = shexpParse(expression);
	Stab stab = stabFile();
	Syme syme = stabGetArchive(symInternConst("LIB"));
	AbSyn arAbSyn = abNewId(sposNone, symInternConst("LIB"));
	AbSyn boolean = abNewId(sposNone, symInternConst("Boolean"));

	stabImportTForm(stab, tiGetTForm(stab, arAbSyn));
	stabImportTForm(stab, tiGetTForm(stab, boolean));
	abPutUse(ab, AB_Use_Value);
	scopeBind(stab, ab);
	typeInfer(stab, ab);
	TForm tf = tiGetTForm(stab, ab);
	aprintf("Type: %s Cat: %d\n", tfPretty(tf), tfSatCat(tf));
	if (tfSatDom(tf)) {
		SymeList list = tfGetCatExports(tf);
		aprintf("Category\n");
		for (; list != listNil(Syme); list = cdr(list)) {
			Syme syme = car(list);
			aprintf("%5s %3d %s %pAbSynList\n", symeString(syme), symeHasDefault(syme),
				tfPretty(symeType(syme)), symeCondition(syme));
		}
	}
	else {
		aprintf(">>> Exports\n");
		SymeList list = tfStabGetDomImports(stab, tf);

		for (; list != listNil(Syme); list = cdr(list)) {
			Syme syme = car(list);
			aprintf("%s %d %d %s\n", symeString(syme),
				symeDefnNum(syme), symeConstNum(syme), tfPretty(symeType(syme)));
		}

		TQualList tqList;
		aprintf(">>> Cascades\n");
		tqList = tfGetDomCascades(tf);

		for (; tqList != listNil(TQual); tqList = cdr(tqList)) {
			TQual tq = car(tqList);
			aprintf("--> %s\n", tfPretty(tqBase(tq)));
		}
	}

	scobindFiniFile();
	stabFiniFile();
	comsgFini();
	macexFiniFile();

}
Beispiel #17
0
int main(){
    dbInit();
    printf("Ibetres (1.5.15).\nType \"help\" for help.\n\n");
    interface();
    return 0;
}