Browse Source

remove SPOD (#6115)

* remove SPOD

* mention SPOD removal in CHANGES.txt [skip ci]
Dan Korostelev 8 years ago
parent
commit
fe3e5d46f3

+ 4 - 0
extra/CHANGES.txt

@@ -4,6 +4,10 @@
 
 	js : improved generation of `break` inside `switch` inside loops (#4964)
 
+	Removals:
+
+	all : SPOD (sys.db.Object, sys.db.Manager and friends) was moved into a separate library `record-macros` (https://github.com/HaxeFoundation/record-macros)
+
 2017-03-20: 3.4.2
 
 	Bugfixes:

File diff suppressed because it is too large
+ 0 - 45
std/sys/db/Manager.hx


+ 0 - 77
std/sys/db/Object.hx

@@ -1,77 +0,0 @@
-/*
- * Copyright (C)2005-2017 Haxe Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-package sys.db;
-
-/**
-	Record Object : the persistent object base type. See the tutorial on Haxe
-	website to learn how to use Record.
-**/
-@:keepSub
-@:autoBuild(sys.db.RecordMacros.macroBuild()) @:skipFields
-@:deprecated("This class will be removed soon, please install the record-macros library")
-class Object {
-
-	var _lock(default,never) : Bool;
-	var _manager(default,never) : sys.db.Manager<Dynamic>;
-#if !neko
-	@:keep var __cache__:Dynamic;
-#end
-
-	public function new() {
-		#if !neko
-		if( _manager == null ) untyped _manager = __getManager();
-		#end
-	}
-
-#if !neko
-	private function __getManager():sys.db.Manager<Dynamic>
-	{
-		var cls:Dynamic = Type.getClass(this);
-		return cls.manager;
-	}
-#end
-
-	public function insert() {
-		untyped _manager.doInsert(this);
-	}
-
-	public function update() {
-		untyped _manager.doUpdate(this);
-	}
-
-	public function lock() {
-		untyped _manager.doLock(this);
-	}
-
-	public function delete() {
-		untyped _manager.doDelete(this);
-	}
-
-	public function isLocked() {
-		return _lock;
-	}
-
-	public function toString() : String {
-		return untyped _manager.objectToString(this);
-	}
-
-}

+ 0 - 89
std/sys/db/RecordInfos.hx

@@ -1,89 +0,0 @@
-/*
- * Copyright (C)2005-2017 Haxe Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-package sys.db;
-
-@:deprecated("This class will be removed soon, please install the record-macros library")
-enum RecordType {
-	DId;
-	DInt;
-	DUId;
-	DUInt;
-	DBigId;
-	DBigInt;
-	DSingle;
-	DFloat;
-	DBool;
-	DString( n : Int );
-	DDate;
-	DDateTime;
-	DTimeStamp;
-	DTinyText;
-	DSmallText;
-	DText;
-	DSmallBinary;
-	DLongBinary;
-	DBinary;
-	DBytes( n : Int );
-	DEncoded;
-	DSerialized;
-	DNekoSerialized;
-	DFlags( flags : Array<String>, autoSize : Bool );
-	DTinyInt;
-	DTinyUInt;
-	DSmallInt;
-	DSmallUInt;
-	DMediumInt;
-	DMediumUInt;
-	DData;
-	DEnum( name : String );
-	// specific for intermediate calculus
-	DInterval;
-	DNull;
-}
-
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef RecordField = {
-	var name : String;
-	var t : RecordType;
-	var isNull : Bool;
-}
-
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef RecordRelation = {
-	var prop : String;
-	var key : String;
-	var type : String;
-	var module : String;
-	var cascade : Bool;
-	var lock : Bool;
-	var isNull : Bool;
-}
-
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef RecordInfos = {
-	var name : String;
-	var key : Array<String>;
-	var fields : Array<RecordField>;
-	var hfields : Map<String,RecordField>;
-	var relations : Array<RecordRelation>;
-	var indexes : Array<{ keys : Array<String>, unique : Bool }>;
-}

+ 0 - 1428
std/sys/db/RecordMacros.hx

@@ -1,1428 +0,0 @@
-/*
- * Copyright (C)2005-2017 Haxe Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-package sys.db;
-import sys.db.RecordInfos;
-import haxe.macro.Expr;
-import haxe.macro.Type.VarAccess;
-#if macro
-import haxe.macro.Context;
-using haxe.macro.TypeTools;
-#end
-using Lambda;
-
-private typedef SqlFunction = {
-	var name : String;
-	var params : Array<RecordType>;
-	var ret : RecordType;
-	var sql : String;
-}
-
-@:deprecated("This class will be removed soon, please install the record-macros library")
-class RecordMacros {
-
-	static var GLOBAL = null;
-	static var simpleString = ~/^[A-Za-z0-9 ]*$/;
-
-	var isNull : Bool;
-	var manager : Expr;
-	var inf : RecordInfos;
-	var g : {
-		var cache : haxe.ds.StringMap<RecordInfos>;
-		var types : haxe.ds.StringMap<RecordType>;
-		var functions : haxe.ds.StringMap<SqlFunction>;
-	};
-
-	function new(c) {
-		if( GLOBAL != null )
-			g = GLOBAL;
-		else {
-			g = initGlobals();
-			GLOBAL = g;
-		}
-		inf = getRecordInfos(c);
-	}
-
-	function initGlobals()
-	{
-		var cache = new haxe.ds.StringMap();
-		var types = new haxe.ds.StringMap();
-		for( c in Type.getEnumConstructs(RecordType) ) {
-			var e : Dynamic = Reflect.field(RecordType, c);
-			if( Std.is(e, RecordType) )
-				types.set("S"+c.substr(1), e);
-		}
-		types.remove("SNull");
-		var functions = new haxe.ds.StringMap();
-		for( f in [
-			{ name : "now", params : [], ret : DDateTime, sql : "NOW($)" },
-			{ name : "curDate", params : [], ret : DDate, sql : "CURDATE($)" },
-			{ name : "seconds", params : [DFloat], ret : DInterval, sql : "INTERVAL $ SECOND" },
-			{ name : "minutes", params : [DFloat], ret : DInterval, sql : "INTERVAL $ MINUTE" },
-			{ name : "hours", params : [DFloat], ret : DInterval, sql : "INTERVAL $ HOUR" },
-			{ name : "days", params : [DFloat], ret : DInterval, sql : "INTERVAL $ DAY" },
-			{ name : "months", params : [DFloat], ret : DInterval, sql : "INTERVAL $ MONTH" },
-			{ name : "years", params : [DFloat], ret : DInterval, sql : "INTERVAL $ YEAR" },
-			{ name : "date", params : [DDateTime], ret : DDate, sql : "DATE($)" },
-		])
-			functions.set(f.name, f);
-		return { cache : cache, types : types, functions : functions };
-	}
-
-	public dynamic function error( msg : String, pos : Position ) : Dynamic {
-		#if macro
-		Context.error(msg, pos);
-		#else
-		throw msg;
-		#end
-		return null;
-	}
-
-	public dynamic function typeof( e : Expr ) : haxe.macro.Type {
-		#if macro
-		return Context.typeof(e);
-		#else
-		throw "not implemented";
-		return null;
-		#end
-	}
-
-	public dynamic function follow( t : haxe.macro.Type, ?once ) : haxe.macro.Type {
-		#if macro
-		return Context.follow(t,once);
-		#else
-		throw "not implemented";
-		return null;
-		#end
-	}
-
-	public dynamic function getManager( t : haxe.macro.Type, p : Position ) : RecordMacros {
-		#if macro
-		return getManagerInfos(t, p);
-		#else
-		throw "not implemented";
-		return null;
-		#end
-	}
-
-	public dynamic function resolveType( name : String, ?module : String ) : haxe.macro.Type {
-		#if macro
-		if (module != null)
-		{
-			var m = Context.getModule(module);
-			for (t in m)
-			{
-				if (t.toString() == name)
-					return t;
-			}
-		}
-
-		return Context.getType(name);
-		#else
-		throw "not implemented";
-		return null;
-		#end
-	}
-
-	function makeInt( t : haxe.macro.Type ) {
-		switch( t ) {
-		case TInst(c, _):
-			var name = c.toString();
-			if( name.charAt(0) == "I" )
-				return Std.parseInt(name.substr(1));
-		default:
-		}
-		throw "Unsupported " + Std.string(t);
-	}
-
-	function makeRecord( t : haxe.macro.Type ) {
-		switch( t ) {
-		case TInst(c, _):
-			var name = c.toString();
-			var cl = c.get();
-			var csup = cl.superClass;
-			while( csup != null ) {
-				if( csup.t.toString() == "sys.db.Object" )
-					return c;
-				csup = csup.t.get().superClass;
-			}
-		case TType(t, p):
-			var name = t.toString();
-			if( p.length == 1 && (name == "Null" || name == "sys.db.SNull") ) {
-				isNull = true;
-				return makeRecord(p[0]);
-			}
-		default:
-		}
-		return null;
-	}
-
-	function getFlags( t : haxe.macro.Type ) {
-		switch( t ) {
-		case TEnum(e,_):
-			var cl = e.get().names;
-			if( cl.length > 1 ) {
-				var prefix = cl[0];
-				for( c in cl )
-					while( prefix.length > 0 && c.substr(0, prefix.length) != prefix )
-						prefix = prefix.substr(0, -1);
-				for( i in 0...cl.length )
-					cl[i] = cl[i].substr(prefix.length);
-			}
-			if( cl.length > 31 ) throw "Too many flags";
-			return cl;
-		default:
-			throw "Flags parameter should be an enum";
-		}
-	}
-
-	function makeType( t : haxe.macro.Type ) {
-		switch( t ) {
-		case TInst(c, _):
-			var name = c.toString();
-			return switch( name ) {
-			case "Int": DInt;
-			case "Float": DFloat;
-			case "String": DText;
-			case "Date": DDateTime;
-			case "haxe.io.Bytes": DBinary;
-			default: throw "Unsupported Record Type " + name;
-			}
-		case TAbstract(a, p):
-			var name = a.toString();
-			return switch( name ) {
-			case "Int": DInt;
-			case "Float": DFloat;
-			case "Bool": DBool;
-			case _ if (!a.get().meta.has(':coreType')):
-				var a = a.get();
-#if macro
-				makeType(a.type.applyTypeParameters(a.params, p));
-#else
-				makeType(a.type);
-#end
-			default: throw "Unsupported Record Type " + name;
-			}
-		case TEnum(e, _):
-			var name = e.toString();
-			return switch( name ) {
-			case "Bool": DBool;
-			default:
-				throw "Unsupported Record Type " + name + " (enums must be wrapped with SData or SEnum)";
-			}
-		case TType(td, p):
-			var name = td.toString();
-			if( StringTools.startsWith(name, "sys.db.") )
-				name = name.substr(7);
-			var k = g.types.get(name);
-			if( k != null ) return k;
-			if( p.length == 1 )
-				switch( name ) {
-				case "SString": return DString(makeInt(p[0]));
-				case "SBytes": return DBytes(makeInt(p[0]));
-				case "SNull", "Null": isNull = true; return makeType(p[0]);
-				case "SFlags": return DFlags(getFlags(p[0]),false);
-				case "SSmallFlags": return DFlags(getFlags(p[0]),true);
-				case "SData": return DData;
-				case "SEnum":
-					switch( p[0] ) {
-					case TEnum(en, _):
-						var e = en.get();
-						var count = 0, hasParam = false;
-						for( c in e.constructs ) {
-							count++;
-							switch( c.type ) {
-							case TFun(_):
-								hasParam = true;
-							default:
-							}
-						}
-						if( hasParam )
-							throw "You can't use SEnum if the enum have parameters, try SData instead";
-						if( count >= 256 )
-							throw "Too many enum constructors";
-						return DEnum(en.toString());
-					default:
-						// should cause another error
-					}
-				default:
-				}
-			return makeType(follow(t, true));
-		default:
-		}
-		throw "Unsupported Record Type " + Std.string(t);
-	}
-
-	function makeIdent( e : Expr ) {
-		return switch( e.expr ) {
-		case EConst(c):
-			switch( c ) {
-			case CIdent(s): s;
-			default: error("Identifier expected", e.pos);
-			}
-		default: error("Identifier expected", e.pos);
-		}
-	}
-
-	function getRecordInfos( c : haxe.macro.Type.Ref<haxe.macro.Type.ClassType> ) : RecordInfos {
-		var cname = c.toString();
-		var i = g.cache.get(cname);
-		if( i != null ) return i;
-		i = {
-			key : null,
-			name : cname.split(".").pop(), // remove package name
-			fields : [],
-			hfields : new haxe.ds.StringMap(),
-			relations : [],
-			indexes : [],
-		};
-		g.cache.set(cname, i);
-		var c = c.get();
-		var fieldsPos = new haxe.ds.StringMap();
-		var fields = c.fields.get();
-		var csup = c.superClass;
-		while( csup != null ) {
-			var c = csup.t.get();
-			if( !c.meta.has(":skipFields") )
-				fields = c.fields.get().concat(fields);
-			csup = c.superClass;
-		}
-		for( f in fields ) {
-			fieldsPos.set(f.name, f.pos);
-			switch( f.kind ) {
-			case FMethod(_):
-				// skip methods
-				continue;
-			case FVar(g, s):
-				// skip not-db fields
-				if( f.meta.has(":skip") )
-					continue;
-				// handle relations
-				if( f.meta.has(":relation") ) {
-					if( !Type.enumEq(g,AccCall) || !Type.enumEq(s,AccCall) )
-						error("Relation should be (dynamic,dynamic)", f.pos);
-					for( m in f.meta.get() ) {
-						if( m.name != ":relation" ) continue;
-						if( m.params.length == 0 ) error("Missing relation key", m.pos);
-						var params = [];
-						for( p in m.params )
-							params.push({ i : makeIdent(p), p : p.pos });
-						isNull = false;
-						var t = makeRecord(f.type);
-						if( t == null ) error("Relation type should be a sys.db.Object", f.pos);
-						var mod = t.get().module;
-						var r = {
-							prop : f.name,
-							key : params.shift().i,
-							type : t.toString(),
-							module : mod,
-							cascade : false,
-							lock : false,
-							isNull : isNull,
-						};
-						// setup flags
-						for( p in params )
-							switch( p.i ) {
-							case "lock": r.lock = true;
-							case "cascade": r.cascade = true;
-							default: error("Unknown relation flag", p.p);
-							}
-						i.relations.push(r);
-					}
-					continue;
-				}
-				switch( g ) {
-				case AccCall:
-					if( !f.meta.has(":data") )
-						error("Relation should be defined with @:relation(key)", f.pos);
-				default:
-				}
-			}
-			isNull = false;
-			var fi = {
-				name : f.name,
-				t : try makeType(f.type) catch( e : String ) error(e,f.pos),
-				isNull : isNull,
-			};
-			var isId = switch( fi.t ) {
-			case DId, DUId, DBigId: true;
-			default: i.key == null && fi.name == "id";
-			}
-			if( isId ) {
-				switch(fi.t)
-				{
-					case DInt:
-						fi.t = DId;
-					case DUInt:
-						fi.t = DUId;
-					case DBigInt:
-						fi.t = DBigId;
-					case _:
-				}
-				if( i.key == null ) i.key = [fi.name] else error("Multiple table id declaration", f.pos);
-			}
-			i.fields.push(fi);
-			i.hfields.set(fi.name, fi);
-		}
-		// create fields for undeclared relations keys :
-		for( r in i.relations ) {
-			var field = fields.find(function(f) return f.name == r.prop);
-			var f = i.hfields.get(r.key);
-			var relatedInf = getRecordInfos(makeRecord(resolveType(r.type, r.module)));
-			if (relatedInf.key.length > 1)
-				error('The relation ${r.prop} is invalid: Type ${r.type} has multiple keys, which is not supported',field.pos);
-			var relatedKey = relatedInf.key[0];
-			var relatedKeyType = switch(relatedInf.hfields.get(relatedKey).t)
-				{
-					case DId: DInt;
-					case DUId: DUInt;
-					case DBigId: DBigInt;
-					case t = DString(_): t;
-					case t: error('Unexpected id type $t for the relation. Use either SId, SInt, SUId, SUInt, SBigID, SBigInt or SString', field.pos);
-				}
-
-			if( f == null ) {
-				f = {
-					name : r.key,
-					t : relatedKeyType,
-					isNull : r.isNull,
-				};
-				i.fields.push(f);
-				i.hfields.set(f.name, f);
-			} else {
-				var pos = fieldsPos.get(f.name);
-				if( f.t != relatedKeyType) error("Relation source and field should have same type", pos);
-				if( f.isNull != r.isNull ) error("Relation and field should have same nullability", pos);
-			}
-		}
-		// process class metadata
-		for( m in c.meta.get() )
-			switch( m.name ) {
-			case ":id":
-				i.key = [];
-				for( p in m.params ) {
-					var id = makeIdent(p);
-					if( !i.hfields.exists(id) )
-						error("This field does not exists", p.pos);
-					i.key.push(id);
-				}
-				if( i.key.length == 0 ) error("Invalid :id", m.pos);
-				if (i.key.length == 1 )
-				{
-					var field = i.hfields.get(i.key[0]);
-					switch(field.t)
-					{
-						case DInt:
-							field.t = DId;
-						case DUInt:
-							field.t = DUId;
-						case DBigInt:
-							field.t = DBigId;
-						case _:
-					}
-				}
-			case ":index":
-				var idx = [];
-				for( p in m.params ) idx.push(makeIdent(p));
-				var unique = idx[idx.length - 1] == "unique";
-				if( unique ) idx.pop();
-				if( idx.length == 0 ) error("Invalid :index", m.pos);
-				for( k in 0...idx.length )
-					if( !i.hfields.exists(idx[k]) )
-						error("This field does not exists", m.params[k].pos);
-				i.indexes.push( { keys : idx, unique : unique } );
-			case ":table":
-				if( m.params.length != 1 ) error("Invalid :table", m.pos);
-				i.name = switch( m.params[0].expr ) {
-				case EConst(c): switch( c ) { case CString(s): s; default: null; }
-				default: null;
-				};
-				if( i.name == null ) error("Invalid :table value", m.params[0].pos);
-			default:
-			}
-		// check primary key defined
-		if( i.key == null )
-			error("Table is missing unique id, use either SId, SUId, SBigID or @:id", c.pos);
-		return i;
-	}
-
-	function quoteField( f : String ) {
-		var m : { private var KEYWORDS : haxe.ds.StringMap<Bool>; } = Manager;
-		return m.KEYWORDS.exists(f.toLowerCase()) ? "`"+f+"`" : f;
-	}
-
-	function initManager( pos : Position ) {
-		manager = { expr : EField({ expr : EField({ expr : EConst(CIdent("sys")), pos : pos },"db"), pos : pos }, "Manager"), pos : pos };
-	}
-
-	inline function makeString( s : String, pos ) {
-		return { expr : EConst(CString(s)), pos : pos };
-	}
-
-	inline function makeOp( op : String, e1, e2, pos ) {
-		return sqlAdd(sqlAddString(e1,op),e2,pos);
-	}
-
-	inline function sqlAdd( e1 : Expr, e2 : Expr, pos : Position ) {
-		return { expr : EBinop(OpAdd, e1, e2), pos : pos };
-	}
-
-	inline function sqlAddString( sql : Expr, s : String ) {
-		return { expr : EBinop(OpAdd, sql, makeString(s,sql.pos)), pos : sql.pos };
-	}
-
-	function sqlQuoteValue( v : Expr, t : RecordType, isNull : Bool ) {
-		switch( v.expr ) {
-		case EConst(c):
-			switch( c ) {
-			case CInt(_), CFloat(_): return v;
-			case CString(s):
-				if( simpleString.match(s) ) return { expr : EConst(CString("'"+s+"'")), pos : v.pos };
-			case CIdent(n):
-				switch( n ) {
-				case "null": return { expr : EConst(CString("NULL")), pos : v.pos };
-				case "true": return { expr : EConst(CString("TRUE")), pos : v.pos };
-				case "false": return { expr : EConst(CString("FALSE")), pos : v.pos };
-				}
-			default:
-			}
-		default:
-		}
-		return { expr : ECall( { expr : EField(manager, "quoteAny"), pos : v.pos }, [ensureType(v,t,isNull)]), pos : v.pos }
-	}
-
-	inline function sqlAddValue( sql : Expr, v : Expr, t : RecordType, isNull : Bool ) {
-		return { expr : EBinop(OpAdd, sql, sqlQuoteValue(v,t, isNull)), pos : sql.pos };
-	}
-
-	function unifyClass( t : RecordType ) {
-		return switch( t ) {
-		case DId, DInt, DUId, DUInt, DEncoded, DFlags(_), DTinyInt, DTinyUInt, DSmallInt, DSmallUInt, DMediumInt, DMediumUInt: 0;
-		case DBigId, DBigInt, DSingle, DFloat: 1;
-		case DBool: 2;
-		case DString(_), DTinyText, DSmallText, DText, DSerialized: 3;
-		case DDate, DDateTime, DTimeStamp: 4;
-		case DSmallBinary, DLongBinary, DBinary, DBytes(_), DNekoSerialized, DData: 5;
-		case DInterval: 6;
-		case DNull: 7;
-		case DEnum(_): -1;
-		};
-	}
-
-	function tryUnify( t, rt ) {
-		if( t == rt ) return true;
-		var c = unifyClass(t);
-		if( c < 0 ) return Type.enumEq(t, rt);
-		var rc = unifyClass(rt);
-		return c == rc || (c == 0 && rc == 1); // allow Int-to-Float expansion
-	}
-
-	function typeStr( t : RecordType ) {
-		return Std.string(t).substr(1);
-	}
-
-	function canStringify( t : RecordType ) {
-		return switch( unifyClass(t) ) {
-		case 0, 1, 2, 3, 4, 5, 7: true;
-		default: false;
-		};
-	}
-
-	function convertType( t : RecordType ) {
-		var pack = [];
-		return TPath( {
-			name : switch( unifyClass(t) ) {
-			case 0: "Int";
-			case 1: "Float";
-			case 2: "Bool";
-			case 3: "String";
-			case 4: "Date";
-			case 5: pack = ["haxe", "io"];  "Bytes";
-			default: throw "assert";
-			},
-			pack : pack,
-			params : [],
-			sub : null,
-		});
-	}
-
-	function unify( t : RecordType, rt : RecordType, pos : Position ) {
-		if( !tryUnify(t, rt) )
-			error(typeStr(t) + " should be " + typeStr(rt), pos);
-	}
-
-	function buildCmp( op, e1, e2, pos ) {
-		var r1 = buildCond(e1);
-		var r2 = buildCond(e2);
-		unify(r2.t, r1.t, e2.pos);
-		if( !tryUnify(r1.t, DFloat) && !tryUnify(r1.t, DDate) && !tryUnify(r1.t, DText) )
-			unify(r1.t, DFloat, e1.pos);
-		return { sql : makeOp(op, r1.sql, r2.sql, pos), t : DBool, n : r1.n || r2.n };
-	}
-
-	function buildNum( op, e1, e2, pos ) {
-		var r1 = buildCond(e1);
-		var r2 = buildCond(e2);
-		var c1 = unifyClass(r1.t);
-		var c2 = unifyClass(r2.t);
-		if( c1 > 1 ) {
-			if( op == "-" && tryUnify(r1.t, DDateTime) && tryUnify(r2.t,DInterval) )
-				return { sql : makeOp(op, r1.sql, r2.sql, pos), t : DDateTime, n : r1.n };
-			unify(r1.t, DInt, e1.pos);
-		}
-		if( c2 > 1 ) unify(r2.t, DInt, e2.pos);
-		return { sql : makeOp(op, r1.sql, r2.sql, pos), t : (c1 + c2) == 0 ? DInt : DFloat, n : r1.n || r2.n };
-	}
-
-	function buildInt( op, e1, e2, pos ) {
-		var r1 = buildCond(e1);
-		var r2 = buildCond(e2);
-		unify(r1.t, DInt, e1.pos);
-		unify(r2.t, DInt, e2.pos);
-		return { sql : makeOp(op, r1.sql, r2.sql, pos), t : DInt, n : r1.n || r2.n };
-	}
-
-	function buildEq( eq, e1 : Expr, e2, pos ) {
-		var r1 = null;
-		switch( e1.expr ) {
-		case EConst(c):
-			switch( c ) {
-			case CIdent(i):
-				if( i.charCodeAt(0) == "$".code ) {
-					var tmp = { field : i.substr(1), expr : e2 };
-					var f = getField(tmp);
-					r1 = { sql : makeString(quoteField(tmp.field), e1.pos), t : f.t, n : f.isNull };
-					e2 = tmp.expr;
-					switch( f.t ) {
-					case DEnum(e):
-						var ok = false;
-						switch( e2.expr ) {
-						case EConst(c):
-							switch( c ) {
-							case CIdent(n):
-								if( n.charCodeAt(0) == '$'.code )
-									ok = true;
-								else switch( resolveType(e) ) {
-								case TEnum(e, _):
-									var c = e.get().constructs.get(n);
-									if( c == null ) {
-										if( n == "null" )
-											return { sql : sqlAddString(r1.sql, eq ? " IS NULL" : " IS NOT NULL"), t : DBool, n : false };
-									} else {
-										return { sql : makeOp(eq?" = ":" != ", r1.sql, { expr : EConst(CInt(Std.string(c.index))), pos : e2.pos }, pos), t : DBool, n : r1.n };
-									}
-								default:
-								}
-							default:
-							}
-						default:
-						}
-						if( !ok )
-						{
-							var epath = e.split('.');
-							var ename = epath.pop();
-							var etype = TPath({ name:ename, pack:epath });
-							if (r1.n) {
-								return { sql: macro $manager.nullCompare(${r1.sql}, { var tmp = @:pos(e2.pos) (${e2} : $etype); tmp == null ? null : (std.Type.enumIndex(tmp) + ''); }, ${eq ? macro true : macro false}), t : DBool, n: true };
-							} else {
-								var expr = macro { @:pos(e2.pos) var tmp : $etype = $e2; (tmp == null ? null : (std.Type.enumIndex(tmp) + '')); };
-								return { sql: makeOp(eq?" = ":" != ", r1.sql, expr, pos), t : DBool, n : r1.n };
-							}
-						}
-					default:
-					}
-				}
-			default:
-			}
-		default:
-		}
-		if( r1 == null )
-			r1 = buildCond(e1);
-		var r2 = buildCond(e2);
-		if( r2.t == DNull ) {
-			if( !r1.n )
-				error("Expression can't be null", e1.pos);
-			return { sql : sqlAddString(r1.sql, eq ? " IS NULL" : " IS NOT NULL"), t : DBool, n : false };
-		} else {
-			unify(r2.t, r1.t, e2.pos);
-			unify(r1.t, r2.t, e1.pos);
-		}
-		var sql;
-		// use some different operators if there is a possibility for comparing two NULLs
-		if( r1.n || r2.n )
-			sql = { expr : ECall({ expr : EField(manager,"nullCompare"), pos : pos },[r1.sql,r2.sql,{ expr : EConst(CIdent(eq?"true":"false")), pos : pos }]), pos : pos };
-		else
-			sql = makeOp(eq?" = ":" != ", r1.sql, r2.sql, pos);
-		return { sql : sql, t : DBool, n : r1.n || r2.n };
-	}
-
-	function buildDefault( cond : Expr ) {
-		var t = typeof(cond);
-		isNull = false;
-		var d = try makeType(t) catch( e : String ) try makeType(follow(t)) catch( e : String ) error("Unsupported type " + Std.string(t), cond.pos);
-		return { sql : sqlQuoteValue(cond, d, isNull), t : d, n : isNull };
-	}
-
-	function getField( f : { field : String, expr : Expr } ) {
-		var fi = inf.hfields.get(f.field);
-		if( fi == null ) {
-			for( r in inf.relations )
-				if( r.prop == f.field ) {
-					var path = r.type.split(".");
-					var p = f.expr.pos;
-					path.push("manager");
-					var first = path.shift();
-					var mpath = { expr : EConst(CIdent(first)), pos : p };
-					for ( e in path )
-						mpath = { expr : EField(mpath, e), pos : p };
-					var m = getManager(typeof(mpath),p);
-					var getid = { expr : ECall( { expr : EField(mpath, "unsafeGetId"), pos : p }, [f.expr]), pos : p };
-					f.field = r.key;
-					f.expr = ensureType(getid, m.inf.hfields.get(m.inf.key[0]).t, r.isNull);
-					return inf.hfields.get(r.key);
-				}
-			error("No database field '" + f.field+"'", f.expr.pos);
-		}
-		return fi;
-	}
-
-	function buildCond( cond : Expr ) {
-		var sql = null;
-		var p = cond.pos;
-		switch( cond.expr ) {
-		case EObjectDecl(fl):
-			var first = true;
-			var sql = makeString("(", p);
-			var fields = new haxe.ds.StringMap();
-			for( f in fl ) {
-				var fi = getField(f);
-				if( first )
-					first = false;
-				else
-					sql = sqlAddString(sql, " AND ");
-				sql = sqlAddString(sql, quoteField(fi.name) + (fi.isNull ? " <=> " : " = "));
-				sql = sqlAddValue(sql, f.expr, fi.t, fi.isNull);
-				if( fields.exists(fi.name) )
-					error("Duplicate field " + fi.name, p);
-				else
-					fields.set(fi.name, true);
-			}
-			if( first ) sqlAddString(sql, "TRUE");
-			sql = sqlAddString(sql, ")");
-			return { sql : sql, t : DBool, n : false };
-		case EParenthesis(e):
-			var r = buildCond(e);
-			r.sql = sqlAdd(makeString("(", p), r.sql, p);
-			r.sql = sqlAddString(r.sql, ")");
-			return r;
-		case EBinop(op, e1, e2):
-			switch( op ) {
-			case OpAdd:
-				var r1 = buildCond(e1);
-				var r2 = buildCond(e2);
-				var rt = if( tryUnify(r1.t, DFloat) && tryUnify(r2.t, DFloat) )
-					tryUnify(r1.t, DInt) ? tryUnify(r2.t, DInt) ? DInt : DFloat : DFloat;
-				else if( (tryUnify(r1.t, DText) && canStringify(r2.t)) || (tryUnify(r2.t, DText) && canStringify(r1.t)) )
-					return { sql : sqlAddString(sqlAdd(sqlAddString(sqlAdd(makeString("CONCAT(",p),r1.sql,p),","),r2.sql,p),")"), t : DText, n : r1.n || r2.n }
-				else
-					error("Can't add " + typeStr(r1.t) + " and " + typeStr(r2.t), p);
-				return { sql : makeOp("+", r1.sql, r2.sql, p), t : rt, n : r1.n || r2.n };
-			case OpBoolAnd, OpBoolOr:
-				var r1 = buildCond(e1);
-				var r2 = buildCond(e2);
-				unify(r1.t, DBool, e1.pos);
-				unify(r2.t, DBool, e2.pos);
-				return { sql : makeOp(op == OpBoolAnd ? " AND " : " OR ", r1.sql, r2.sql, p), t : DBool, n : false };
-			case OpGte:
-				return buildCmp(">=", e1, e2, p);
-			case OpLte:
-				return buildCmp("<=", e1, e2, p);
-			case OpGt:
-				return buildCmp(">", e1, e2, p);
-			case OpLt:
-				return buildCmp("<", e1, e2, p);
-			case OpSub:
-				return buildNum("-", e1, e2, p);
-			case OpDiv:
-				var r = buildNum("/", e1, e2, p);
-				r.t = DFloat;
-				return r;
-			case OpMult:
-				return buildNum("*", e1, e2, p);
-			case OpEq, OpNotEq:
-				return buildEq(op == OpEq, e1, e2, p);
-			case OpXor:
-				return buildInt("^", e1, e2, p);
-			case OpOr:
-				return buildInt("|", e1, e2, p);
-			case OpAnd:
-				return buildInt("&", e1, e2, p);
-			case OpShr:
-				return buildInt(">>", e1, e2, p);
-			case OpShl:
-				return buildInt("<<", e1, e2, p);
-			case OpMod:
-				return buildNum("%", e1, e2, p);
-			case OpUShr, OpInterval, OpAssignOp(_), OpAssign, OpArrow:
-				error("Unsupported operation", p);
-			}
-		case EUnop(op, _, e):
-			var r = buildCond(e);
-			switch( op ) {
-			case OpNot:
-				var sql = makeString("!", p);
-				unify(r.t, DBool, e.pos);
-				switch( r.sql.expr ) {
-				case EConst(_):
-				default:
-					r.sql = sqlAddString(r.sql, ")");
-					sql = sqlAddString(sql, "(");
-				}
-				return { sql : sqlAdd(sql, r.sql, p), t : DBool, n : r.n };
-			case OpNegBits:
-				var sql = makeString("~", p);
-				unify(r.t, DInt, e.pos);
-				return { sql : sqlAdd(sql, r.sql, p), t : DInt, n : r.n };
-			case OpNeg:
-				var sql = makeString("-", p);
-				unify(r.t, DFloat, e.pos);
-				return { sql : sqlAdd(sql, r.sql, p), t : r.t, n : r.n };
-			case OpIncrement, OpDecrement:
-				error("Unsupported operation", p);
-			}
-		case EConst(c):
-			switch( c ) {
-			case CInt(s): return { sql : makeString(s, p), t : DInt, n : false };
-			case CFloat(s): return { sql : makeString(s, p), t : DFloat, n : false };
-			case CString(s): return { sql : sqlQuoteValue(cond, DText, false), t : DString(s.length), n : false };
-			case CRegexp(_): error("Unsupported", p);
-			case CIdent(n):
-				if( n.charCodeAt(0) == "$".code ) {
-					n = n.substr(1);
-					var f = inf.hfields.get(n);
-					if( f == null ) error("Unknown database field '" + n + "'", p);
-					return { sql : makeString(quoteField(f.name), p), t : f.t, n : f.isNull };
-				}
-				switch( n ) {
-				case "null":
-					return { sql : makeString("NULL", p), t : DNull, n : true };
-				case "true":
-					return { sql : makeString("TRUE", p), t : DBool, n : false };
-				case "false":
-					return { sql : makeString("FALSE", p), t : DBool, n : false };
-				}
-				return buildDefault(cond);
-			}
-		case ECall(c, pl):
-			switch( c.expr ) {
-			case EConst(co):
-				switch(co) {
-				case CIdent(t):
-					if( t.charCodeAt(0) == '$'.code ) {
-						var f = g.functions.get(t.substr(1));
-						if( f == null ) error("Unknown method " + t, c.pos);
-						if( f.params.length != pl.length ) error("Function " + f.name + " requires " + f.params.length + " parameters", p);
-						var parts = f.sql.split("$");
-						var sql = makeString(parts[0], p);
-						var first = true;
-						var isNull = false;
-						for( i in 0...f.params.length ) {
-							var r = buildCond(pl[i]);
-							if( r.n ) isNull = true;
-							unify(r.t, f.params[i], pl[i].pos);
-							if( first )
-								first = false;
-							else
-								sql = sqlAddString(sql, ",");
-							sql = sqlAdd(sql, r.sql, p);
-						}
-						sql = sqlAddString(sql, parts[1]);
-						// assume that for all SQL functions, a NULL parameter will make a NULL result
-						return { sql : sql, t : f.ret, n : isNull };
-					}
-				default:
-				}
-			case EField(e, f):
-				switch( f ) {
-				case "like":
-					if( pl.length == 1 ) {
-						var r = buildCond(e);
-						var v = buildCond(pl[0]);
-						if( !tryUnify(r.t, DText) ) {
-							if( tryUnify(r.t, DBinary) )
-								unify(v.t, DBinary, pl[0].pos);
-							else
-								unify(r.t, DText, e.pos);
-						} else
-							unify(v.t, DText, pl[0].pos);
-						return { sql : makeOp(" LIKE ", r.sql, v.sql, p), t : DBool, n : r.n || v.n };
-					}
-				case "has":
-					if( pl.length == 1 ) {
-						var r = buildCond(e);
-						switch( r.t ) {
-						case DFlags(vals,_):
-							var id = makeIdent(pl[0]);
-							var idx = Lambda.indexOf(vals,id);
-							if( idx < 0 ) error("Flag should be "+vals.join(","), pl[0].pos);
-							return { sql : sqlAddString(r.sql, " & " + (1 << idx) + " != 0"), t : DBool, n : r.n };
-						default:
-						}
-					}
-				}
-			default:
-			}
-			return buildDefault(cond);
-		case EField(_, _), EDisplay(_):
-			return buildDefault(cond);
-		case EIf(e, e1, e2), ETernary(e, e1, e2):
-			if( e2 == null ) error("If must have an else statement", p);
-			var r1 = buildCond(e1);
-			var r2 = buildCond(e2);
-			unify(r2.t, r1.t, e2.pos);
-			unify(r1.t, r2.t, e1.pos);
-			return { sql : { expr : EIf(e, r1.sql, r2.sql), pos : p }, t : r1.t, n : r1.n || r2.n };
-		case EIn(e, v):
-			var e = buildCond(e);
-			var t = TPath({
-				pack : [],
-				name : "Iterable",
-				params : [TPType(convertType(e.t))],
-				sub : null,
-			});
-			return { sql : { expr : ECall( { expr : EField(manager, "quoteList"), pos : p }, [e.sql, { expr : ECheckType(v,t), pos : p } ]), pos : p }, t : DBool, n : e.n };
-		default:
-			return buildDefault(cond);
-		}
-		error("Unsupported expression", p);
-		return null;
-	}
-
-	function ensureType( e : Expr, rt : RecordType, isNull : Bool ) {
-		var t = convertType(rt);
-		if (isNull) {
-			t = macro : Null<$t>;
-		}
-		return { expr : ECheckType(e, t), pos : e.pos };
-	}
-
-	function checkKeys( econd : Expr ) {
-		var p = econd.pos;
-		switch( econd.expr ) {
-		case EObjectDecl(fl):
-			var key = inf.key.copy();
-			for( f in fl ) {
-				var fi = getField(f);
-				if( !key.remove(fi.name) ) {
-					if( Lambda.has(inf.key, fi.name) )
-						error("Duplicate field " + fi.name, p);
-					else
-						error("Field " + f.field + " is not part of table key (" + inf.key.join(",") + ")", p);
-				}
-				f.expr = ensureType(f.expr, fi.t, fi.isNull);
-			}
-			return econd;
-		default:
-			if( inf.key.length > 1 )
-				error("You can't use a single value on a table with multiple keys (" + inf.key.join(",") + ")", p);
-			var fi = inf.hfields.get(inf.key[0]);
-			return ensureType(econd, fi.t, fi.isNull);
-		}
-	}
-
-	function orderField(e) {
-		switch( e.expr ) {
-		case EConst(c):
-			switch( c ) {
-			case CIdent(t):
-				if( !inf.hfields.exists(t) )
-					error("Unknown database field", e.pos);
-				return quoteField(t);
-			default:
-			}
-		case EUnop(op, _, e):
-			if( op == OpNeg )
-				return orderField(e) + " DESC";
-		default:
-		}
-		error("Invalid order field", e.pos);
-		return null;
-	}
-
-	function concatStrings( e : Expr ) {
-		var inf = { e : null, str : null };
-		browseStrings(inf, e);
-		if( inf.str != null ) {
-			var es = { expr : EConst(CString(inf.str)), pos : e.pos };
-			if( inf.e == null )
-				inf.e = es;
-			else
-				inf.e = { expr : EBinop(OpAdd, inf.e, es), pos : e.pos };
-		}
-		return inf.e;
-	}
-
-	function browseStrings( inf : { e : Expr, str : String }, e : Expr ) {
-		switch( e.expr ) {
-		case EConst(c):
-			switch( c ) {
-			case CString(s):
-				if( inf.str == null )
-					inf.str = s;
-				else
-					inf.str += s;
-				return;
-			case CInt(s), CFloat(s):
-				if( inf.str != null ) {
-					inf.str += s;
-					return;
-				}
-			default:
-			}
-		case EBinop(op, e1, e2):
-			if( op == OpAdd ) {
-				browseStrings(inf,e1);
-				browseStrings(inf,e2);
-				return;
-			}
-		case EIf(cond, e1, e2):
-			e = { expr : EIf(cond, concatStrings(e1), concatStrings(e2)), pos : e.pos };
-		default:
-		}
-		if( inf.str != null ) {
-			e = { expr : EBinop(OpAdd, { expr : EConst(CString(inf.str)), pos : e.pos }, e), pos : e.pos };
-			inf.str = null;
-		}
-		if( inf.e == null )
-			inf.e = e;
-		else
-			inf.e = { expr : EBinop(OpAdd, inf.e, e), pos : e.pos };
-	}
-
-	function buildOptions( eopt : Expr ) {
-		var p = eopt.pos;
-		var opts = new haxe.ds.StringMap();
-		var opt = { limit : null, orderBy : null, forceIndex : null };
-		switch( eopt.expr ) {
-		case EObjectDecl(fields):
-			var limit = null;
-			for( o in fields ) {
-				if( opts.exists(o.field) ) error("Duplicate option " + o.field, p);
-				opts.set(o.field, true);
-				switch( o.field ) {
-				case "orderBy":
-					var fields = switch( o.expr.expr ) {
-					case EArrayDecl(vl): Lambda.array(Lambda.map(vl, orderField));
-					case ECall(v, pl):
-						if( pl.length != 0 || !Type.enumEq(v.expr, EConst(CIdent("rand"))) )
-							[orderField(o.expr)]
-						else
-							["RAND()"];
-					default: [orderField(o.expr)];
-					};
-					opt.orderBy = fields.join(",");
-				case "limit":
-					var limits = switch( o.expr.expr ) {
-					case EArrayDecl(vl): Lambda.array(Lambda.map(vl, buildDefault));
-					default: [buildDefault(o.expr)];
-					}
-					if( limits.length == 0 || limits.length > 2 ) error("Invalid limits", o.expr.pos);
-					var l0 = limits[0], l1 = limits[1];
-					unify(l0.t, DInt, l0.sql.pos);
-					if( l1 != null )
-						unify(l1.t, DInt, l1.sql.pos);
-					opt.limit = { pos : l0.sql, len : l1 == null ? null : l1.sql };
-				case "forceIndex":
-					var fields = switch( o.expr.expr ) {
-					case EArrayDecl(vl): Lambda.array(Lambda.map(vl, makeIdent));
-					default: [makeIdent(o.expr)];
-					}
-					for( f in fields )
-						if( !inf.hfields.exists(f) )
-							error("Unknown field " + f, o.expr.pos);
-					var idx = fields.join(",");
-					if( !Lambda.exists(inf.indexes, function(i) return i.keys.join(",") == idx) && !Lambda.exists(inf.relations,function(r) return r.key == idx) )
-						error("These fields are not indexed", o.expr.pos);
-					opt.forceIndex = idx;
-				default:
-					error("Unknown option '" + o.field + "'", p);
-				}
-			}
-		default:
-			error("Options should be { orderBy : field, limit : [a,b] }", p);
-		}
-		return opt;
-	}
-
-	public static function getInfos( t : haxe.macro.Type ) {
-		var c = switch( t ) {
-		case TInst(c, _): if( c.toString() == "sys.db.Object" ) return null; c;
-		default: return null;
-		};
-		return new RecordMacros(c);
-	}
-
-
-	#if macro
-	static var RTTI = false;
-	static var FIRST_COMPILATION = true;
-
-	public static function addRtti() : Array<Field> {
-		if( RTTI ) return null;
-		RTTI = true;
-		if( FIRST_COMPILATION ) {
-			FIRST_COMPILATION = false;
-			Context.onMacroContextReused(function() {
-				RTTI = false;
-				GLOBAL = null;
-				return true;
-			});
-		}
-		Context.getType("sys.db.RecordInfos");
-		Context.onGenerate(function(types) {
-			for( t in types )
-				switch( t ) {
-				case TInst(c, _):
-					var c = c.get();
-					var cur = c.superClass;
-					while( cur != null ) {
-						if( cur.t.toString() == "sys.db.Object" )
-							break;
-						cur = cur.t.get().superClass;
-					}
-					if( cur == null || c.meta.has(":skip") || c.meta.has("rtti") )
-						continue;
-					var inst = getInfos(t);
-					var s = new haxe.Serializer();
-					s.useEnumIndex = true;
-					s.useCache = true;
-					s.serialize(inst.inf);
-					c.meta.add("rtti", [ { expr : EConst(CString(s.toString())), pos : c.pos } ], c.pos);
-				default:
-				}
-		});
-		Context.registerModuleReuseCall("sys.db.Manager", "sys.db.RecordMacros.addRtti()");
-		return null;
-	}
-
-	static function getManagerInfos( t : haxe.macro.Type, pos ) {
-		var param = null;
-		switch( t ) {
-		case TInst(c, p):
-			while( true ) {
-				if( c.toString() == "sys.db.Manager" ) {
-					param = p[0];
-					break;
-				}
-				var csup = c.get().superClass;
-				if( csup == null ) break;
-				c = csup.t;
-				p = csup.params;
-			}
-		case TType(t, p):
-			if( p.length == 1 && t.toString() == "sys.db.Manager" )
-				param = p[0];
-		default:
-		}
-		var inst = if( param == null ) null else getInfos(param);
-		if( inst == null )
-			Context.error("This method must be called from a specific Manager", Context.currentPos());
-		inst.initManager(pos);
-		return inst;
-	}
-
-	static function buildSQL( em : Expr, econd : Expr, prefix : String, ?eopt : Expr ) {
-		var pos = Context.currentPos();
-		var inst = getManagerInfos(Context.typeof(em),pos);
-		var sql = { expr : EConst(CString(prefix + " " + inst.quoteField(inst.inf.name))), pos : econd.pos };
-		var r = inst.buildCond(econd);
-		if( r.t != DBool ) Context.error("Expression should be a condition", econd.pos);
-		if( eopt != null && !Type.enumEq(eopt.expr, EConst(CIdent("null"))) ) {
-			var opt = inst.buildOptions(eopt);
-			if( opt.orderBy != null )
-				r.sql = inst.sqlAddString(r.sql, " ORDER BY " + opt.orderBy);
-			if( opt.limit != null ) {
-				r.sql = inst.sqlAddString(r.sql, " LIMIT ");
-				r.sql = inst.sqlAdd(r.sql, opt.limit.pos, pos);
-				if( opt.limit.len != null ) {
-					r.sql = inst.sqlAddString(r.sql, ",");
-					r.sql = inst.sqlAdd(r.sql, opt.limit.len, pos);
-				}
-			}
-			if( opt.forceIndex != null )
-				sql = inst.sqlAddString(sql, " FORCE INDEX (" + inst.inf.name+"_"+opt.forceIndex+")");
-		}
-		sql = inst.sqlAddString(sql, " WHERE ");
-		var sql = inst.sqlAdd(sql, r.sql, sql.pos);
-		#if !display
-		sql = inst.concatStrings(sql);
-		#end
-		return sql;
-	}
-
-	public static function macroGet( em : Expr, econd : Expr, elock : Expr ) {
-		var pos = Context.currentPos();
-		var inst = getManagerInfos(Context.typeof(em),pos);
-		econd = inst.checkKeys(econd);
-		elock = defaultTrue(elock);
-		switch( econd.expr ) {
-		case EObjectDecl(_):
-			return { expr : ECall({ expr : EField(em,"unsafeGetWithKeys"), pos : pos },[econd,elock]), pos : pos };
-		default:
-			return { expr : ECall({ expr : EField(em,"unsafeGet"), pos : pos },[econd,elock]), pos : pos };
-		}
-	}
-
-	static function defaultTrue( e : Expr ) {
-		return switch( e.expr ) {
-		case EConst(CIdent("null")): { expr : EConst(CIdent("true")), pos : e.pos };
-		default: e;
-		}
-	}
-
-	public static function macroSearch( em : Expr, econd : Expr, eopt : Expr, elock : Expr, ?single ) {
-		// allow both search(e,opts) and search(e,lock)
-		if( eopt != null && (elock == null || Type.enumEq(elock.expr, EConst(CIdent("null")))) ) {
-			switch( eopt.expr ) {
-			case EObjectDecl(_):
-			default:
-				var tmp = eopt;
-				eopt = elock;
-				elock = tmp;
-			}
-		}
-		var sql = buildSQL(em, econd, "SELECT * FROM", eopt);
-		var pos = Context.currentPos();
-		var e = { expr : ECall( { expr : EField(em, "unsafeObjects"), pos : pos }, [sql,defaultTrue(elock)]), pos : pos };
-		if( single )
-			e = { expr : ECall( { expr : EField(e, "first"), pos : pos }, []), pos : pos };
-		return e;
-	}
-
-	public static function macroCount( em : Expr, econd : Expr ) {
-		var sql = buildSQL(em, econd, "SELECT COUNT(*) FROM");
-		var pos = Context.currentPos();
-		return { expr : ECall({ expr : EField(em,"unsafeCount"), pos : pos },[sql]), pos : pos };
-	}
-
-	public static function macroDelete( em : Expr, econd : Expr, eopt : Expr ) {
-		var sql = buildSQL(em, econd, "DELETE FROM", eopt);
-		var pos = Context.currentPos();
-		return { expr : ECall({ expr : EField(em,"unsafeDelete"), pos : pos },[sql]), pos : pos };
-	}
-
-	static var isNeko = Context.defined("neko");
-
-	static function buildField( f : Field, fields : Array<Field>, ft : ComplexType, rt : ComplexType, isNull=false ) {
-		var p = switch( ft ) {
-		case TPath(p): p;
-		default: return;
-		}
-		if( p.params.length != 1 )
-			return;
-		var t = switch( p.params[0] ) {
-		case TPExpr(_): return;
-		case TPType(t): t;
-		};
-		var pos = f.pos;
-		switch( p.name ) {
-		case "SData":
-			f.kind = FProp("dynamic", "dynamic", rt, null);
-			f.meta.push( { name : ":data", params : [], pos : f.pos } );
-			f.meta.push( { name : ":isVar", params : [], pos : f.pos } );
-			var meta = [ { name : ":hide", params : [], pos : pos } ];
-			var cache = "cache_" + f.name,
-			    dataName = "data_" + f.name;
-			var ecache = { expr : EConst(CIdent(cache)), pos : pos };
-			var efield = { expr : EConst(CIdent(dataName)), pos : pos };
-			var fname = { expr : EConst(CString(dataName)), pos : pos };
-			var get = {
-				args : [],
-				params : [],
-				ret : t,
-				// we set efield to an empty object to make sure it will be != from previous value when insert/update is triggered
-				expr : macro { if( $ecache == null ) { $ecache = { v : untyped manager.doUnserialize($fname, cast $efield) }; Reflect.setField(this, $fname, { } ); }; return $ecache.v; },
-			};
-			var set = {
-				args : [{ name : "_v", opt : false, type : t, value : null }],
-				params : [],
-				ret : t,
-				expr : macro { if( $ecache == null ) { $ecache = { v : _v }; $efield = cast {}; } else $ecache.v = _v; return _v; },
-			};
-			fields.push( { name : cache, pos : pos, meta : [meta[0], { name:":skip", params:[], pos:pos } ], access : [APrivate], doc : null, kind : FVar(macro : { v : $t }, null) } );
-			fields.push( { name : dataName, pos : pos, meta : [meta[0], { name:":skip", params:[], pos:pos } ], access : [APrivate], doc : null, kind : FVar(macro : Dynamic, null) } );
-			fields.push( { name : "get_" + f.name, pos : pos, meta : meta, access : [APrivate], doc : null, kind : FFun(get) } );
-			fields.push( { name : "set_" + f.name, pos : pos, meta : meta, access : [APrivate], doc : null, kind : FFun(set) } );
-		case "SEnum":
-			f.kind = FProp("dynamic", "dynamic", rt, null);
-			f.meta.push( { name : ":data", params : [], pos : f.pos } );
-			var meta = [ { name : ":hide", params : [], pos : pos } ];
-			var dataName = "data_" + f.name;
-			var efield = { expr : EConst(CIdent(dataName)), pos : pos };
-			var eval = switch( t ) {
-			case TPath(p):
-				var pack = p.pack.copy();
-				pack.push(p.name);
-				if( p.sub != null ) pack.push(p.sub);
-				Context.parse(pack.join("."), f.pos);
-			default:
-				Context.error("Enum parameter expected", f.pos);
-			}
-			var get = {
-				args : [],
-				params : [],
-				ret : t,
-				expr : macro return $efield == null ? null : Type.createEnumIndex($eval,cast $efield),
-			};
-			var set = {
-				args : [{ name : "_v", opt : false, type : t, value : null }],
-				params : [],
-				ret : t,
-				expr : (Context.defined('cs') && !isNull) ?
-					macro { $efield = cast Type.enumIndex(_v); return _v; } :
-					macro { $efield = _v == null ? null : cast Type.enumIndex(_v); return _v; },
-			};
-			fields.push( { name : "get_" + f.name, pos : pos, meta : meta, access : [APrivate], doc : null, kind : FFun(get) } );
-			fields.push( { name : "set_" + f.name, pos : pos, meta : meta, access : [APrivate], doc : null, kind : FFun(set) } );
-			fields.push( { name : dataName, pos : pos, meta : [meta[0], { name:":skip", params:[], pos:pos } ], access : [APrivate], doc : null, kind : FVar(macro : Null<Int>, null) } );
-		case "SNull", "Null":
-			buildField(f, fields, t, rt,true);
-		}
-	}
-
-	public static function macroBuild() {
-		var fields = Context.getBuildFields();
-		var hasManager = false;
-		for( f in fields ) {
-			var skip = false;
-			if( f.name == "manager") hasManager = true;
-			for( m in f.meta )
-				switch( m.name ) {
-				case ":skip":
-					skip = true;
-				case ":relation":
-					switch( f.kind ) {
-						case FVar(t, _):
-							f.kind = FProp("dynamic", "dynamic", t);
-							if( isNeko )
-								continue;
-							// create compile-time getter/setter for other platforms
-							var relKey = null;
-							var relParams = [];
-							var lock = false;
-							for( p in m.params )
-								switch( p.expr ) {
-								case EConst(c):
-									switch( c ) {
-									case CIdent(i):
-										relParams.push(i);
-									default:
-									}
-								default:
-								}
-							relKey = relParams.shift();
-							for( p in relParams )
-								if( p == "lock" )
-									lock = true;
-							// we will get an error later
-							if( relKey == null )
-								continue;
-							// generate get/set methods stubs
-							var pos = f.pos;
-							var ttype = t, tname;
-							while( true )
-								switch(ttype) {
-								case TPath(t):
-									if( t.params.length == 1 && (t.name == "Null" || t.name == "SNull") ) {
-										ttype = switch( t.params[0] ) {
-										case TPType(t): t;
-										default: throw "assert";
-										};
-										continue;
-									}
-									var p = t.pack.copy();
-									p.push(t.name);
-									if( t.sub != null ) p.push(t.sub);
-									tname = p.join(".");
-									break;
-								default:
-									Context.error("Relation type should be a type path", f.pos);
-								}
-							function e(expr) return { expr : expr, pos : pos };
-							var get = {
-								args : [],
-								params : [],
-								ret : t,
-								expr : Context.parse("return untyped "+tname+".manager.__get(this,'"+f.name+"','"+relKey+"',"+lock+")",pos),
-							};
-							var set = {
-								args : [{ name : "_v", opt : false, type : t, value : null }],
-								params : [],
-								ret : t,
-								expr : Context.parse("return untyped "+tname+".manager.__set(this,'"+f.name+"','"+relKey+"',_v)",pos),
-							};
-							var meta = [{ name : ":hide", params : [], pos : pos }];
-							f.meta.push({ name: ":isVar", params : [], pos : pos });
-							fields.push({ name : "get_"+f.name, pos : pos, meta : meta, access : [APrivate], doc : null, kind : FFun(get) });
-							fields.push({ name : "set_"+f.name, pos : pos, meta : meta, access : [APrivate], doc : null, kind : FFun(set) });
-							fields.push({ name : relKey, pos : pos, meta : [{ name : ":skip", params : [], pos : pos }], access : [APrivate], doc : null, kind : FVar(macro : Dynamic) });
-					default:
-						Context.error("Invalid relation field type", f.pos);
-					}
-					break;
-				default:
-				}
-			if( skip )
-				continue;
-			switch( f.kind ) {
-			case FVar(t, _) | FProp('default',_,t,_):
-				if( t != null )
-					buildField(f,fields,t,t);
-			default:
-			}
-		}
-		if( !hasManager ) {
-			var inst = Context.getLocalClass().get();
-			if( inst.meta.has(":skip") )
-				return fields;
-			if (!Context.defined('neko'))
-			{
-				var iname = { expr:EConst(CIdent(inst.name)), pos: inst.pos };
-				var getM = {
-					args : [],
-					params : [],
-					ret : macro : sys.db.Manager<Dynamic>,
-					expr : macro return $iname.manager
-				};
-				fields.push({ name: "__getManager", meta : [], access : [APrivate,AOverride], doc : null, kind : FFun(getM), pos : inst.pos });
-			}
-			var p = inst.pos;
-			var tinst = TPath( { pack : inst.pack, name : inst.name, sub : null, params : [] } );
-			var path = inst.pack.copy().concat([inst.name]).join(".");
-			var enew = { expr : ENew( { pack : ["sys", "db"], name : "Manager", sub : null, params : [TPType(tinst)] }, [Context.parse(path, p)]), pos : p }
-			fields.push({ name : "manager", meta : [], kind : FVar(null,enew), doc : null, access : [AStatic,APublic], pos : p });
-		}
-		return fields;
-	}
-
-	#end
-
-}

+ 0 - 110
std/sys/db/TableCreate.hx

@@ -1,110 +0,0 @@
-/*
- * Copyright (C)2005-2017 Haxe Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-package sys.db;
-import sys.db.RecordInfos;
-
-@:deprecated("This class will be removed soon, please install the record-macros library")
-class TableCreate {
-
-	static function autoInc( dbName ) {
-		// on SQLite, autoincrement is necessary to be primary key as well
-		return dbName == "SQLite" ? "PRIMARY KEY AUTOINCREMENT" : "AUTO_INCREMENT";
-	}
-
-	public static function getTypeSQL( t : RecordType, dbName : String ) {
-		return switch( t ) {
-		case DId: "INTEGER "+autoInc(dbName);
-		case DUId: "INTEGER UNSIGNED "+autoInc(dbName);
-		case DInt, DEncoded: "INTEGER";
-		case DUInt: "INTEGER UNSIGNED";
-		case DTinyInt: "TINYINT";
-		case DTinyUInt, DEnum(_): "TINYINT UNSIGNED";
-		case DSmallInt: "SMALLINT";
-		case DSmallUInt: "SMALLINT UNSIGNED";
-		case DMediumInt: "MEDIUMINT";
-		case DMediumUInt: "MEDIUMINT UNSIGNED";
-		case DSingle: "FLOAT";
-		case DFloat: "DOUBLE";
-		case DBool: "TINYINT(1)";
-		case DString(n): "VARCHAR("+n+")";
-		case DDate: "DATE";
-		case DDateTime: "DATETIME";
-		case DTimeStamp: "TIMESTAMP DEFAULT 0";
-		case DTinyText: "TINYTEXT";
-		case DSmallText: "TEXT";
-		case DText, DSerialized: "MEDIUMTEXT";
-		case DSmallBinary: "BLOB";
-		case DBinary, DNekoSerialized, DData: "MEDIUMBLOB";
-		case DLongBinary: "LONGBLOB";
-		case DBigInt: "BIGINT";
-		case DBigId: "BIGINT "+autoInc(dbName);
-		case DBytes(n): "BINARY(" + n + ")";
-		case DFlags(fl, auto): getTypeSQL(auto ? (fl.length <= 8 ? DTinyUInt : (fl.length <= 16 ? DSmallUInt : (fl.length <= 24 ? DMediumUInt : DInt))) : DInt, dbName);
-		case DNull, DInterval: throw "assert";
-		};
-	}
-
-	public static function create( manager : sys.db.Manager<Dynamic>, ?engine ) {
-		function quote(v:String):String {
-			return untyped manager.quoteField(v);
-		}
-		var cnx : Connection = untyped manager.getCnx();
-		if( cnx == null )
-			throw "SQL Connection not initialized on Manager";
-		var dbName = cnx.dbName();
-		var infos = manager.dbInfos();
-		var sql = "CREATE TABLE " + quote(infos.name) + " (";
-		var decls = [];
-		var hasID = false;
-		for( f in infos.fields ) {
-			switch( f.t ) {
-			case DId:
-				hasID = true;
-			case DUId, DBigId:
-				hasID = true;
-				if( dbName == "SQLite" )
-					throw "S" + Std.string(f.t).substr(1)+" is not supported by " + dbName + " : use SId instead";
-			default:
-			}
-			decls.push(quote(f.name)+" "+getTypeSQL(f.t,dbName)+(f.isNull ? "" : " NOT NULL"));
-		}
-		if( dbName != "SQLite" || !hasID )
-			decls.push("PRIMARY KEY ("+Lambda.map(infos.key,quote).join(",")+")");
-		sql += decls.join(",");
-		sql += ")";
-		if( engine != null )
-			sql += "ENGINE="+engine;
-		cnx.request(sql);
-	}
-
-	public static function exists( manager : sys.db.Manager<Dynamic> ) : Bool {
-		var cnx : Connection = untyped manager.getCnx();
-		if( cnx == null )
-			throw "SQL Connection not initialized on Manager";
-		try {
-			cnx.request("SELECT * FROM `"+manager.dbInfos().name+"` LIMIT 1");
-			return true;
-		} catch( e : Dynamic ) {
-			return false;
-		}
-	}
-}

+ 0 - 70
std/sys/db/Transaction.hx

@@ -1,70 +0,0 @@
-/*
- * Copyright (C)2005-2017 Haxe Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-package sys.db;
-
-class Transaction {
-
-	public static function isDeadlock(e : Dynamic) {
-		return Std.is(e,String) && ~/try restarting transaction/.match(e);
-	}
-
-	private static function runMainLoop(mainFun,logError,count) {
-		try {
-			mainFun();
-		} catch( e : Dynamic ) {
-			if( count > 0 && isDeadlock(e) ) {
-				Manager.cleanup();
-				Manager.cnx.rollback(); // should be already done, but in case...
-				Manager.cnx.startTransaction();
-				runMainLoop(mainFun,logError,count-1);
-				return;
-			}
-			if( logError == null ) {
-				Manager.cnx.rollback();
-				#if neko
-				neko.Lib.rethrow(e);
-				#else
-				throw e;
-				#end
-			}
-			logError(e); // should ROLLBACK if needed
-		}
-	}
-
-	public static function main( cnx, mainFun : Void -> Void, ?logError : Dynamic -> Void ) {
-		Manager.initialize();
-		Manager.cnx = cnx;
-		Manager.cnx.startTransaction();
-		runMainLoop(mainFun,logError,3);
-		try {
-			Manager.cnx.commit();
-		} catch( e : String ) {
-			// sqlite can have errors on commit
-			if( ~/Database is busy/.match(e) )
-				logError(e);
-		}
-		Manager.cnx.close();
-		Manager.cnx = null;
-		Manager.cleanup();
-	}
-
-}

+ 0 - 161
std/sys/db/Types.hx

@@ -1,161 +0,0 @@
-/*
- * Copyright (C)2005-2017 Haxe Foundation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
-package sys.db;
-
-// basic types
-
-/** int with auto increment **/
-@:noPackageRestrict
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SId = Null<Int>
-
-/** int unsigned with auto increment **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SUId = Null<Int>
-
-/** big int with auto increment **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SBigId = Null<Float>
-
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SInt = Null<Int>
-
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SUInt = Null<Int>
-
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SBigInt = Null<Float>
-
-/** single precision float **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SSingle = Null<Float>
-
-/** double precision float **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SFloat = Null<Float>
-
-/** use `tinyint(1)` to distinguish with int **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SBool = Null<Bool>
-
-/** same as `varchar(n)` **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SString<Const> = String
-
-/** date only, use `SDateTime` for date+time **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SDate = Date
-
-/** mysql DateTime **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SDateTime = Date
-
-/** mysql Timestamp **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef STimeStamp = Date
-
-/** TinyText (up to 255 bytes) **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef STinyText = String
-
-/** Text (up to 64KB) **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SSmallText = String
-
-/** MediumText (up to 24MB) **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SText = String
-
-/** Blob type (up to 64KB) **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SSmallBinary = haxe.io.Bytes
-
-/** LongBlob type (up to 4GB) **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SLongBinary = haxe.io.Bytes
-
-/** MediumBlob type (up to 24MB) **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SBinary = haxe.io.Bytes
-
-/** same as binary(n) **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SBytes<Const> = haxe.io.Bytes
-
-/** one byte signed `-128...127` **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef STinyInt = Null<Int>
-
-/** two bytes signed `-32768...32767` **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SSmallInt = Null<Int>
-
-/** three bytes signed `-8388608...8388607` **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SMediumInt = Null<Int>
-
-/** one byte `0...255` **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef STinyUInt = Null<Int>
-
-/** two bytes `0...65535` **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SSmallUInt = Null<Int>
-
-/** three bytes `0...16777215` **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SMediumUInt = Null<Int>
-
-// extra
-
-/** specify that this field is nullable **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SNull<T> = Null<T>
-
-/** specify that the integer use custom encoding **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SEncoded = Null<Int>
-
-/** Haxe Serialized string **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SSerialized = String
-
-/** native neko serialized bytes **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SNekoSerialized = haxe.io.Bytes
-
-/** a set of bitflags of different enum values **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SFlags<T:EnumValue> = Null<haxe.EnumFlags<T>>
-
-/** same as `SFlags` but will adapt the storage size to the number of flags **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SSmallFlags<T:EnumValue> = SFlags<T>;
-
-/** allow to store any value in serialized form **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SData<T> = Null<T>
-
-/** allow to store an enum value that does not have parameters as a simple int **/
-@:deprecated("This class will be removed soon, please install the record-macros library")
-typedef SEnum<E:EnumValue> = Null<E>
-

+ 0 - 110
tests/unit/src/unit/MySpodClass.hx

@@ -1,110 +0,0 @@
-package unit;
-import sys.db.Object;
-import sys.db.Types;
-
-@:keep class MySpodClass extends Object
-{
-	public var theId:SId;
-	public var int:SInt;
-	public var double:SFloat;
-	public var boolean:SBool;
-	public var string:SString<255>;
-	public var date:SDateTime;
-	public var binary:SBinary;
-	public var abstractType:AbstractSpodTest<String>;
-
-	public var nullInt:SNull<Int>;
-	public var enumFlags:SFlags<SpodEnum>;
-
-	@:relation(rid) public var relation:OtherSpodClass;
-	@:relation(rnid) public var relationNullable:Null<OtherSpodClass>;
-	@:relation(spid) public var next:Null<MySpodClass>;
-
-	public var data:SData<Array<ComplexClass>>;
-	public var anEnum:SEnum<SpodEnum>;
-	public var bytes:SBytes<2>;
-}
-
-@:keep class NullableSpodClass extends Object
-{
-	public var theId:SId;
-	@:relation(rnid) public var relationNullable:Null<OtherSpodClass>;
-	public var data:Null<SData<Array<ComplexClass>>>;
-	public var anEnum:Null<SEnum<SpodEnum>>;
-
-	public var int:SNull<SInt>;
-	public var double:SNull<SFloat>;
-	public var boolean:SNull<SBool>;
-	public var string:SNull<SString<255>>;
-	public var date:SNull<SDateTime>;
-	public var binary:SNull<SBinary>;
-	public var abstractType:SNull<AbstractSpodTest<String>>;
-
-	public var nullInt:SNull<Int>;
-	public var enumFlags:SNull<SFlags<SpodEnum>>;
-}
-
-@:keep class ComplexClass
-{
-	public var val : { name:String, array:Array<String> };
-
-	public function new(val)
-	{
-		this.val = val;
-	}
-}
-
-@:id(theid) @:keep class OtherSpodClass extends Object
-{
-	public var theid:SInt;
-	public var name:SString<255>;
-
-	public function new(name:String)
-	{
-		super();
-		this.name =name;
-	}
-}
-
-@:keep enum SpodEnum
-{
-	FirstValue;
-	SecondValue;
-	ThirdValue;
-}
-
-abstract AbstractSpodTest<A>(A) from A
-{
-	public function get():A
-	{
-		return this;
-	}
-}
-
-@:id(name)
-	@:keep class ClassWithStringId extends Object
-{
-	public var name:SString<255>;
-	public var field:SInt;
-}
-
-@:keep class ClassWithStringIdRef extends Object
-{
-	public var id:SId;
-	@:relation(ref_id) public var ref:ClassWithStringId;
-}
-
-
-//issue #3828
-@:keep @:skip class BaseIssueC3828 extends sys.db.Object {
-	public var id : SInt;
-	@:relation(ruid)
-		public var refUser : SNull<IssueC3828>;
-}
-
-@:keep class IssueC3828 extends BaseIssueC3828 {
-}
-
-@:keep class Issue6041Table extends Object {
-	public var id:SInt = 0;
-}

+ 0 - 14
tests/unit/src/unit/TestMain.hx

@@ -102,20 +102,6 @@ class TestMain {
 		}
 		#end
 
-		// SPOD tests
-		#if ( (neko || (php && (travis || appveyor || php_sqlite)) || java || cpp || (cs && (travis || appveyor))) && !macro && !interp)
-		#if ( (travis || appveyor) && !(cpp || cs) )
-		classes.push(new TestSpod(sys.db.Mysql.connect({
-			host : "127.0.0.1",
-			user : "travis",
-			pass : "",
-			port : 3306,
-			database : "haxe_test" })));
-		#end
-		if (verbose)
-			logVerbose("Setup sqlite");
-		classes.push(new TestSpod(sys.db.Sqlite.open("db.db3")));
-		#end
 		TestIssues.addIssueClasses("src/unit/issues", "unit.issues");
 		TestIssues.addIssueClasses("src/unit/hxcpp_issues", "unit.hxcpp_issues");
 		var current = null;

+ 0 - 546
tests/unit/src/unit/TestSpod.hx

@@ -1,546 +0,0 @@
-package unit;
-import sys.db.*;
-import sys.db.Object;
-import sys.db.Types;
-import haxe.io.Bytes;
-import haxe.EnumFlags;
-import sys.db.Connection;
-import sys.db.Manager;
-import sys.db.Sqlite;
-import sys.db.TableCreate;
-import sys.FileSystem;
-import unit.MySpodClass;
-
-using Lambda;
-
-class TestSpod extends Test
-{
-	private var cnx:Connection;
-	public function new(cnx:Connection)
-	{
-		super();
-		this.cnx = cnx;
-		Manager.cnx = cnx;
-		try cnx.request('DROP TABLE MySpodClass') catch(e:Dynamic) {}
-		try cnx.request('DROP TABLE OtherSpodClass') catch(e:Dynamic) {}
-		try cnx.request('DROP TABLE NullableSpodClass') catch(e:Dynamic) {}
-		try cnx.request('DROP TABLE ClassWithStringId') catch(e:Dynamic) {}
-		try cnx.request('DROP TABLE ClassWithStringIdRef') catch(e:Dynamic) {}
-		try cnx.request('DROP TABLE IssueC3828') catch(e:Dynamic) {}
-		try cnx.request('DROP TABLE Issue6041Table') catch(e:Dynamic) {}
-		TableCreate.create(MySpodClass.manager);
-		TableCreate.create(OtherSpodClass.manager);
-		TableCreate.create(NullableSpodClass.manager);
-		TableCreate.create(ClassWithStringId.manager);
-		TableCreate.create(ClassWithStringIdRef.manager);
-		TableCreate.create(IssueC3828.manager);
-		TableCreate.create(Issue6041Table.manager);
-	}
-
-	private function setManager()
-	{
-		Manager.initialize();
-		Manager.cnx = cnx;
-		Manager.cleanup();
-	}
-
-	function getDefaultClass()
-	{
-		var scls = new MySpodClass();
-		scls.int = 1;
-		scls.double = 2.0;
-		scls.boolean = true;
-		scls.string = "some string";
-		scls.date = new Date(2012, 7, 30, 0, 0, 0);
-		scls.abstractType = "other string";
-
-		var bytes = Bytes.ofString("\x01\n\r'\x02");
-		scls.binary = bytes;
-		scls.enumFlags = EnumFlags.ofInt(0);
-		scls.enumFlags.set(FirstValue);
-		scls.enumFlags.set(ThirdValue);
-		scls.bytes = Bytes.ofString("\000a");
-
-		scls.data = [new ComplexClass( { name:"test", array:["this", "is", "a", "test"] } )];
-		scls.anEnum = SecondValue;
-
-		return scls;
-	}
-
-	function getDefaultNull() {
-		var scls = new NullableSpodClass();
-		scls.int = 1;
-		scls.double = 2.0;
-		scls.boolean = true;
-		scls.string = "some string";
-		scls.date = new Date(2012, 7, 30, 0, 0, 0);
-		scls.abstractType = "other string";
-
-		var bytes = Bytes.ofString("\x01\n\r'\x02");
-		scls.binary = bytes;
-		scls.enumFlags = EnumFlags.ofInt(0);
-		scls.enumFlags.set(FirstValue);
-		scls.enumFlags.set(ThirdValue);
-
-		scls.data = [new ComplexClass( { name:"test", array:["this", "is", "a", "test"] } )];
-		scls.anEnum = SecondValue;
-		return scls;
-	}
-
-	public function testNull() {
-		setManager();
-		var n1 = getDefaultNull();
-		n1.insert();
-		var n2 = new NullableSpodClass();
-		n2.insert();
-		var id = n2.theId;
-
-		n1 = null; n2 = null;
-		Manager.cleanup();
-
-		var nullVal = getNull();
-		inline function checkReq(lst:List<NullableSpodClass>, ?nres=1, ?pos:haxe.PosInfos) {
-			eq(lst.length,nres, pos);
-			if (lst.length == 1) {
-				eq(lst.first().theId, id, pos);
-			}
-		}
-
-		checkReq(NullableSpodClass.manager.search($relationNullable == null), 2);
-		checkReq(NullableSpodClass.manager.search($data == null));
-		checkReq(NullableSpodClass.manager.search($anEnum == null));
-
-		checkReq(NullableSpodClass.manager.search($int == null));
-		checkReq(NullableSpodClass.manager.search($double == null));
-		checkReq(NullableSpodClass.manager.search($boolean == null));
-		checkReq(NullableSpodClass.manager.search($string == null));
-		checkReq(NullableSpodClass.manager.search($date == null));
-		checkReq(NullableSpodClass.manager.search($binary == null));
-		checkReq(NullableSpodClass.manager.search($abstractType == null));
-
-		checkReq(NullableSpodClass.manager.search($enumFlags == null));
-
-
-		var relationNullable:Null<OtherSpodClass> = getNull();
-		checkReq(NullableSpodClass.manager.search($relationNullable == relationNullable), 2);
-		var data:Null<Bytes> = getNull();
-		checkReq(NullableSpodClass.manager.search($data == data));
-		var anEnum:Null<SEnum<SpodEnum>> = getNull();
-		checkReq(NullableSpodClass.manager.search($anEnum == anEnum));
-
-		var int:Null<Int> = getNull();
-		checkReq(NullableSpodClass.manager.search($int == int));
-		var double:Null<Float> = getNull();
-		checkReq(NullableSpodClass.manager.search($double == double));
-		var boolean:Null<Bool> = getNull();
-		checkReq(NullableSpodClass.manager.search($boolean == boolean));
-		var string:SNull<SString<255>> = getNull();
-		checkReq(NullableSpodClass.manager.search($string == string));
-		var date:SNull<SDateTime> = getNull();
-		checkReq(NullableSpodClass.manager.search($date == date));
-		var binary:SNull<SBinary> = getNull();
-		checkReq(NullableSpodClass.manager.search($binary == binary));
-		var abstractType:SNull<String> = getNull();
-		checkReq(NullableSpodClass.manager.search($abstractType == abstractType));
-
-		for (val in NullableSpodClass.manager.all()) {
-			val.delete();
-		}
-	}
-
-	private function getNull<T>():Null<T> {
-		return null;
-	}
-
-	public function testIssue3828()
-	{
-		setManager();
-		var u1 = new IssueC3828();
-		u1.insert();
-		var u2 = new IssueC3828();
-		u2.refUser = u1;
-		u2.insert();
-		var u1id = u1.id, u2id = u2.id;
-		u1 = null; u2 = null;
-		Manager.cleanup();
-
-		var u1 = IssueC3828.manager.get(u1id);
-		var u2 = IssueC3828.manager.search($refUser == u1).first();
-		eq(u1.id, u1id);
-		eq(u2.id, u2id);
-	}
-
-	public function testIssue6041()
-	{
-		setManager();
-		var item = new Issue6041Table();
-		item.insert();
-		var result = cnx.request('SELECT * FROM Issue6041Table LIMIT 1');
-		var amount = 1;
-		for(row in result) {
-			if(--amount < 0) throw "Invalid amount of rows in result";
-		}
-		eq(amount, 0);
-	}
-
-	public function testStringIdRel()
-	{
-		setManager();
-		var s = new ClassWithStringId();
-		s.name = "first";
-		s.field = 1;
-		s.insert();
-		var v1 = new ClassWithStringIdRef();
-		v1.ref = s;
-		v1.insert();
-		var v2 = new ClassWithStringIdRef();
-		v2.ref = s;
-		v2.insert();
-
-		s = new ClassWithStringId();
-		s.name = "second";
-		s.field = 2;
-		s.insert();
-		v1 = new ClassWithStringIdRef();
-		v1.ref = s;
-		v1.insert();
-		s = null; v1 = null; v2 = null;
-		Manager.cleanup();
-
-		var first = ClassWithStringId.manager.search($name == "first");
-		eq(first.length,1);
-		var first = first.first();
-		eq(first.field,1);
-		var frel = ClassWithStringIdRef.manager.search($ref == first);
-		eq(frel.length,2);
-		for (rel in frel)
-			eq(rel.ref, first);
-		var frel2 = ClassWithStringIdRef.manager.search($ref_id == "first");
-		eq(frel2.length,2);
-		for (rel in frel2)
-			eq(rel.ref, first);
-
-		var second = ClassWithStringId.manager.search($name == "second");
-		eq(second.length,1);
-		var second = second.first();
-		eq(second.field,2);
-		var srel = ClassWithStringIdRef.manager.search($ref == second);
-		eq(srel.length,1);
-		for (rel in srel)
-			eq(rel.ref, second);
-
-		eq(frel.array().indexOf(srel.first()), -1);
-		second.delete();
-		for (r in srel) r.delete();
-		first.delete();
-		for (r in frel) r.delete();
-	}
-
-	public function testEnum()
-	{
-		setManager();
-		var c1 = new OtherSpodClass("first spod");
-		c1.insert();
-		var c2 = new OtherSpodClass("second spod");
-		c2.insert();
-
-		var scls = getDefaultClass();
-		var scls1 = scls;
-		scls.relation = c1;
-		scls.insert();
-		var id1 = scls.theId;
-		scls = getDefaultClass();
-		scls.relation = c1;
-		scls.insert();
-
-		scls1.next = scls;
-		scls1.update();
-
-		var id2 = scls.theId;
-		scls = getDefaultClass();
-		scls.relation = c1;
-		scls.next = scls1;
-		scls.anEnum = FirstValue;
-		scls.insert();
-		var id3 = scls.theId;
-		scls = null;
-
-		Manager.cleanup();
-		var r1s = [ for (c in MySpodClass.manager.search($anEnum == SecondValue,{orderBy:theId})) c.theId ];
-		eq([id1,id2].join(','),r1s.join(','));
-		var r2s = MySpodClass.manager.search($anEnum == FirstValue);
-		eq(r2s.length,1);
-		eq(r2s.first().theId,id3);
-		eq(r2s.first().next.theId,id1);
-		eq(r2s.first().next.next.theId,id2);
-
-		var fv = getSecond();
-		var r1s = [ for (c in MySpodClass.manager.search($anEnum == fv,{orderBy:theId})) c.theId ];
-		eq([id1,id2].join(','),r1s.join(','));
-		var r2s = MySpodClass.manager.search($anEnum == getFirst());
-		eq(r2s.length,1);
-		eq(r2s.first().theId,id3);
-
-		var ids = [id1,id2,id3];
-		var s = [ for (c in MySpodClass.manager.search( $anEnum == SecondValue || $theId in ids )) c.theId ];
-		s.sort(Reflect.compare);
-		eq([id1,id2,id3].join(','),s.join(','));
-
-		r2s.first().delete();
-		for (v in MySpodClass.manager.search($anEnum == fv)) v.delete();
-	}
-
-	public function getFirst()
-	{
-		return FirstValue;
-	}
-
-	public function getSecond()
-	{
-		return SecondValue;
-	}
-
-	public function testUpdate()
-	{
-		setManager();
-		var c1 = new OtherSpodClass("first spod");
-		c1.insert();
-		var c2 = new OtherSpodClass("second spod");
-		c2.insert();
-		var scls = getDefaultClass();
-		scls.relation = c1;
-		scls.relationNullable = c2;
-		scls.insert();
-
-		var id = scls.theId;
-
-		//if no change made, update should return nothing
-		eq( untyped MySpodClass.manager.getUpdateStatement( scls ), null );
-		Manager.cleanup();
-		scls = MySpodClass.manager.get(id);
-		eq( untyped MySpodClass.manager.getUpdateStatement( scls ), null );
-		scls.delete();
-
-		//try now with null SData and null relation
-		var scls = new NullableSpodClass();
-		scls.insert();
-
-		var id = scls.theId;
-
-		//if no change made, update should return nothing
-		eq( untyped NullableSpodClass.manager.getUpdateStatement( scls ), null );
-		Manager.cleanup();
-		scls = NullableSpodClass.manager.get(id);
-		eq( untyped NullableSpodClass.manager.getUpdateStatement( scls ), null );
-		eq(scls.data,null);
-		eq(scls.relationNullable,null);
-		eq(scls.abstractType,null);
-		eq(scls.anEnum,null);
-		scls.delete();
-
-		//same thing with explicit null set
-		var scls = new NullableSpodClass();
-		scls.data = null;
-		scls.relationNullable = null;
-		scls.abstractType = null;
-		scls.anEnum = null;
-		scls.insert();
-
-		var id = scls.theId;
-
-		//if no change made, update should return nothing
-		eq( untyped NullableSpodClass.manager.getUpdateStatement( scls ), null );
-		Manager.cleanup();
-		scls = NullableSpodClass.manager.get(id);
-		eq( untyped NullableSpodClass.manager.getUpdateStatement( scls ), null );
-		eq(scls.data,null);
-		eq(scls.relationNullable,null);
-		eq(scls.abstractType,null);
-		eq(scls.anEnum,null);
-		Manager.cleanup();
-
-		scls = new NullableSpodClass();
-		scls.theId = id;
-		t( untyped NullableSpodClass.manager.getUpdateStatement( scls ) != null );
-
-		scls.delete();
-	}
-
-	public function testSpodTypes()
-	{
-		setManager();
-		var c1 = new OtherSpodClass("first spod");
-		c1.insert();
-		var c2 = new OtherSpodClass("second spod");
-		c2.insert();
-
-		var scls = getDefaultClass();
-
-		scls.relation = c1;
-		scls.relationNullable = c2;
-		scls.insert();
-
-		//after inserting, id must be filled
-		t(scls.theId != 0 && scls.theId != null,pos());
-		var theid = scls.theId;
-
-		c1 = c2 = null;
-		Manager.cleanup();
-
-		var cls1 = MySpodClass.manager.get(theid);
-		t(cls1 != null,pos());
-		//after Manager.cleanup(), the instances should be different
-		f(cls1 == scls,pos());
-		scls = null;
-
-		t((cls1.int is Int),pos());
-		eq(cls1.int, 1,pos());
-		t((cls1.double is Float),pos());
-		eq(cls1.double, 2.0,pos());
-		t((cls1.boolean is Bool),pos());
-		eq(cls1.boolean, true,pos());
-		t((cls1.string is String),pos());
-		eq(cls1.string, "some string",pos());
-		t((cls1.abstractType is String),pos());
-		eq(cls1.abstractType.get(), "other string",pos());
-		t(cls1.date != null,pos());
-		t((cls1.date is Date),pos());
-		eq(cls1.date.getTime(), new Date(2012, 7, 30, 0, 0, 0).getTime(),pos());
-
-		t((cls1.binary is Bytes),pos());
-		eq(cls1.binary.compare(Bytes.ofString("\x01\n\r'\x02")), 0,pos());
-		t(cls1.enumFlags.has(FirstValue),pos());
-		f(cls1.enumFlags.has(SecondValue),pos());
-		t(cls1.enumFlags.has(ThirdValue),pos());
-
-		t((cls1.data is Array),pos());
-		t((cls1.data[0] is ComplexClass),pos());
-
-		eq(cls1.data[0].val.name, "test",pos());
-		eq(cls1.data[0].val.array.length, 4,pos());
-		eq(cls1.data[0].val.array[1], "is",pos());
-
-		eq(cls1.relation.name, "first spod",pos());
-		eq(cls1.relationNullable.name, "second spod",pos());
-
-		eq(cls1.anEnum, SecondValue,pos());
-		t((cls1.anEnum is SpodEnum),pos());
-
-		eq("\000a", cls1.bytes.toString());
-
-		eq(cls1, MySpodClass.manager.select($anEnum == SecondValue),pos());
-
-		//test create a new class
-		var scls = getDefaultClass();
-
-		c1 = new OtherSpodClass("third spod");
-		c1.insert();
-
-		scls.relation = c1;
-		scls.insert();
-
-		scls = cls1 = null;
-		Manager.cleanup();
-
-		eq(2, MySpodClass.manager.all().length,pos());
-		var req = MySpodClass.manager.search({ relation: OtherSpodClass.manager.select({ name:"third spod"} ) });
-		eq(req.length, 1,pos());
-		scls = req.first();
-
-		scls.relation.name = "Test";
-		scls.relation.update();
-
-		eq(OtherSpodClass.manager.select({ name:"third spod" }), null,pos());
-
-		for (c in MySpodClass.manager.all())
-			c.delete();
-		for (c in OtherSpodClass.manager.all())
-			c.delete();
-
-		//issue #3598
-		var inexistent = MySpodClass.manager.get(1000,false);
-		eq(inexistent,null);
-	}
-
-	public function testDateQuery()
-	{
-		setManager();
-		var other1 = new OtherSpodClass("required field");
-		other1.insert();
-
-		var now = Date.now();
-		var c1 = getDefaultClass();
-		c1.relation = other1;
-		c1.date = now;
-		c1.insert();
-
-		var c2 = getDefaultClass();
-		c2.relation = other1;
-		c2.date = DateTools.delta(now, DateTools.hours(1));
-		c2.insert();
-
-		var q = MySpodClass.manager.search($date > now);
-		eq(q.length, 1,pos());
-		eq(q.first(), c2,pos());
-
-		q = MySpodClass.manager.search($date == now);
-		eq(q.length, 1,pos());
-		eq(q.first(), c1,pos());
-
-		q = MySpodClass.manager.search($date >= now);
-		eq(q.length, 2,pos());
-		eq(q.first(), c1,pos());
-
-		q = MySpodClass.manager.search($date >= DateTools.delta(now, DateTools.hours(2)));
-		eq(q.length, 0,pos());
-		eq(q.first(), null,pos());
-
-		c1.delete();
-		c2.delete();
-		other1.delete();
-	}
-
-	public function testData()
-	{
-		setManager();
-		var other1 = new OtherSpodClass("required field");
-		other1.insert();
-
-		var c1 = getDefaultClass();
-		c1.relation = other1;
-		c1.insert();
-
-		eq(c1.data.length,1,pos());
-		c1.data.pop();
-		c1.update();
-
-		Manager.cleanup();
-		c1 = null;
-
-		c1 = MySpodClass.manager.select($relation == other1);
-		eq(c1.data.length, 0,pos());
-		c1.data.push(new ComplexClass({ name: "test1", array:["complex","field"] }));
-		c1.data.push(null);
-		eq(c1.data.length, 2,pos());
-		c1.update();
-
-		Manager.cleanup();
-		c1 = null;
-
-		c1 = MySpodClass.manager.select($relation == other1);
-		eq(c1.data.length,2,pos());
-		eq(c1.data[0].val.name, "test1",pos());
-		eq(c1.data[0].val.array.length, 2,pos());
-		eq(c1.data[0].val.array[0], "complex",pos());
-		eq(c1.data[1], null,pos());
-
-		c1.delete();
-		other1.delete();
-	}
-
-	private function pos(?p:haxe.PosInfos):haxe.PosInfos
-	{
-		p.fileName = p.fileName + "(" + cnx.dbName()  +")";
-		return p;
-	}
-}

Some files were not shown because too many files changed in this diff