Created
December 15, 2013 15:18
-
-
Save kyubuns/7974206 to your computer and use it in GitHub Desktop.
(>_<。) haxe3.0.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys.db.Types; | |
class User extends sys.db.Object { | |
public var id : SId; | |
public var name : SString<32>; | |
public var birthday : SDate; | |
public var phoneNumber : SNull<SText>; | |
} | |
class OrmTest { | |
public static function main() { | |
trace("==== test start ===="); | |
// connect database | |
var cnx = sys.db.Mysql.connect({ | |
host : "localhost", | |
port : null, | |
user : "user", | |
pass : "", | |
database : "test", | |
socket : null, | |
}); | |
sys.db.Manager.cnx = cnx; | |
// get | |
var a = User.manager.get(1); | |
if(a == null) trace("user not found"); | |
//OrmTest.hx:26: characters 10-26 : #OrmTest has no field User | |
/* | |
// これだと動く | |
var tmp = User.manager; | |
var a = tmp.get(1); | |
if(a == null) trace("user not found"); | |
*/ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment