Hi Guys,
Thank you all so much for the response so far.
And yes I use the FreeSWITCH Database Handler (freeswitch.dbh) which allows connection from my lua script.
I can get results fine, its just ensuring as soon as I get a match based on month and day of month that I break out of the function which is returning the results, as looking at previous freeswitch related posts I have seen;
You can pass a function as second argument to dbh:query, like so:
dbh = freeswitch.Dbh(odbc_dsn, odbc_user, odbc_pass)
dbh:query("select * from some_table", function(row) -- here it
loops through all rows
for key, val in pairs(row) do -- here it
loops through all columns
stream:write(string.format("%25s : %s\n", key, val))
end
stream:write("\n")
end))
This will run the anonymous function for each row, where each
iteration of the function will be passed a row in the form of a table.
Each row (table) will have the following syntax:
{ ["column_name_1"] = "row_value_1", ["column_name_2" = "row_value_2" }
So I thought it made sense to go to you Lua guru's to give me some pointers, as the documentation is none existent in terms of how you can control/break out of this function if you were to get a match.
Hope this makes sense!
Thanks again
Jon