Hi,
Firstly sorry for waste of your time.
Sqlite working in thread very good.

here is the thread execute procedure.

Thanks. (specially luiz)


procedure TMyThread.Execute;
var
ping: TPingSend;
record_id : integer;
type_name, server_ip, result_string : String;
tablo: TSqlite3Dataset;

begin
record_id:= main.id;
result_string:='default';
server_ip:='default';

try
tablo:=TSqlite3Dataset.Create(Nil);
tablo.FileName:='db/services.db';
tablo.SQL:= 'select type_name, server_ip from servers where id='+
inttostr( record_id) ;
tablo.Active:=True;
type_name:= tablo.FieldByName('type_name').AsString;
server_ip:= tablo.FieldByName('server_ip').AsString;
except
main.StatusBar1.SimpleText:='thread1'+tablo.SqliteReturnString+tablo.SQL;
end;

//Controlling by type
//ping
if (type_name='ping') and (server_ip<>'default')  then
begin
     ping:=TPingSend.Create;
     try
        ping.ping(server_ip);
        result_string:= result_string +' - '+ IntTostr(ping.pingtime)+'ms';
     finally
        ping.Free;
     end;
end;

if result_string<>'default' then
begin
  try
   tablo.ExecSQL( 'update servers set status="'+ result_string +'" where
id='+ inttostr( record_id) );
  except
  main.StatusBar1.SimpleText:='thread2'+tablo.SqliteReturnString;
  end;
end;


tablo.Close;
tablo.Free;

end;


_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to