Guest User

Untitled

a guest
Feb 20th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. function Query(const sql : string; const loop_name : string;
  2. const T : TTemplate) : Integer;
  3. var
  4. res : PMYSQL_RES;
  5. row : MYSQL_ROW;
  6. fields : PMYSQL_FIELD;
  7. it : TTemplate;
  8. index, field_count : integer;
  9. begin
  10. Query := 0;
  11. res := Query(PChar(sql), field_count);
  12. if res = nil then Exit;
  13. fields := mysql_fetch_fields(res);
  14.  
  15. LogInfo('SQL = ' + sql);
  16. LogInfo('Field count = ' + IntToStr(field_count));
  17.  
  18. for index := 0 to (field_count-1) do
  19. LogError('Fn='+fields[index].name);
  20.  
  21. row := mysql_fetch_row(res);
  22. while row <> nil do
  23. begin
  24. row := mysql_fetch_row(res);
  25. end;
  26.  
  27. CloseQuery(res);
  28. end;
  29.  
  30. (* OUTPUT:
  31. [2006-09-30 19:53:58.911 Info] SQL = SELECT id,name FROM companies ORDER BY lower(name)
  32. [2006-09-30 19:53:58.912 Info] Field count = 2
  33. [2006-09-30 19:53:58.912 Error] Fn=id
  34. [2006-09-30 19:53:58.912 Error] Fn=?????????
  35. ?$?t$?։˺
  36. *)
Add Comment
Please, Sign In to add comment