Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 11 to 13 of 13 total |
Application goes to "not responding" for larger queries |
Mon, Aug 12 2013 12:06 PM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Barry
>OK who mentioned putting tables in the datamodule > >You can still put the TEDBTable, TEDBQuery and TDatasource on each form. But the thread still needs its own instantiated datamodule that contains the TEDBDatabase, TEDBEngine, TEDBSession. Wrong! There is no requirement for a datamodule. I have a number of threads and not one of them uses a datamodule eg type TAlarmChecker = class(TThread) private iSignal: TSimpleEvent; iUserID: string; iReportBack: HWND; iMsgNo: integer; iCrashMsg: integer; iNewEMailsMsg: integer; iEMailSkipMsg: integer; iSession: TEDBSession; iDatabase: TEDBDatabase; iUnreadEmails: TEDBQuery; iNewEmails: TEDBQuery; iLastEMail: integer; iIsAlarmWanted: TEDBQuery; iLTCAlarm: TEDBQuery; iCurrentCheck: integer; iSkippedEMails: TEDBQuery; iLastSkipped: integer; FBlinkEMail: boolean; FBlinkAlarms: boolean; FBlinkLTC: boolean; constructor TAlarmChecker.Create(const AlarmsParams: TAlarmParams); begin inherited Create(True); iLastSkipped := 0; FBlinkEMail := False; FBlinkAlarms := False; FBlinkLTC := False; iReportBack := AlarmsParams.ReportBack; iMsgNo := AlarmsParams.MsgNo; iCurrentCheck := AlarmsParams.CurrentCheck; iCrashMsg := AlarmsParams.CrashMsg; iNewEMailsMsg := AlarmsParams.NewEMailsMsg; iEMailSkipMsg := AlarmsParams.EMailSkipMsg; iSignal := TSimpleEvent.Create; iUserID := AlarmsParams.UserID; iSession := TEDBSession.Create(nil); iSession.AutoSessionName := False; iSession.Name := 'alarm' + IntToStr(ThreadID); iSession.SessionName := iSession.Name; iSession.LoginUser := iUserID; iSession.LoginPassword := AlarmsParams.Password; iSession.LocalTempTablesPath := AlarmsParams.TempPath; iSession.LocalEncryptionPassword := AlarmsParams.Encryption; iSession.LocalConfigPath := AlarmsParams.ConfigPath; iSession.Connected := True; iDatabase := TEDBDatabase.Create(nil); iDatabase.Database := AlarmsParams.Database; iDatabase.Name := 'alarmDB' + IntToStr(ThreadID); iDatabase.DatabaseName := iDatabase.Name; iDatabase.SessionName := iSession.SessionName; PrepSkippedCheck; PrepAnyNewEMails; PrepEMailAlarm; PrepProjectAlarm; PrepLTCAlarm; try iDatabase.Execute('DELETE FROM LastCalls WHERE (_Date - CURRENT_DATE) DAY > 90'); except end; FreeOnTerminate := True; Resume; end; |
Mon, Aug 12 2013 5:06 PM | Permanent Link |
Barry | Roy,
>Wrong! There is no requirement for a datamodule. I have a number of threads and not one of them uses a datamodule< Yes, you can do it that way. I stand corrected. It means initializing and instantiating all of the database, session, and engine components individually when each database related form is created. This will work fine for small applications with one form. Since I have events defined for some of these components and error reporting, I just find it easier to maintain the code in one central location, namely the data module. But both scenarios will work fine. Barry You say "tomato" and I say "tomAto". |
Mon, Aug 12 2013 5:45 PM | Permanent Link |
Raul Team Elevate | Not necessarily - Delphi object inheritance is a very powerful feature so I have a base thread class with all the components and creating a DB thread is as simple as inheriting from our class. We also use datamodules and those are useful as well. Nice to have a choice One thing to add is that engine is a singleton so all instances of the engine component refer to same app level engine. Hence I personally do not use engine in datamodules at all to avoid any chance of accidentally changing any settings that affect the app. Raul On 8/12/2013 5:06 PM, Barry wrote: > > It means initializing and instantiating all of the database, session, and engine components individually when each database related form is created. This will work fine for small applications with one form. |
« Previous Page | Page 2 of 2 | |
Jump to Page: 1 2 |
This web page was last updated on Monday, May 6, 2024 at 12:23 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |