O'Reilly logo

haXe 2 by Benjamin Dasnois

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The SPOD

SPOD stands for Simple Persistence Objects Database. It is a functionality of the library to allow one to define objects in haXe and save and retrieve them easily from a database.

In fact, you will need to map haXe classes to tables in your database and you will be able to insert new records, delete them, update them, and search them.

Setting a SPOD object

To create objects that you will be able to use as SPOD objects, you have to create a class that extends neko.db.Object or php.db.Object.

Simply create the fields that exist in your table in the class as you would normally do:

class User extends neko.db.Object
{
public var id : Int;
public var userName : String;
public var password : String;
}

We will also need to define a manager; it will ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required