Jump to content

Search the Community

Showing results for tags 'sql'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • uniGUI Public
    • Announcements
    • General
    • Feature Requests
    • Installation
    • Deployment
    • Other Platforms
  • Licensing
    • Licensing
    • Ordering uniGUI
  • Bug Reports
    • Active Reports
    • Closed Reports
    • Old Bug Reports
  • uniGUI Development
    • General Development
    • uniGUI Releases & Roadmaps
    • Utilities
  • Mobile Platform
    • uniGUI Mobile
    • Mobile Browsers
  • Users Area
    • Sample Projects
    • Components and Code Samples
    • Third Party Components
  • Non-English
    • Non-English
  • Miscellaneous
    • Hosting
    • Server Security
    • Jobs

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 3 results

  1. MVakili

    Thread

    Sometimes, we want to run a store procedure in the server, which takes a lot of time, and in this case, the page even gets disconnected. To solve this problem, it is enough to create a Thread in the program and only monitor its execution Here I present the solution I created for myself and I will be happy if you help to improve it 1- create a temp table for list of process DMt.ProccessTable:='_X_'+DMt.CurrentPreName; DMt.Exec_SQLClient('If Not Object_Id('+QuotedStr(DMt.ProccessTable)+') is Null Drop Table '+DMt.ProccessTable); DMt.Exec_SQLClient(' Create Table '+DMt.ProccessTable+' ([StartDT] datetime DEFAULT (getdate()),[PName] NChar(50) ,[PID] int )'); 2- define type Type TSQLQueryThread = class(TThread) private FID: Integer; FQuery: string; FTempTable : String; FConnection: TMSConnection; protected procedure Execute; override; public constructor Create(const AID: Integer; const AQuery: string; AConnection: TMSConnection;ATempTable:String); property ID: Integer read FID; end; 2- functions for Thread procedure TSQLQueryThread.Execute; var Query: TMSQuery; begin Query := TMSQuery.Create(nil); try Query.Connection := FConnection; Query.SQL.Text := FQuery; Query.Execute; finally Query.Free; end; end; constructor TSQLQueryThread.Create(const AID: Integer; const AQuery: string; AConnection: TMSConnection;ATempTable:String); begin inherited Create(False); FID := AID; FQuery := AQuery; FConnection := AConnection; FTempTable:=ATempTable; end; procedure TDMT.TH_QueryThreadTerminated(Sender: TObject); Var FinalQ : TMSQuery; begin FinalQ := TMSQuery.Create(nil); try FinalQ.Connection := TSQLQueryThread(Sender).FConnection; FinalQ.SQL.Text := 'Delete From '+TSQLQueryThread(Sender).FTempTable+' Where PID='+TSQLQueryThread(Sender).FID.ToString; FinalQ.Execute; finally FinalQ.Free; end; end; 4-main procedure for call Procedure TDMT.TH_Execute(Titr,SQLCMD:String); var SQLQueryThread: TSQLQueryThread; begin Inc(FQueryCounter); DMt.Exec_SQLClient('Insert Into '+Dmt.ProccessTable+'(PName,PId) Values ('+QuotedStr(Titr)+','+FQueryCounter.ToString+')'); SQLQueryThread := TSQLQueryThread.Create(FQueryCounter, SQLCMD, ClientConnection,DMt.ProccessTable); SQLQueryThread.OnTerminate := TH_QueryThreadTerminated; SQLQueryThread.FreeOnTerminate := True; end; 5- Now We are ready to call it DMT.TH_Execute(' any title ','Exec ..........'); 6- You can use the following command to display the list of running processes and their duration SQL.Text:='SELECT PID,Pname, Trim(CONVERT(CHAR,DATEDIFF(mi, StartDT, GETDATE())))+'':''+CONVERT(CHAR,DATEDIFF(ss, StartDT, GETDATE())% 60) Dis FROM '+DMt.ProccessTable; and finally we have controller for our program
  2. Hi I need help to find why the bigint length more than 15 , UniDbText work correctly but UniDbGrid works wrong
  3. Hii, first, my english is not so good (i'm from germany) i want develop an onlineshop with mySQL. My problem is, The Connection / Session broken very fast... "EUniSessionException: 'Invalid session or session Timeout'" I working with Delphi XE8 and UniGui (Version 0.99.10.1182) ... I use the vcl DAC for MySQL. How can i this incease? Have you an idea?
×
×
  • Create New...