Prev | Current Page 532 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

db.Sqlite.open( ???mydatabase.db3??? );
If the SQLite database file does not exist when trying to open it, then the file is automatically created.
However, if you do not want the database to be automatically created upon failing to locate the file, you
can use the Neko filesystem classes to detect the file ??™ s existence before making the call. Filesystem
manipulation will be discussed later in this chapter.
Connecting to a Postgre SQL Database
The PostgreSQL connection works in a very similar way to the SQLite connection. The only visible
difference, aside from the different database class name, is that instead of accepting the location of the
database, it expects a valid PostgreSQL connection string:
var connStr = ???dbname=simpledb user=Lee???;
var conn = neko.db.Postgresql.open( connStr );
You can check if the connection was unsuccessful by comparing the return value with null .
Connecting to a My SQL Database
The MySQL database connection also requires a single parameter, though it is an equivalent of passing
six.


Pages:
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544