Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Query(const sql : string; const loop_name : string;
- const T : TTemplate) : Integer;
- var
- res : PMYSQL_RES;
- row : MYSQL_ROW;
- fields : PMYSQL_FIELD;
- it : TTemplate;
- index, field_count : integer;
- begin
- Query := 0;
- res := Query(PChar(sql), field_count);
- if res = nil then Exit;
- fields := mysql_fetch_fields(res);
- LogInfo('SQL = ' + sql);
- LogInfo('Field count = ' + IntToStr(field_count));
- for index := 0 to (field_count-1) do
- LogError('Fn='+fields[index].name);
- row := mysql_fetch_row(res);
- while row <> nil do
- begin
- row := mysql_fetch_row(res);
- end;
- CloseQuery(res);
- end;
- (* OUTPUT:
- [2006-09-30 19:53:58.911 Info] SQL = SELECT id,name FROM companies ORDER BY lower(name)
- [2006-09-30 19:53:58.912 Info] Field count = 2
- [2006-09-30 19:53:58.912 Error] Fn=id
- [2006-09-30 19:53:58.912 Error] Fn=?????????
- ?$?t$?։˺
- *)
Add Comment
Please, Sign In to add comment