mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-10-01 01:26:10 -04:00
prefer switch statements for complex logic, all comparing the same variable
This commit is contained in:
parent
a8e1c33b54
commit
56c54dd880
@ -705,10 +705,14 @@ class Database extends AbstractData
|
||||
private static function _getPrimaryKeyClauses($key = 'dataid')
|
||||
{
|
||||
$main_key = $after_key = '';
|
||||
if (self::$_type === 'mysql' || self::$_type === 'oci') {
|
||||
$after_key = ", PRIMARY KEY (\"$key\")";
|
||||
} else {
|
||||
$main_key = ' PRIMARY KEY';
|
||||
switch (self::$_type) {
|
||||
case 'mysql':
|
||||
case 'oci':
|
||||
$after_key = ", PRIMARY KEY (\"$key\")";
|
||||
break;
|
||||
default:
|
||||
$main_key = ' PRIMARY KEY';
|
||||
break;
|
||||
}
|
||||
return array($main_key, $after_key);
|
||||
}
|
||||
@ -724,7 +728,14 @@ class Database extends AbstractData
|
||||
*/
|
||||
private static function _getDataType()
|
||||
{
|
||||
return self::$_type === 'pgsql' ? 'TEXT' : (self::$_type === 'oci' ? 'CLOB' : 'BLOB');
|
||||
switch (self::$_type) {
|
||||
case 'oci':
|
||||
return 'CLOB';
|
||||
case 'pgsql':
|
||||
return 'TEXT';
|
||||
default:
|
||||
return 'BLOB';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -738,7 +749,14 @@ class Database extends AbstractData
|
||||
*/
|
||||
private static function _getAttachmentType()
|
||||
{
|
||||
return self::$_type === 'pgsql' ? 'TEXT' : (self::$_type === 'oci' ? 'CLOB' : 'MEDIUMBLOB');
|
||||
switch (self::$_type) {
|
||||
case 'oci':
|
||||
return 'CLOB';
|
||||
case 'pgsql':
|
||||
return 'TEXT';
|
||||
default:
|
||||
return 'MEDIUMBLOB';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -752,7 +770,12 @@ class Database extends AbstractData
|
||||
*/
|
||||
private static function _getMetaType()
|
||||
{
|
||||
return self::$_type === 'oci' ? 'VARCHAR2(4000)' : 'TEXT';
|
||||
switch (self::$_type) {
|
||||
case 'oci':
|
||||
return 'VARCHAR2(4000)';
|
||||
default:
|
||||
return 'TEXT';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user