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));
- row := mysql_fetch_row(res);
- while row <> nil do
- begin
- it := T.LoopIteration(loop_name);
- for index := 0 to (field_count-1) do
- begin
- LogInfo(IntToStr(index) + '(' + fields[index].name + ') ="' + row[index] + '"');
- it.SetValue(fields[index].name, row[index]);
- end;
- Query := Query + 1;
- row := mysql_fetch_row(res);
- end;
- CloseQuery(res);
- end;
Add Comment
Please, Sign In to add comment