Fix issue with null values passed natively to DB query statements as bound statements

This commit is contained in:
Dan Stillman 2006-06-27 14:14:40 +00:00
parent 3b119d4c6e
commit bc18f42f81

View File

@ -171,17 +171,17 @@ Scholar.DB = new function(){
if (statement && params){ if (statement && params){
for (var i=0; i<params.length; i++){ for (var i=0; i<params.length; i++){
// Integer // Integer
if (typeof params[i]['int'] != 'undefined'){ if (params[i]!==null && typeof params[i]['int'] != 'undefined'){
var type = 'int'; var type = 'int';
var value = params[i]['int']; var value = params[i]['int'];
} }
// String // String
else if (typeof params[i]['string'] != 'undefined'){ else if (params[i]!==null && typeof params[i]['string'] != 'undefined'){
var type = 'string'; var type = 'string';
var value = params[i]['string']; var value = params[i]['string'];
} }
// Null // Null
else if (typeof params[i]['null'] != 'undefined'){ else if (params[i]!==null && typeof params[i]['null'] != 'undefined'){
var type = 'null'; var type = 'null';
} }
// Automatic (trust the JS type) // Automatic (trust the JS type)
@ -195,8 +195,7 @@ Scholar.DB = new function(){
break; break;
// Object // Object
default: default:
// Null value will show as object if (params[i]===null){
if (!params[i]){
var type = 'null'; var type = 'null';
} }
else { else {