It allows you to execute all
of your SQL strings against the connected database, whether it returns a value or not. You will need to
make sure that the SQL you are passing to the request method is suitable for the database you are
connected to, though it is possible to write SQL that is acceptable by either of the supported databases.
Creating a Table
The first time a database is created, you will need to define its structure. Performing this within haXe can
be very useful, especially if your application is distributed to end users using the SQLite database. This
way, you can create your database when your application is first run, reducing the number of files to be
distributed.
Here is an example creating a new database called Wrox.db3 and populating it with a table called Author:
class CreateDB
{
public static function main()
{
var dbLoc = ???Wrox.db3???;
var dbFactory = create( dbLoc );
}
public static function create( loc : String )
Table 11-2
Method Description
close() : Void Closes the current connection
commit() : Void Commits the current transaction
dbName() : String Returns the name of the currently connected database
escape( s : String ) :
String
Escapes illegal characters in the passed String value
lastInsertId() : Int Returns the last inserted record id
quote( s : String ) :
String
Performs the escape method on the passed String value, then surrounds
it with single quote characters
request( sql : String ) :
neko.
Pages:
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547