Fix DB IO write array method

Data was not written correctly in connection with boolean field types as
the "has default" was used as if a default value, but it is just a flag
IF it has a default value
This commit is contained in:
Clemens Schwaighofer
2017-09-26 13:33:52 +09:00
parent 1e164f3b93
commit 1cc010818d
2 changed files with 14 additions and 8 deletions

View File

@@ -89,13 +89,14 @@
# db write class test
$table = 'foo';
$primary_key = ''; # unset
$db_write_table = array ('test');
$db_write_table = array ('test', 'some_bool');
// $db_write_table = array ('test');
$object_fields_not_touch = array ();
$object_fields_not_update = array ();
$data = array ('test' => 'SOMETHING '.time());
$data = array ('test' => 'BOOL TEST SOMETHING '.time());
$primary_key = $basic->db_write_data_ext($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
print "Wrote to DB tabel $table and got primary key $primary_key<br>";
$data = array ('test' => '');
$data = array ('test' => 'BOOL TEST OFF '.time(), 'some_bool' => 1);
$primary_key = $basic->db_write_data_ext($db_write_table, $primary_key, $table, $object_fields_not_touch, $object_fields_not_update, $data);
print "Wrote to DB tabel $table and got primary key $primary_key<br>";