summaryrefslogtreecommitdiff
path: root/datadict
diff options
context:
space:
mode:
authorDamien Regad <dregad@mantisbt.org>2021-03-11 19:27:26 +0100
committerDamien Regad <dregad@mantisbt.org>2021-03-11 19:27:26 +0100
commitac284ab4e47ca01f22096cde32b5833c60ae69ee (patch)
tree4807dbb26c855370ffc5aafb57fdf48c5c81b8ba /datadict
parent91dbbef4f56543d52f9cc97c7239b02119ab0253 (diff)
downloadadodb-ac284ab4e47ca01f22096cde32b5833c60ae69ee.tar.gz
adodb-ac284ab4e47ca01f22096cde32b5833c60ae69ee.tar.bz2
adodb-ac284ab4e47ca01f22096cde32b5833c60ae69ee.zip
Fix PHPStorm static analysis warnings
- SQL syntax - unused variables - duplicated code - Whitespace - Variables and return types in PHPDoc
Diffstat (limited to 'datadict')
-rw-r--r--datadict/datadict-mssqlnative.inc.php44
1 files changed, 24 insertions, 20 deletions
diff --git a/datadict/datadict-mssqlnative.inc.php b/datadict/datadict-mssqlnative.inc.php
index b4a5eb9b..8eee8390 100644
--- a/datadict/datadict-mssqlnative.inc.php
+++ b/datadict/datadict-mssqlnative.inc.php
@@ -45,7 +45,7 @@ if (!defined('ADODB_DIR')) die();
class ADODB2_mssqlnative extends ADODB_DataDict {
var $databaseType = 'mssqlnative';
- var $dropIndex = 'DROP INDEX %1$s ON %2$s';
+ var $dropIndex = /** @lang text */ 'DROP INDEX %1$s ON %2$s';
var $renameTable = "EXEC sp_rename '%s','%s'";
var $renameColumn = "EXEC sp_rename '%s.%s','%s'";
var $typeX = 'TEXT'; ## Alternatively, set it to VARCHAR(4000)
@@ -61,7 +61,6 @@ class ADODB2_mssqlnative extends ADODB_DataDict {
if (is_object($t)) {
$fieldobj = $t;
$t = $fieldobj->type;
- $len = $fieldobj->max_length;
}
$_typeConversion = array(
@@ -97,11 +96,11 @@ class ADODB2_mssqlnative extends ADODB_DataDict {
-3 => 'X'
);
- if (isset($_typeConversion[$t]))
- return $_typeConversion[$t];
-
- return ADODB_DEFAULT_METATYPE;
+ if (isset($_typeConversion[$t])) {
+ return $_typeConversion[$t];
+ }
+ return ADODB_DEFAULT_METATYPE;
}
function ActualType($meta)
@@ -141,7 +140,7 @@ class ADODB2_mssqlnative extends ADODB_DataDict {
{
$tabname = $this->TableName ($tabname);
$f = array();
- list($lines,$pkey) = $this->_GenFields($flds);
+ list($lines,) = $this->_GenFields($flds);
$s = "ALTER TABLE $tabname $this->addCol";
foreach($lines as $v) {
$f[] = "\n $v";
@@ -171,10 +170,9 @@ class ADODB2_mssqlnative extends ADODB_DataDict {
$tabname = $this->TableName ($tabname);
$sql = array();
- list($lines,$pkey,$idxs) = $this->_GenFields($flds);
+ list($lines,,$idxs) = $this->_GenFields($flds);
$alter = 'ALTER TABLE ' . $tabname . $this->alterCol . ' ';
foreach($lines as $v) {
- $not_null = false;
if ($not_null = preg_match('/NOT NULL/i',$v)) {
$v = preg_replace('/NOT NULL/i','',$v);
}
@@ -223,13 +221,15 @@ class ADODB2_mssqlnative extends ADODB_DataDict {
* @param string $tableflds Throwaway value to make the function match the parent
* @param string $tableoptions Throway value to make the function match the parent
*
- * @return string The SQL necessary to drop the column
+ * @return string[] The SQL necessary to drop the column
*/
function DropColumnSQL($tabname, $flds, $tableflds='',$tableoptions='')
{
$tabname = $this->TableName ($tabname);
- if (!is_array($flds))
- $flds = explode(',',$flds);
+ if (!is_array($flds)) {
+ /** @noinspection PhpParamsInspection */
+ $flds = explode(',', $flds);
+ }
$f = array();
$s = 'ALTER TABLE ' . $tabname;
foreach($flds as $v) {
@@ -244,6 +244,8 @@ class ADODB2_mssqlnative extends ADODB_DataDict {
}
// return string must begin with space
+
+ /** @noinspection DuplicatedCode */
function _CreateSuffix($fname,&$ftype,$fnotnull,$fdefault,$fautoinc,$fconstraint,$funsigned)
{
$suffix = '';
@@ -327,6 +329,7 @@ CREATE TABLE
SORT_IN_TEMPDB
}
*/
+ /** @noinspection DuplicatedCode */
function _IndexSQL($idxname, $tabname, $flds, $idxoptions)
{
$sql = array();
@@ -358,17 +361,18 @@ CREATE TABLE
}
- function _GetSize($ftype, $ty, $fsize, $fprec,$options=false)
+ function _GetSize($ftype, $ty, $fsize, $fprec, $options=false)
{
switch ($ftype) {
- case 'INT':
- case 'SMALLINT':
- case 'TINYINT':
- case 'BIGINT':
+ case 'INT':
+ case 'SMALLINT':
+ case 'TINYINT':
+ case 'BIGINT':
+ return $ftype;
+ }
+ if ($ty == 'T') {
return $ftype;
}
- if ($ty == 'T') return $ftype;
- return parent::_GetSize($ftype, $ty, $fsize, $fprec, $options);
-
+ return parent::_GetSize($ftype, $ty, $fsize, $fprec, $options);
}
}