Ignore:
Timestamp:
Nov 13, 2010, 4:32:15 PM (14 years ago)
Author:
george
Message:
  • Přidáno: Zobrazení seznamu hostovaných projektů.
  • Upraveno: Funkce Query jednotky SQLDatabase nyní nevrací novou instanci, ale výsledné řádky vrací v parametru. Bezpečnější metoda předcházející únikům paměti.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebServer/UHTTPSessionMySQL.pas

    r36 r38  
    4040    Result := BinToHexString(SHA1(FloatToStr(Now)));
    4141    try
    42       DbRows := SqlDatabase.Query('SELECT * FROM `HTTPSession` WHERE `Identification`="' +
     42      DbRows := TDbRows.Create;
     43      SqlDatabase.Query(DbRows, 'SELECT * FROM `HTTPSession` WHERE `Identification`="' +
    4344        Result + '"');
    4445      Found := DbRows.Count > 0;
     
    6768  try
    6869    Lock.Acquire;
    69     DbRows := SqlDatabase.Query('DELETE FROM `HTTPSession` WHERE `Time` < DATE_SUB(NOW(), INTERVAL ' +
     70    DbRows := TDbRows.Create;
     71    SqlDatabase.Query(DbRows, 'DELETE FROM `HTTPSession` WHERE `Time` < DATE_SUB(NOW(), INTERVAL ' +
    7072      IntToStr(Timeout) +' SECOND)');
    71     DbRows.Free;
    72     DbRows := SqlDatabase.Query('SELECT * FROM `HTTPSession` WHERE `Identification`="' +
     73    SqlDatabase.Query(DbRows, 'SELECT * FROM `HTTPSession` WHERE `Identification`="' +
    7374      HandlerData.SessionId + '"');
    7475    if DbRows.Count > 0 then begin
     
    9192  try
    9293    Lock.Acquire;
    93     DbRows := SqlDatabase.Query('SELECT * FROM `HTTPSession` WHERE `Identification`="' +
     94    DbRows := TDbRows.Create;
     95    DbRows2 := TDbRows.Create;
     96    SqlDatabase.Query(DbRows, 'SELECT * FROM `HTTPSession` WHERE `Identification`="' +
    9497      HandlerData.SessionId + '"');
    9598    if DbRows.Count > 0 then
    96       DbRows2 := SqlDatabase.Query('UPDATE `HTTPSession` SET `Variables`="' + HandlerData.Session.Text
     99      SqlDatabase.Query(DbRows2, 'UPDATE `HTTPSession` SET `Variables`="' + HandlerData.Session.Text
    97100        + '", `Time` = NOW() WHERE `Identification`="' + HandlerData.SessionId + '"')
    98     else DbRows2 := SqlDatabase.Query('INSERT INTO `HTTPSession` (`Time`,  `Variables`, `Identification`) VALUES (' +
     101    else SqlDatabase.Query(DbRows2, 'INSERT INTO `HTTPSession` (`Time`,  `Variables`, `Identification`) VALUES (' +
    99102    'NOW(), "' + HandlerData.Session.Text + '", "' + HandlerData.SessionId + '")');
    100103    HandlerData.Response.Cookies.Values[SessionIdCookieName] := HandlerData.SessionId;
Note: See TracChangeset for help on using the changeset viewer.