Prev | Current Page 546 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

Now, you could opt to provide an alias
for the values returned from these functions, thus facilitating a column name, but haXe provides an
alternative option using the getResult , getIntResult , and getFloatResult methods that can be just
as effective.
Each of these methods accepts an integer value that represents the index of the item in the returned
record, where zero is the first item. Then, depending on the specified method, it will return the value
contained in that index. If the value stored at the given location is not of the type returned by the
method, then it will attempt to convert the value. This is fine if you want to convert an integer to a float
or a string, but can have unexpected results if, say, it converted a string to an integer:
class DBQuery
{
public static function main()
{
var dbLoc = ???Wrox.db3???;
var dbPop = query( dbLoc );
}
public static function query( loc : String )
{
// open the connection
var cnx = neko.db.Sqlite.open( loc );
// execute the request
var rec = cnx.


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