Recent

Author Topic: program start normally, then hang and close, Z connection  (Read 4880 times)

Kevinn33

  • New Member
  • *
  • Posts: 26
Re: program start normally, then hang and close, Z connection
« Reply #15 on: May 13, 2018, 04:22:22 pm »
In the case of a RaspberryPi 3 that means it runs one core at 100%. Since that is also your GUI core that is not a good idea. Your code (or Zeos!) is still not good. Look at the pointers getmem gave you: he has more experience withe Zeos, I guess. I abandoned it after too many problems and use the basic standard components. These are stable, even over multiple threads. Written on RPi3...

the company that i used to do internship tell me to use Zeos, so that's the reason i use zeos lib. I tought Lazarus don't have any package to connect MySQL. Now i used to it, so i use it for my final project at univ.

You should post a small demo application(database included) so we can run a few test. Unfortunately I don't have a raspberry, but the problem is more likely somewhere else.

how to do that? i mean  the small demo application with database included
Where is your TDataSource?
is this necessary? i'm beginner so don't know much. it used to have datasource, but then i eleminate it and it doesnt take much affect

Kevinn33

  • New Member
  • *
  • Posts: 26
Re: program start normally, then hang and close, Z connection
« Reply #16 on: May 13, 2018, 05:42:11 pm »
looks like i narrowed the problem.
i tried to  comment my program one by one  using //.
then i found my program work without problem when i // this procedure
Code: Pascal  [Select][+][-]
  1. procedure TFSewaan.cekloker;
  2. begin
  3.   //cek isiloker
  4.    zquery1.close;
  5.    zquery1.SQL.Clear;
  6.    zquery1.SQL.add('select * from uji1 where Noloker = 1 order by Tanggal desc limit 1');
  7.    zquery1.open;
  8.    while not zquery1.EOF do begin
  9.     data1:=zquery1.FieldByName('Isiloker').AsInteger;
  10.     zquery1.Next;
  11.    end;
  12.    zquery1.close;
  13.    zquery1.SQL.Clear;
  14.    zquery1.SQL.add('select * from uji1 where Noloker = 2 order by Tanggal desc limit 1');
  15.    zquery1.open;
  16.    while not zquery1.EOF do begin
  17.     data2:=zquery1.FieldByName('Isiloker').AsInteger;
  18.     zquery1.Next;
  19.    end;
  20.    zquery1.close;
  21.    zquery1.SQL.Clear;
  22.    zquery1.SQL.add('select * from uji1 where Noloker = 3 order by Tanggal desc limit 1');
  23.    zquery1.open;
  24.    while not zquery1.EOF do begin
  25.     data3:=zquery1.FieldByName('Isiloker').AsInteger;
  26.     zquery1.Next;
  27.    end;
  28.    zquery1.close;
  29.    zquery1.SQL.Clear;
  30.    zquery1.SQL.add('select * from uji1 where Noloker = 4 order by Tanggal desc limit 1');
  31.    zquery1.open;
  32.    while not zquery1.EOF do begin
  33.     data4:=zquery1.FieldByName('Isiloker').AsInteger;
  34.     zquery1.Next;
  35.    end;
  36.    zquery1.close;
  37.    zquery1.SQL.Clear;
  38.    zquery1.SQL.add('select * from uji1 where Noloker = 5 order by Tanggal desc limit 1');
  39.    zquery1.open;
  40.    while not zquery1.EOF do begin
  41.     data5:=zquery1.FieldByName('Isiloker').AsInteger;
  42.     zquery1.Next;
  43.    end;
  44.    zquery1.close;
  45. end;
seems like its the pascal code nature. as i research and learn about pascal code execute each row in the same time  , not like C++ that execute 1 by 1 from start to end of the program , Correct me if i am wrong :) @getmem

 

TinyPortal © 2005-2018