Hello Guest

Work with getHistoryByQuery function

  • 2 Replies
  • 185 Views
*

Anakyl

  • **
  • 12
  • +1/-0
    • View Profile
Work with getHistoryByQuery function
« on: May 06, 2019, 06:35:26 pm »
Hello,

I'm trying to use getHistoryByQuery in script but i dont know exactly what i can do. I wrote simple query for testing but it doesnt work.

Code: [Select]
temp = getHistoryByQuery("SELECT lucky FROM bet ORDER BY betid DESC LIMIT 50")
for i = 1, #temp do
print(temp[i])
end

Can you take a look and fix it, seuntjie.

Thank you.

*

Seuntjie

  • *****
  • 323
  • +5/-2
    • View Profile
Re: Work with getHistoryByQuery function
« Reply #1 on: May 06, 2019, 09:47:03 pm »
the getbethistory functions all get an array of bet objects from the database, so you always need to select every column.



Code: [Select]
temp = getHistoryByQuery('SELECT * FROM bet ORDER BY betid DESC LIMIT 50'")

I'm don't use sqlite often, so I'm not sure whether you use limit 50 or select top (50).

When attempting to print a value of a bet object, you need to specify the property to print

Code: [Select]
print(temp[i].Roll)

There's a UML of the bet class on https://bot.seuntjie.com/programmermode.aspx

*

Anakyl

  • **
  • 12
  • +1/-0
    • View Profile
Re: Work with getHistoryByQuery function
« Reply #2 on: May 07, 2019, 05:22:09 am »
It works great. Thank you.