I am attempting to use SPOD via record-macros in neko. When I use sys.db.Types.SEnum (for example to set a value on a new object to be inserted into the database), the generated SQL query does not include that field. In the example below I initialise a SpodRec with someInt : SInt = 4 and val : SEnum = value1, but when I attempt to insert the record, the generated SQL is INSERT INTO SpodRec (someInt) VALUES (4)
where I would expect it to be INSERT INTO SpodRec (someInt, val) VALUES (4,0)
or similar. Am I using this incorrectly?
class SpodTest {
public static function main(){
trace("SpodTesting");
var cnx = sys.db.Sqlite.open("spodtest.db");
sys.db.Manager.cnx = cnx;
sys.db.Manager.initialize();
//Create the SpodRec table
if ( !sys.db.TableCreate.exists( SpodRec.manager ) )
sys.db.TableCreate.create( SpodRec.manager );
var mySpodRec = new SpodRec();
mySpodRec.someInt = 4;
mySpodRec.val = value1;
mySpodRec.insert();
}
}
class SpodRec extends sys.db.Object {
public var id : sys.db.Types.SId;
public var someInt : sys.db.Types.SInt;
public var val : sys.db.Types.SEnum<MyEnum>;
}
enum MyEnum {
value1;
value2;
value3;
}
Output:
SpodTest.hx:5: SpodTesting
Called from ? line 1
Called from SpodTest.hx line 17
Called from sys/db/Object.hx line 53
Called from sys/db/Manager.hx line 199
Called from sys/db/Manager.hx line 441
Called from /usr/share/haxe/std/neko/_std/sys/db/Sqlite.hx line 40
Uncaught exception - Error while executing INSERT INTO SpodRec (someInt) VALUES (4) (Sqlite error : SQL logic error)
Versions:
record-macros 1.0.0-alpha
haxe 3.4.7
neko 2.2.0