ID:270880
 
while(qry.NextRow())
if(qry.item[1])

What does NextRow() do and return?
What would qry.item[1] have in it?

For example if I were to send a select query to get data. Then the results would be in item right? But what if there was no result from the select query. Is item null then? Is item[1] null? Does item[1] even exists? Would item[1] being sent over a text string to the user as output cause an unknown error and make the string not be sent?

Example
usr << "Data: [qry.item[1]]" // Sends nothing...
usr << "Data: [isnull(qry.item[1])]" // Sends nothing...
// BUT
usr << "Data: [isnull(qry.item)]" // Results in Data: 0


That is what I get when I send a select query that results in nothing. So deoes sending any list data that isn't there like lstone[22002] shut down the string from being sent?

Thanks for any help. This DB lib is kidna confusing with the little information they have on it.
I think qry.NextRow() will return 0 when it tries to go to the next row, but nothing's there.
Like any other language you have to loop over the MySQL rows to get the information from them. I wrote a GetColumnData() proc for the DB library so you don't have to access the information by number.
while(qry.NextRow())
var/list/data = qry.GetColumnData()
src << "Some data: [data["somedata"]]"


That'll tell you the information 'somedata' contains within the selected row.


NextRow() returns a list of columns, or 0 if nothing is found, qry.item[1] would have the data from the first column found in it.