Exemplo n.º 1
0
FbCommonDatabase::FbCommonDatabase()
{
	FbDatabase::Open(wxGetApp().GetLibFile());
	ExecuteUpdate(fbT("PRAGMA temp_store=2"));
#ifdef SQLITE_ENABLE_ICU
	if (sqlite3_compileoption_used("SQLITE_ENABLE_ICU")) {
		ExecuteUpdate(fbT("SELECT icu_load_collation('ru_RU','CYR')"));
	} else
#endif
	SetCollation(wxT("CYR"), &sm_collation);
	InitFunctions();
}
Exemplo n.º 2
0
void FbMainDatabase::Open(const wxString& filename, const wxString& key, int flags)
{
	FbDatabase::Open(filename, key, flags);
	ExecuteUpdate(fbT("PRAGMA temp_store=2"));
	bool bExists = TableExists(GetMaster());
	InitFunctions();

	wxString message = bExists ? _("Open database") : _("Create database");
	FbLogMessage(message, filename);

	if (!bExists) CreateDatabase();
	UpgradeDatabase(DB_DATABASE_VERSION);
}
Exemplo n.º 3
0
VOID WINAPI ServiceStart(DWORD argc, LPTSTR *argv) {
	if (!SetSecurityPrivilage(TRUE)) {
		DebugOut("Failed to get privilage!\n");
		return;
	}
	if (!InitFunctions()) {
		DebugOut("Failed to init functions!\n");
		return;
	}
	ObjectPrefix = DEFAULT_OBJECT_PREFIX;
	ObjectPrefixLength = wcslen(ObjectPrefix);
	if (!GetSidByName(AccountName, &gpSid, &gSidLength)) {
		DebugOut("GetSidByName(%S, ...) failed!\n", AccountName);
		return;
	}
	ServiceStatus.dwServiceType = SERVICE_WIN32;
	ServiceStatus.dwCurrentState = SERVICE_START_PENDING;
	ServiceStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP;
	ServiceStatus.dwWin32ExitCode = 0;
	ServiceStatus.dwServiceSpecificExitCode = 0;
	ServiceStatus.dwCheckPoint = 0;
	ServiceStatus.dwWaitHint = 0;
	hServiceStatus = RegisterServiceCtrlHandlerExW(SERVICE_NAME, ServiceCtrlHandlerEx, NULL);
	if (hServiceStatus == (SERVICE_STATUS_HANDLE)0) {
		DebugOut("RegisterServiceCtrlHandlerW failed! (LastError=0x%x)\n", GetLastError());
		return;
	}
	DEV_BROADCAST_DEVICEINTERFACE NotificationFilter;
	ZeroMemory(&NotificationFilter, sizeof(NotificationFilter));
	NotificationFilter.dbcc_size = sizeof(DEV_BROADCAST_DEVICEINTERFACE);
	NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
	hDevNotify = RegisterDeviceNotificationW(hServiceStatus, &NotificationFilter, DEVICE_NOTIFY_SERVICE_HANDLE | DEVICE_NOTIFY_ALL_INTERFACE_CLASSES);
	if (!SetServiceStatus(hServiceStatus, &ServiceStatus)) { // Send current status.
		DebugOut("SetServiceStatus failed! (LastError=0x%x)\n", GetLastError());
	}

	ScanApplyObjectsRules();
}
Exemplo n.º 4
0
Runtime::Runtime() :
    context_(llvm::getGlobalContext()) {
    InitTypes();
    InitFunctions();
}
Exemplo n.º 5
0
CSumItApplication::CSumItApplication()
	  : BApplication(kOpenSumItSignature)
{
#if PRERELEASE
//	{
//		time_t now, expire;
//		time(&now);
//		expire = parsedate("nov 1, 1997", now);
//		printf("expire at %08x\n", expire);
//		expire = 0x345a62f0;

//		if (difftime(now, expire) > 0) {
//			MAlert *a = new MWarningAlert("This version of sum-it has expired");
//			a->Go();
//			exit(1);
//		}
//		TimeLimit limit;
//	}
#endif

	try
	{
		gApp = this;
		
		app_info ai;
		GetAppInfo(&ai);
		
		BEntry entry(&ai.ref);
		entry.GetPath(&gAppName);
		
		BPath dir;
		gAppName.GetParent(&dir);
		gAppDir = new BDirectory(dir.Path());
		gCWD = new BDirectory(*gAppDir);
			
		gResourceManager.SetTo( &gAppName ) ;
		InitFunctions();
		srand((int)(system_time() % INT_MAX));
			
		try
		{
			gPrefs = new CPreferences("Sum-It.Prefs");
			gPrefs->ReadPrefFile();
		}
		catch (CErr& e)
		{
			CATCHED;
			if (e != errIOOpen)
			{
				e.DoError();
				exit(1);
			}
		}
	
		gErrorNan = Nan(1);
		gRefNan = Nan(3);
		gCircleNan = Nan(4);
		gSqrtNan = Nan(5);
		gPowerNan = Nan(6);
		gValueNan = Nan(7);
		gDivNan = Nan(8);
		gAddNan = Nan(9);
		gFinanceNan = Nan(10);
		gEvalNan = Nan(11);
		gInvTrigNan = Nan(12);
		gLogNan = Nan(13);
		gMulNan = Nan(14);
		gNANan = Nan(15);
		gDateNan = Nan(16);
		gTimeNan = Nan(17);
//		gCellNan = Nan(18);
		gFuncNan = Nan(19);
		gNameNan = Nan(20);
		
		font_family fam;
		font_style sty;
		float siz;
		
		be_plain_font->GetFamilyAndStyle(&fam, &sty);
		siz = be_plain_font->Size();
		
		gFontSizeTable.GetFontID(
			gPrefs->GetPrefString("defdoc font family", fam),
			gPrefs->GetPrefString("defdoc font style", sty),
			gPrefs->GetPrefDouble("defdoc font size", siz),
			kBlack);
		
		InitFormatter();
		
		fOpenPanel = NULL;
		
		gClipboard = new CClipboard;
		gClipboard->Run();

		fFindDialog = CFindDialog::Construct();
		fFindDialog->Run();
		
		gWithEqualSign = gPrefs->GetPrefInt("formula starts with equal", 0);
		gGridColor = gPrefs->GetPrefInt("dark gridlines") ? 10 : 6;
		
		InstallMimeType();
		
		SetPulseRate(1000000);
	}
	
	catch (CErr& e)
	{
		CATCHED;
		e.DoError();
		exit(1);
	}
	
	catch (...)
	{
		CATCHED;
		ASSERT(false);
	}
}