function(value, type) {
	if(typeof type != "string") { return checkValue(value); }
	var rs = value;
	if(value === null) { return null; }

	switch(type) {
		case "String":
			if(!value) {
				rs = "";
			}
			else {
				rs = value.toString();
			}
			break;

		case "Number":
			rs = isNaN(parseFloat(value))? null: parseFloat(value);
			break;

		case "Date":
			rs = isNaN(new Date(value))? null: new Date(value);
			break;

		case "Boolean":
			if(typeof value == 'string') { value = value.toLowerCase(); }
			switch(value) {
				case true:
				case "true":
				case "t":
				case 1:
				case "1":
					rs = true;
					break;

				case false:
				case "false":
				case "f":
				case 0:
				case "0":
					rs = false;
					break;

				default:
					rs = null;
					break;
			}

			break;

		case "JSON":
			rs = typeof value == 'object'? value: {};
			break;

		case "Binary":
			break;
	}

	return rs;
}
function(value, type) {
	if(typeof type != "string") { return checkValue(value); }
	var rs = value;
	if(value === null) { return null; }

	switch(type) {
		case "String":
			if(!value) {
				rs = "";
			}
			else {
				rs = value.toString();
			}
			break;

		case "Number":
			rs = isNaN(parseFloat(value))? null: parseFloat(value);
			break;

		case "Date":
			rs = isNaN(new Date(value))? null: new Date(value);
			break;

		case "Boolean":
			if(typeof value == 'string') { value = value.toLowerCase(); }
			switch(value) {
				case true:
				case "true":
				case "t":
				case 1:
				case "1":
					rs = true;
					break;

				case false:
				case "false":
				case "f":
				case 0:
				case "0":
					rs = false;
					break;

				default:
					rs = null;
					break;
			}

			break;

		case "JSON":
			rs = typeof value == 'object'? value: {};
			break;

		case "Binary":
			break;
	}

	return rs;
}
function ( value , type ) { if ( typeof type != "string" ) { return checkValue ( value ) ; } var rs = value ; if ( value === null ) { return null ; } switch ( type ) { case "String" : if ( ! value ) { rs = "" ; } else { rs = value . toString ( ) ; } break ; case "Number" : rs = isNaN ( parseFloat ( value ) ) ? null : parseFloat ( value ) ; break ; case "Date" : rs = isNaN ( new Date ( value ) ) ? null : new Date ( value ) ; break ; case "Boolean" : if ( typeof value == 'string' ) { value = value . toLowerCase ( ) ; } switch ( value ) { case true : case "true" : case "t" : case 1 : case "1" : rs = true ; break ; case false : case "false" : case "f" : case 0 : case "0" : rs = false ; break ; default : rs = null ; break ; } break ; case "JSON" : rs = typeof value == 'object' ? value : { } ; break ; case "Binary" : break ; } return rs ; }
/*
this.DB
this.params = {
driverPath,
driver
}

var test = {a: 1, b: { "b1": 2 }}
 /*

var edb = require('ecdb'); // var edb = require('./index.js');
var db = new edb();
db.connect();
db.listData('users', 'where authtime > "2012-10-10"', function(e, d) {console.log(d);});
db.listTable(function(e, d) {console.log(d);});
db.putData('tmp', 5, {name: 'String', birth: 'Date', age: 1}, function(e, d) {console.log(d);});
db.postTable('testuser', {name: 'String', birth: 'Date', age: 1}, function(e, d) {console.log(d);});
db.postData('user', {name: 'A', birth: '1982-04-01', age: 2}, function(e, d) {console.log(d);});
db.postData('testuser', {name: 'B', birth: '1988-09-18', age: 3}, function(e, d) {console.log(d);});
db.postData('user', {name: 'B', birth: '1995-08-23', age: 4}, function(e, d) {console.log(d);});
db.listData('user', "birth < '1990-01-01' and birth > '1984-01-01'", function(e, d) {console.log(d);});
db.postData('user', [{name: 'D', birth: '1982-05-01'}], function(e, d) {console.log(d);});
db.postData('user', [{name: 'D', birth: '1982-05-01'}, {name: 'E', birth: '1982-06-01'}, {name: 'F', birth: '1982-07-01'}], function(e, d) {console.log(d);});
db.sql("select * from user where birth > '1982-05-01'", function(e, d) {console.log(d);});
db.sql("select * from user inner join info on user.x = info.x", function(e, d) {console.log(d);});

db.dataFind(
[{name: 'A', birth: '1982-04-01', age: 10},{name: 'B', birth: '1983-04-01', age: 5},{name: 'C', birth: '1984-04-01', age: 20}],
"select * from table where birth > '1983-01-01'",
function(e, d) {console.log(d);}
);

db.putData('tmp2', 5, {name: 'String', birth: 'Date', age: 1}, function(e, d) {console.log(d);});
db.sql("update Yo set a = 1, b = 'b', c = '1999-01-01'");
db.sql("delete from user where _id > 3");
/ * this . DB this . params = { driverPath driver }