1

I am using LuaSQL, and query for a result set using con:execute(sql_stmt), which returns a cursor.

How do I see if there is at least one row in that resultset, without doing a cursor:fetch to pop that first row?

RBerteig
  • 41,948
  • 7
  • 88
  • 128
Neil
  • 7,042
  • 9
  • 43
  • 78

1 Answers1

2

From the doc it appears you can use cur:numrows() if you are using MySQL, PostgreSQL, or Oracle:

cur:numrows() See also: cursor objects Returns: the number of rows in the query result.

dcp
  • 54,410
  • 22
  • 144
  • 164
  • Thanks. I'm using an odbc driver to a MySQL database. numrows() didn't work for me. – Neil May 06 '10 at 19:04