fix some tests
This commit is contained in:
parent
2925f6d444
commit
85871448bc
|
@ -50,36 +50,45 @@ try {
|
||||||
// with or without AE: 1 or 0 should be inserted when inserting into an integer column
|
// with or without AE: 1 or 0 should be inserted when inserting into an integer column
|
||||||
// double is inserted when inserting into a real column
|
// double is inserted when inserting into a real column
|
||||||
} else if ($pdoParamType == "PDO::PARAM_BOOL") {
|
} else if ($pdoParamType == "PDO::PARAM_BOOL") {
|
||||||
$sql = "SELECT c_det, c_rand FROM $tbname";
|
if ($r === false) {
|
||||||
$stmt = $conn->query($sql);
|
echo "Conversion from $pdoParamType to $dataType should be supported\n";
|
||||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
||||||
if ($dataType == "real") {
|
|
||||||
if (abs($row['c_det'] - $inputValues[0]) < $epsilon && abs($row['c_rand'] - $inputValues[1]) < $epsilon) {
|
|
||||||
echo "****Conversion from $pdoParamType to $dataType is supported****\n";
|
|
||||||
} else {
|
|
||||||
echo "Conversion from $pdoParamType to $dataType causes data corruption\n";
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ($row['c_det'] != ($inputValues[0] != 0) && $row['c_rand'] != ($inputValues[1] != 0)) {
|
$sql = "SELECT c_det, c_rand FROM $tbname";
|
||||||
echo "Conversion from $pdoParamType to $dataType insert a boolean\n";
|
$stmt = $conn->query($sql);
|
||||||
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
if ($dataType == "real") {
|
||||||
|
if (abs($row['c_det'] - $inputValues[0]) < $epsilon && abs($row['c_rand'] - $inputValues[1]) < $epsilon) {
|
||||||
|
echo "****Conversion from $pdoParamType to $dataType is supported****\n";
|
||||||
|
} else {
|
||||||
|
echo "Conversion from $pdoParamType to $dataType causes data corruption\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if ($row['c_det'] != ($inputValues[0] != 0) && $row['c_rand'] != ($inputValues[1] != 0)) {
|
||||||
|
echo "Conversion from $pdoParamType to $dataType insert a boolean\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// check the case when inserting as PDO::PARAM_INT, PDO::PARAM_STR or PDO::PARAM_LOB
|
// check the case when inserting as PDO::PARAM_INT, PDO::PARAM_STR or PDO::PARAM_LOB
|
||||||
|
// with or without AE: should work
|
||||||
} else {
|
} else {
|
||||||
$sql = "SELECT c_det, c_rand FROM $tbname";
|
if ($r === false) {
|
||||||
$stmt = $conn->query($sql);
|
echo "Conversion from $pdoParamType to $dataType should be supported\n";
|
||||||
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
|
||||||
if ($dataType == "real") {
|
|
||||||
if (abs($row['c_det'] - $inputValues[0]) < $epsilon && abs($row['c_rand'] - $inputValues[1]) < $epsilon) {
|
|
||||||
echo "****Conversion from $pdoParamType to $dataType is supported****\n";
|
|
||||||
} else {
|
|
||||||
echo "Conversion from $pdoParamType to $dataType causes data corruption\n";
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if ($row['c_det'] == $inputValues[0] && $row['c_rand'] == $inputValues[1]) {
|
$sql = "SELECT c_det, c_rand FROM $tbname";
|
||||||
echo "****Conversion from $pdoParamType to $dataType is supported****\n";
|
$stmt = $conn->query($sql);
|
||||||
|
$row = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||||
|
if ($dataType == "real") {
|
||||||
|
if (abs($row['c_det'] - $inputValues[0]) < $epsilon && abs($row['c_rand'] - $inputValues[1]) < $epsilon) {
|
||||||
|
echo "****Conversion from $pdoParamType to $dataType is supported****\n";
|
||||||
|
} else {
|
||||||
|
echo "Conversion from $pdoParamType to $dataType causes data corruption\n";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
echo "Conversion from $pdoParamType to $dataType causes data corruption\n";
|
if ($row['c_det'] == $inputValues[0] && $row['c_rand'] == $inputValues[1]) {
|
||||||
|
echo "****Conversion from $pdoParamType to $dataType is supported****\n";
|
||||||
|
} else {
|
||||||
|
echo "Conversion from $pdoParamType to $dataType causes data corruption\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,7 @@ foreach($dataTypes as $dataType) {
|
||||||
echo "****Conversion from $sqlType to $typeFull is supported****\n";
|
echo "****Conversion from $sqlType to $typeFull is supported****\n";
|
||||||
} else {
|
} else {
|
||||||
echo "Conversion from $sqlType to $typeFull causes data corruption\n";
|
echo "Conversion from $sqlType to $typeFull causes data corruption\n";
|
||||||
|
var_dump($row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ Testing float(24):
|
||||||
Test successfully done
|
Test successfully done
|
||||||
|
|
||||||
Testing float(36):
|
Testing float(36):
|
||||||
Conversion from SQLSRV_SQLTYPE_FLOAT to float(36) should be supported
|
****Conversion from SQLSRV_SQLTYPE_FLOAT to float(36) is supported****
|
||||||
|
|
||||||
Testing float(53):
|
Testing float(53):
|
||||||
Conversion from SQLSRV_SQLTYPE_FLOAT to float(53) should be supported
|
****Conversion from SQLSRV_SQLTYPE_FLOAT to float(53) is supported****
|
Loading…
Reference in a new issue