I have recently read about how cursors should be avoided. Well, I would like to know if my usage of them is appropriate.
I am creating a scripting engine that will work online(embedded in a page, server-side) This scripting engine will be used by "advanced" end users of this product. The product works very heavily with the database however, and the scripting language is C-like, but simplified to where it also resembles PHP. For databases I basically want a syntax like this, as it is the most consistent syntax creatable within the language without the end user having to hand write SQL code(if we are going to make them do that, why can't they just skip the scripting engine as its there to make life simpler). The syntax is something like this:
declare DataSet $data("tablename","OtherID="+$oid);
//Dataset(string tablename,string where_clause_addon)
$data["field1"]="the data of field... ";
$data.Next();
$data["field1"]="The data of the next row";
$data[10]["field1"]="The data of the 10th row";
I control this internally by creating a global cursor for each DataSet (I only use 1 connection in the application) and then letting the global cursor keep track of the current row position(its a SCROLL and UPDATE cursor also). This makes my life much simpler as otherwise I would be forced to write my own SQL controls to combat .Net's sucky DataReader.
Is this usage of cursors an OK one? Note that the page with these scripts will not be world wide accessible, its only for clients(so probably only like 3-10 users at once).
Does anyone see a better method of keeping track of the current variable location? (as these are able to address tables of unknown schema)
Also, would I have any problems with concurrency using cursors like this? (My docs say cursors are global to the connection, and each page request makes a new connection on the spot, so users aren't sharing connections)