- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
function TMyDb.getUserItemsINTOMarkt(userid: Int64; marktid: String): SOString;
var
Query : TZQuery;
begin
Result := '';
try
lock;
Query := TZQuery.Create(nil);
if not isConnected() then
connect();
Query.Connection := SQLCon;
Query.SQL.TEXT:='SELECT mi.markt_id, mi.price, mi.item_id,ui.used_limit,'+
'ui.max_limit,ui.inv_id,ui.inv_min_damage, ui.inv_max_damage,'+
'ui.inv_options,ui.inv_bonuses,ui.inv_mods,ui.modifed,'+
'i.name FROM bkheroes.markt_items mi '+
'JOIN user_inventory ui ON mi.user_id='+IntToStr(userid)+' AND '+
'mi.user_inv_id=ui.inv_id AND mi.markt_id='''+marktid+
''' AND ui.userSellItem=''yes'' JOIN items i ON i.id=mi.item_id';
if SQLCon.Connected = True then
begin
Query.Open;
if Query.RecordCount > 0 then
begin
while not Query.EOF do
begin
Result := Result+'{"marktid":'+Query.FieldByName('markt_id').AsString+
',"inv_id":'+Query.FieldByName('inv_id').AsString+
',"price":'+Query.FieldByName('price').AsString+
',"itemid":'+Query.FieldByName('item_id').AsString+
',"used_limit":'+Query.FieldByName('used_limit').AsString+
',"max_limit":'+Query.FieldByName('max_limit').AsString+
',"min_damage":'+Query.FieldByName('inv_min_damage').AsString+
',"max_damage":'+Query.FieldByName('inv_max_damage').AsString+
',"options":'+explodeParams(query.FieldByName('inv_options').AsString,',',':').AsString+
',"bonuses":'+explodeParams(Query.FieldByName('inv_bonuses').AsString,',',':').AsString+
',"mods":'+explodeParams(Query.FieldByName('inv_mods').AsString,',',':').AsString+
',"modifed":"'+Query.FieldByName('modifed').AsString+
'","name":"'+Query.FieldByName('name').AsString+'"},';
query.Next;
end;
end;
Result:='{"marktid":'+marktid+',"items":['+Copy(Result,1,Length(Result)-1)+']}';
end;
TLogger.GeneralLog('getUserItemsINTOMarkt: '+Result,'TMyDBUnit',ltTrace);
finally
Query.Close;
Query.Free;
unlock;
end;
end;
О боже! Как можено такое писать за деньги? Да вообще, как можно писать такое??