Skip to content

Commit

Permalink
Update PicoDatabaseUtilSqlite.php
Browse files Browse the repository at this point in the history
  • Loading branch information
kamshory committed Nov 13, 2024
1 parent a9a0fe2 commit 33b6012
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions src/Util/Database/PicoDatabaseUtilSqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,11 +370,20 @@ public function createColumn($column)
*/
public function fixDefaultValue($defaultValue, $type)
{
if(strtolower($defaultValue) == 'true' || strtolower($defaultValue) == 'false' || strtolower($defaultValue) == 'null')
if(strtolower($defaultValue) == 'true'
|| strtolower($defaultValue) == 'false'
|| strtolower($defaultValue) == 'null'
)
{
return $defaultValue;
}
if(stripos($type, 'enum') !== false || stripos($type, 'char') !== false || stripos($type, 'text') !== false || stripos($type, 'int') !== false || stripos($type, 'float') !== false || stripos($type, 'double') !== false)
if(stripos($type, 'enum') !== false
|| stripos($type, 'char') !== false
|| stripos($type, 'text') !== false
|| stripos($type, 'int') !== false
|| stripos($type, 'float') !== false
|| stripos($type, 'double') !== false
)
{
return "'".$defaultValue."'";
}
Expand Down Expand Up @@ -402,17 +411,25 @@ public function fixImportData($data, $columns)
{
$type = $columns[$name];

if(strtolower($type) == 'tinyint(1)' || strtolower($type) == 'boolean' || strtolower($type) == 'bool')
if(strtolower($type) == 'tinyint(1)'
|| strtolower($type) == 'boolean'
|| strtolower($type) == 'bool'
)
{
// Process boolean types
$data = $this->fixBooleanData($data, $name, $value);
}
else if(stripos($type, 'integer') !== false || stripos($type, 'int(') !== false)
else if(stripos($type, 'integer') !== false
|| stripos($type, 'int(') !== false
)
{
// Process integer types
$data = $this->fixIntegerData($data, $name, $value);
}
else if(stripos($type, 'float') !== false || stripos($type, 'double') !== false || stripos($type, 'decimal') !== false)
else if(stripos($type, 'float') !== false
|| stripos($type, 'double') !== false
|| stripos($type, 'decimal') !== false
)
{
// Process float types
$data = $this->fixFloatData($data, $name, $value);
Expand Down

0 comments on commit 33b6012

Please sign in to comment.