Prev | Current Page 536 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

db.ResultSet
Executes a given SQL statement and returns a ResultSet for any
records returned by the database
rollback() : Void Rolls back the current transaction
startTransaction() :
Void
Begins a new transaction for the current connection object
279
Chapter 11: Performing Server-Side Trickery
{
// open the database
var cnx = neko.db.Sqlite.open( loc );
// execute the ???create table??™ sql
cnx.request( ???CREATE TABLE Author (
int_id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
var_username TEXT NOT NULL,
var_password TEXT NOT NULL,
var_email TEXT NOT NULL,
dte_added DATETIME NOT NULL )??? );
// close the database connection
cnx.close();
}
}
You ??™ ll continue to use this database for the rest of the examples in this chapter, so go ahead and run the
code. As you can see, the code necessary to create a database is incredibly small when compared to other
so - say simple languages such as Visual Basic. In only three lines of code, the database was created and
opened, a table was added, and then the connection was closed with all resources released.


Pages:
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548