Prev | Current Page 547 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

request( ???SELECT var_username FROM Author??? );
// retrieve data as Float, Int and String
var f : Float = rec.getFloatResult( 0 );
var i : Int = rec.getIntResult( 0 );
var s : String = rec.getResult( 0 );
// trace the results
trace( f + ???:??? + i + ???:??? + s );
// close the connection
cnx.close();
}
}
When compiled and run, this class printed out the values:
0:0:James
Of course, your output may differ depending on the content in your database.
The nfields Property
When accessing data in a ResultSet , you might not be 100 percent sure of the structure of the data you
have queried. For example, the SQL string you passed to the request method might be accessing a table
where little is known of its content, while at the same time, it could be imperative that the information is
rendered in its entirety.
285
Chapter 11: Performing Server-Side Trickery
For such occasions, the ResultSet provides an nfields property that enables the developer to query
the exact number of columns returned by the request .


Pages:
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559