Prev | Current Page 545 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

This means that,
providing you know the column name or alias specified for a particular field of data, you can access it as
though it were a member variable of an instance of a class. For example, supposing you were to execute
the following query:
var rec = cnx.request( ???SELECT * FROM Author ORDER BY var_username DESC LIMIT 1??? );
You could then access each of the data fields returned from the query execution like this:
neko.Lib.print( ???User : ??? + rec.var_username + ??? | Pass : ??? + rec.var_password );
284
Part II: Server Side, JavaScript, and Flash: Oh My!
The data appended to the ResultSet in this fashion can also be accessed using reflection or through an
iterator in much the same way as other objects, though the ResultSet does provide the necessary
methods required to treat the ResultSet itself as an iterator.
Accessing Fields by Index
Very often, you will execute queries that do not provide a field name for one or more returned values,
such as when an aggregate function like count or sum is used.


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