Modified: pear/packages/MDB2/trunk/MDB2/Driver/Datatype/Common.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Datatype/Common.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Datatype/Common.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -232,7 +232,7 @@ */ function convertResult($value, $type, $rtrim = true) { - if (is_null($value)) { + if (null === $value) { return null; } $db =& $this->getDBInstance(); @@ -313,7 +313,7 @@ if (count($types)) { reset($types); foreach (array_keys($sorted_types) as $k) { - if (is_null($sorted_types[$k])) { + if (null === $sorted_types[$k]) { $sorted_types[$k] = current($types); next($types); } @@ -511,7 +511,7 @@ $field['default'] = ' '; } } - if (!is_null($field['default'])) { + if (null !== $field['default']) { $default = ' DEFAULT ' . $this->quote($field['default'], $field['type']); } } @@ -1119,7 +1119,7 @@ return $db; } - if (is_null($value) + if ((null === $value) || ($value === '' && $db->options['portability'] & MDB2_PORTABILITY_EMPTY_TO_NULL) ) { if (!$quote) { @@ -1128,7 +1128,7 @@ return 'NULL'; } - if (is_null($type)) { + if (null === $type) { switch (gettype($value)) { case 'integer': $type = 'integer'; @@ -1560,7 +1560,7 @@ */ function _retrieveLOB(&$lob) { - if (is_null($lob['value'])) { + if (null === $lob['value']) { $lob['value'] = $lob['resource']; } $lob['loaded'] = true; @@ -1693,12 +1693,12 @@ } $match = ''; - if (!is_null($operator)) { + if (null !== $operator) { $operator = strtoupper($operator); switch ($operator) { // case insensitive case 'ILIKE': - if (is_null($field)) { + if (null === $field) { return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'case insensitive LIKE matching requires passing the field name', __FUNCTION__); } @@ -1706,7 +1706,7 @@ $match = $db->function->lower($field).' LIKE '; break; case 'NOT ILIKE': - if (is_null($field)) { + if (null === $field) { return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'case insensitive NOT ILIKE matching requires passing the field name', __FUNCTION__); } @@ -1715,10 +1715,10 @@ break; // case sensitive case 'LIKE': - $match = is_null($field) ? 'LIKE ' : ($field.' LIKE '); + $match = (null === $field) ? 'LIKE ' : ($field.' LIKE '); break; case 'NOT LIKE': - $match = is_null($field) ? 'NOT LIKE ' : ($field.' NOT LIKE '); + $match = (null === $field) ? 'NOT LIKE ' : ($field.' NOT LIKE '); break; default: return $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, Modified: pear/packages/MDB2/trunk/MDB2/Driver/Datatype/fbsql.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Datatype/fbsql.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Datatype/fbsql.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -70,7 +70,7 @@ */ function _baseConvertResult($value, $type, $rtrim = true) { - if (is_null($value)) { + if (null === $value) { return null; } switch ($type) { Modified: pear/packages/MDB2/trunk/MDB2/Driver/Datatype/ibase.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Datatype/ibase.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Datatype/ibase.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -71,7 +71,7 @@ */ function _baseConvertResult($value, $type, $rtrim = true) { - if (is_null($value)) { + if (null === $value) { return null; } $db =& $this->getDBInstance(); Modified: pear/packages/MDB2/trunk/MDB2/Driver/Datatype/mssql.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Datatype/mssql.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Datatype/mssql.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -71,7 +71,7 @@ */ function _baseConvertResult($value, $type, $rtrim = true) { - if (is_null($value)) { + if (null === $value) { return null; } switch ($type) { @@ -228,7 +228,7 @@ if ($field['default'] === '') { $field['default'] = 0; } - if (is_null($field['default'])) { + if (null === $field['default']) { $default = ' DEFAULT (null)'; } else { $default = ' DEFAULT (' . $this->quote($field['default'], 'integer') . ')'; @@ -361,8 +361,8 @@ } $match = ''; - if (!is_null($operator)) { - $field = is_null($field) ? '' : $field.' '; + if (null !== $operator) { + $field = (null === $field) ? '' : $field.' '; $operator = strtoupper($operator); switch ($operator) { // case insensitive Modified: pear/packages/MDB2/trunk/MDB2/Driver/Datatype/mysql.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Datatype/mysql.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Datatype/mysql.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -352,8 +352,8 @@ } $match = ''; - if (!is_null($operator)) { - $field = is_null($field) ? '' : $field.' '; + if (null !== $operator) { + $field = (null === $field) ? '' : $field.' '; $operator = strtoupper($operator); switch ($operator) { // case insensitive Modified: pear/packages/MDB2/trunk/MDB2/Driver/Datatype/mysqli.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Datatype/mysqli.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Datatype/mysqli.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -352,8 +352,8 @@ } $match = ''; - if (!is_null($operator)) { - $field = is_null($field) ? '' : $field.' '; + if (null !== $operator) { + $field = (null === $field) ? '' : $field.' '; $operator = strtoupper($operator); switch ($operator) { // case insensitive Modified: pear/packages/MDB2/trunk/MDB2/Driver/Datatype/oci8.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Datatype/oci8.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Datatype/oci8.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -68,7 +68,7 @@ */ function _baseConvertResult($value, $type, $rtrim = true) { - if (is_null($value)) { + if (null === $value) { return null; } switch ($type) { Modified: pear/packages/MDB2/trunk/MDB2/Driver/Datatype/pgsql.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Datatype/pgsql.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Datatype/pgsql.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -68,7 +68,7 @@ */ function _baseConvertResult($value, $type, $rtrim = true) { - if (is_null($value)) { + if (null === $value) { return null; } switch ($type) { @@ -339,8 +339,8 @@ } $match = ''; - if (!is_null($operator)) { - $field = is_null($field) ? '' : $field.' '; + if (null !== $operator) { + $field = (null === $field) ? '' : $field.' '; $operator = strtoupper($operator); switch ($operator) { // case insensitive Modified: pear/packages/MDB2/trunk/MDB2/Driver/Datatype/sqlite.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Datatype/sqlite.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Datatype/sqlite.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -243,8 +243,8 @@ } $match = ''; - if (!is_null($operator)) { - $field = is_null($field) ? '' : $field.' '; + if (null !== $operator) { + $field = (null === $field) ? '' : $field.' '; $operator = strtoupper($operator); switch ($operator) { // case insensitive Modified: pear/packages/MDB2/trunk/MDB2/Driver/Datatype/sqlsrv.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Datatype/sqlsrv.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Datatype/sqlsrv.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -67,7 +67,7 @@ */ function _baseConvertResult($value, $type, $rtrim = true) { - if (is_null($value)) { + if (null === $value) { return null; } switch ($type) { @@ -224,8 +224,8 @@ if ($field['default'] === '') { $field['default'] = 0; } - if (is_null($field['default'])) { - $default = ' DEFAULT (null)'; + if (null === $field['default']) { + $default = ' DEFAULT (NULL)'; } else { $default = ' DEFAULT (' . $this->quote($field['default'], 'integer') . ')'; } Modified: pear/packages/MDB2/trunk/MDB2/Driver/Function/Common.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Function/Common.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Function/Common.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -166,7 +166,7 @@ */ function substring($value, $position = 1, $length = null) { - if (!is_null($length)) { + if (null !== $length) { return "SUBSTRING($value FROM $position FOR $length)"; } return "SUBSTRING($value FROM $position)"; Modified: pear/packages/MDB2/trunk/MDB2/Driver/Function/mssql.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Function/mssql.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Function/mssql.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -134,7 +134,7 @@ */ function substring($value, $position = 1, $length = null) { - if (!is_null($length)) { + if (null !== $length) { return "SUBSTRING($value, $position, $length)"; } return "SUBSTRING($value, $position, LEN($value) - $position + 1)"; Modified: pear/packages/MDB2/trunk/MDB2/Driver/Function/oci8.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Function/oci8.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Function/oci8.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -148,7 +148,7 @@ */ function substring($value, $position = 1, $length = null) { - if (!is_null($length)) { + if (null !== $length) { return "SUBSTR($value, $position, $length)"; } return "SUBSTR($value, $position)"; Modified: pear/packages/MDB2/trunk/MDB2/Driver/Function/sqlite.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Function/sqlite.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Function/sqlite.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -116,10 +116,10 @@ */ function substring($value, $position = 1, $length = null) { - if (!is_null($length)) { - return "substr($value,$position,$length)"; + if (null !== $length) { + return "substr($value, $position, $length)"; } - return "substr($value,$position,length($value))"; + return "substr($value, $position, length($value))"; } // }}} Modified: pear/packages/MDB2/trunk/MDB2/Driver/Function/sqlsrv.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Function/sqlsrv.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Function/sqlsrv.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -130,7 +130,7 @@ */ function substring($value, $position = 1, $length = null) { - if (!is_null($length)) { + if (null !== $length) { return "SUBSTRING($value, $position, $length)"; } return "SUBSTRING($value, $position, LEN($value) - $position + 1)"; Modified: pear/packages/MDB2/trunk/MDB2/Driver/Manager/ibase.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Manager/ibase.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Manager/ibase.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -140,7 +140,7 @@ } $table_quoted = $db->quoteIdentifier($table, true); - if (is_null($start)) { + if (null === $start) { $db->beginTransaction(); $query = 'SELECT MAX(' . $db->quoteIdentifier($name, true) . ') FROM ' . $table_quoted; $start = $this->db->queryOne($query, 'integer'); @@ -790,7 +790,7 @@ FROM RDB$TRIGGERS WHERE (RDB$SYSTEM_FLAG IS NULL OR RDB$SYSTEM_FLAG = 0)'; - if (!is_null($table)) { + if (null !== $table) { $table = $db->quote(strtoupper($table), 'text'); $query .= " AND UPPER(RDB\$RELATION_NAME)=$table"; } Modified: pear/packages/MDB2/trunk/MDB2/Driver/Manager/mssql.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Manager/mssql.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Manager/mssql.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -893,7 +893,7 @@ FROM sysobjects o WHERE xtype = 'TR' AND OBJECTPROPERTY(o.id, 'IsMSShipped') = 0"; - if (!is_null($table)) { + if (null !== $table) { $query .= " AND object_name(parent_obj) = $table"; } Modified: pear/packages/MDB2/trunk/MDB2/Driver/Manager/mysql.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Manager/mysql.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Manager/mysql.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -222,7 +222,7 @@ $autoincrement = $fieldname; } } - if (!is_null($autoincrement) && count($pk_fields) > 1) { + if ((null !== $autoincrement) && count($pk_fields) > 1) { $options['primary'] = $pk_fields; } else { // the PK constraint is on max one field => OK @@ -235,7 +235,7 @@ return $query; } - if (!is_null($autoincrement)) { + if (null !== $autoincrement) { // we have to remove the PK clause added by _getIntegerDeclaration() $query = str_replace('AUTO_INCREMENT PRIMARY KEY', 'AUTO_INCREMENT', $query); } @@ -659,7 +659,7 @@ } $query = 'SHOW TRIGGERS'; - if (!is_null($table)) { + if (null !== $table) { $table = $db->quote($table, 'text'); $query .= " LIKE $table"; } @@ -691,7 +691,7 @@ } $query = "SHOW /*!50002 FULL*/ TABLES"; - if (!is_null($database)) { + if (null !== $database) { $query .= " FROM $database"; } $query.= "/*!50002 WHERE Table_type = 'BASE TABLE'*/"; @@ -731,7 +731,7 @@ } $query = 'SHOW FULL TABLES'; - if (!is_null($database)) { + if (null !== $database) { $query.= " FROM $database"; } $query.= " WHERE Table_type = 'VIEW'"; @@ -1413,7 +1413,7 @@ } $query = "SHOW TABLES"; - if (!is_null($database)) { + if (null !== $database) { $query .= " FROM $database"; } $table_names = $db->queryCol($query); Modified: pear/packages/MDB2/trunk/MDB2/Driver/Manager/mysqli.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Manager/mysqli.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Manager/mysqli.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -222,7 +222,7 @@ $autoincrement = $fieldname; } } - if (!is_null($autoincrement) && count($pk_fields) > 1) { + if ((null !== $autoincrement) && count($pk_fields) > 1) { $options['primary'] = $pk_fields; } else { // the PK constraint is on max one field => OK @@ -235,7 +235,7 @@ return $query; } - if (!is_null($autoincrement)) { + if (null !== $autoincrement) { // we have to remove the PK clause added by _getIntegerDeclaration() $query = str_replace('AUTO_INCREMENT PRIMARY KEY', 'AUTO_INCREMENT', $query); } @@ -659,7 +659,7 @@ } $query = 'SHOW TRIGGERS'; - if (!is_null($table)) { + if (null !== $table) { $table = $db->quote($table, 'text'); $query .= " LIKE $table"; } @@ -691,7 +691,7 @@ } $query = "SHOW /*!50002 FULL*/ TABLES"; - if (!is_null($database)) { + if (null !== $database) { $query .= " FROM $database"; } $query.= "/*!50002 WHERE Table_type = 'BASE TABLE'*/"; @@ -731,7 +731,7 @@ } $query = 'SHOW FULL TABLES'; - if (!is_null($database)) { + if (null !== $database) { $query.= " FROM $database"; } $query.= " WHERE Table_type = 'VIEW'"; @@ -1413,7 +1413,7 @@ } $query = "SHOW TABLES"; - if (!is_null($database)) { + if (null !== $database) { $query .= " FROM $database"; } $table_names = $db->queryCol($query); Modified: pear/packages/MDB2/trunk/MDB2/Driver/Manager/oci8.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Manager/oci8.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Manager/oci8.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -213,7 +213,7 @@ 'primary key for autoincrement PK could not be created', __FUNCTION__); } - if (is_null($start)) { + if (null === $start) { $db->beginTransaction(); $query = 'SELECT MAX(' . $db->quoteIdentifier($name, true) . ') FROM ' . $db->quoteIdentifier($table, true); $start = $this->db->queryOne($query, 'integer'); Modified: pear/packages/MDB2/trunk/MDB2/Driver/Manager/pgsql.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Manager/pgsql.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Manager/pgsql.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -608,7 +608,7 @@ FROM pg_trigger trg, pg_class tbl WHERE trg.tgrelid = tbl.oid'; - if (!is_null($table)) { + if (null !== $table) { $table = $db->quote(strtoupper($table), 'text'); $query .= " AND UPPER(tbl.relname) = $table"; } Modified: pear/packages/MDB2/trunk/MDB2/Driver/Manager/sqlite.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Manager/sqlite.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Manager/sqlite.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -904,7 +904,7 @@ } $query = "SELECT name FROM sqlite_master WHERE type='trigger' AND sql NOT NULL"; - if (!is_null($table)) { + if (null !== $table) { if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) { $query.= ' AND LOWER(tbl_name)='.$db->quote(strtolower($table), 'text'); } else { Modified: pear/packages/MDB2/trunk/MDB2/Driver/Manager/sqlsrv.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Manager/sqlsrv.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Manager/sqlsrv.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -910,7 +910,7 @@ FROM sysobjects o WHERE xtype = 'TR' AND OBJECTPROPERTY(o.id, 'IsMSShipped') = 0"; - if (!is_null($table)) { + if (null !== $table) { $query .= " AND object_name(parent_obj) = $table"; } Modified: pear/packages/MDB2/trunk/MDB2/Driver/Reverse/ibase.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Reverse/ibase.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Reverse/ibase.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -196,7 +196,7 @@ list($types, $length, $unsigned, $fixed) = $mapped_datatype; $notnull = !empty($column['null_flag']); $default = $column['default_source']; - if (is_null($default) && $notnull) { + if ((null === $default) && $notnull) { $default = ($types[0] == 'integer') ? 0 : ''; } @@ -206,16 +206,16 @@ 'charset' => $column['charset'], 'collation' => $column['collation'], ); - if (!is_null($length)) { + if (null !== $length) { $definition[0]['length'] = $length; } - if (!is_null($unsigned)) { + if (null !== $unsigned) { $definition[0]['unsigned'] = $unsigned; } - if (!is_null($fixed)) { + if (null !== $fixed) { $definition[0]['fixed'] = $fixed; } - if ($default !== false) { + if (false !== $default) { $definition[0]['default'] = $default; } foreach ($types as $key => $type) { @@ -262,7 +262,7 @@ ORDER BY RDB\$INDEX_SEGMENTS.RDB\$FIELD_POSITION"; $index_name_mdb2 = $db->quote(strtoupper($db->getIndexName($index_name)), 'text'); $result = $db->queryRow(sprintf($query, $index_name_mdb2)); - if (!PEAR::isError($result) && !is_null($result)) { + if (!PEAR::isError($result) && (null !== $result)) { // apply 'idxname_format' only if the query succeeded, otherwise // fallback to the given $index_name, without transformation $index_name = $index_name_mdb2; @@ -354,7 +354,7 @@ ORDER BY s.RDB\$FIELD_POSITION"; $constraint_name_mdb2 = $db->quote(strtoupper($db->getIndexName($constraint_name)), 'text'); $result = $db->queryRow(sprintf($query, $constraint_name_mdb2)); - if (!PEAR::isError($result) && !is_null($result)) { + if (!PEAR::isError($result) && (null !== $result)) { // apply 'idxname_format' only if the query succeeded, otherwise // fallback to the given $index_name, without transformation $constraint_name = $constraint_name_mdb2; Modified: pear/packages/MDB2/trunk/MDB2/Driver/Reverse/mssql.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Reverse/mssql.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Reverse/mssql.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -134,7 +134,7 @@ $default = false; if (array_key_exists('column_default', $column)) { $default = $column['column_default']; - if (is_null($default) && $notnull) { + if ((null === $default) && $notnull) { $default = ''; } elseif (strlen($default) > 4 && substr($default, 0, 1) == '(' @@ -151,16 +151,16 @@ 'notnull' => $notnull, 'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type']) ); - if (!is_null($length)) { + if (null !== $length) { $definition[0]['length'] = $length; } - if (!is_null($unsigned)) { + if (null !== $unsigned) { $definition[0]['unsigned'] = $unsigned; } - if (!is_null($fixed)) { + if (null !== $fixed) { $definition[0]['fixed'] = $fixed; } - if ($default !== false) { + if (false !== $default) { $definition[0]['default'] = $default; } foreach ($types as $key => $type) { @@ -222,7 +222,7 @@ $index_name_mdb2 = $db->getIndexName($index_name); $result = $db->queryRow(sprintf($query, $index_name_mdb2)); - if (!PEAR::isError($result) && !is_null($result)) { + if (!PEAR::isError($result) && (null !== $result)) { // apply 'idxname_format' only if the query succeeded, otherwise // fallback to the given $index_name, without transformation $index_name = $index_name_mdb2; @@ -320,7 +320,7 @@ $constraint_name_mdb2 = $db->getIndexName($constraint_name); $result = $db->queryRow(sprintf($query, $constraint_name_mdb2)); - if (!PEAR::isError($result) && !is_null($result)) { + if (!PEAR::isError($result) && (null !== $result)) { // apply 'idxname_format' only if the query succeeded, otherwise // fallback to the given $index_name, without transformation $constraint_name = $constraint_name_mdb2; Modified: pear/packages/MDB2/trunk/MDB2/Driver/Reverse/mysql.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Reverse/mysql.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Reverse/mysql.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -113,7 +113,7 @@ $default = false; if (array_key_exists('default', $column)) { $default = $column['default']; - if (is_null($default) && $notnull) { + if ((null === $default) && $notnull) { $default = ''; } } @@ -131,13 +131,13 @@ 'notnull' => $notnull, 'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type']) ); - if (!is_null($length)) { + if (null !== $length) { $definition[0]['length'] = $length; } - if (!is_null($unsigned)) { + if (null !== $unsigned) { $definition[0]['unsigned'] = $unsigned; } - if (!is_null($fixed)) { + if (null !== $fixed) { $definition[0]['fixed'] = $fixed; } if ($default !== false) { @@ -146,7 +146,7 @@ if ($autoincrement !== false) { $definition[0]['autoincrement'] = $autoincrement; } - if (!is_null($collate)) { + if (null !== $collate) { $definition[0]['collate'] = $collate; $definition[0]['charset'] = $charset; } @@ -192,7 +192,7 @@ $query = "SHOW INDEX FROM $table /*!50002 WHERE Key_name = %s */"; $index_name_mdb2 = $db->getIndexName($index_name); $result = $db->queryRow(sprintf($query, $db->quote($index_name_mdb2))); - if (!PEAR::isError($result) && !is_null($result)) { + if (!PEAR::isError($result) && (null !== $result)) { // apply 'idxname_format' only if the query succeeded, otherwise // fallback to the given $index_name, without transformation $index_name = $index_name_mdb2; @@ -269,7 +269,7 @@ if (strtolower($constraint_name) != 'primary') { $constraint_name_mdb2 = $db->getIndexName($constraint_name); $result = $db->queryRow(sprintf($query, $db->quote($constraint_name_mdb2))); - if (!PEAR::isError($result) && !is_null($result)) { + if (!PEAR::isError($result) && (null !== $result)) { // apply 'idxname_format' only if the query succeeded, otherwise // fallback to the given $index_name, without transformation $constraint_name = $constraint_name_mdb2; Modified: pear/packages/MDB2/trunk/MDB2/Driver/Reverse/mysqli.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Reverse/mysqli.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Reverse/mysqli.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -167,7 +167,7 @@ $default = false; if (array_key_exists('default', $column)) { $default = $column['default']; - if (is_null($default) && $notnull) { + if ((null === $default) && $notnull) { $default = ''; } } @@ -185,13 +185,13 @@ 'notnull' => $notnull, 'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type']) ); - if (!is_null($length)) { + if (null !== $length) { $definition[0]['length'] = $length; } - if (!is_null($unsigned)) { + if (null !== $unsigned) { $definition[0]['unsigned'] = $unsigned; } - if (!is_null($fixed)) { + if (null !== $fixed) { $definition[0]['fixed'] = $fixed; } if ($default !== false) { @@ -200,7 +200,7 @@ if ($autoincrement !== false) { $definition[0]['autoincrement'] = $autoincrement; } - if (!is_null($collate)) { + if (null !== $collate) { $definition[0]['collate'] = $collate; $definition[0]['charset'] = $charset; } @@ -246,7 +246,7 @@ $query = "SHOW INDEX FROM $table /*!50002 WHERE Key_name = %s */"; $index_name_mdb2 = $db->getIndexName($index_name); $result = $db->queryRow(sprintf($query, $db->quote($index_name_mdb2))); - if (!PEAR::isError($result) && !is_null($result)) { + if (!PEAR::isError($result) && (null !== $result)) { // apply 'idxname_format' only if the query succeeded, otherwise // fallback to the given $index_name, without transformation $index_name = $index_name_mdb2; @@ -323,7 +323,7 @@ if (strtolower($constraint_name) != 'primary') { $constraint_name_mdb2 = $db->getIndexName($constraint_name); $result = $db->queryRow(sprintf($query, $db->quote($constraint_name_mdb2))); - if (!PEAR::isError($result) && !is_null($result)) { + if (!PEAR::isError($result) && (null !== $result)) { // apply 'idxname_format' only if the query succeeded, otherwise // fallback to the given $index_name, without transformation $constraint_name = $constraint_name_mdb2; Modified: pear/packages/MDB2/trunk/MDB2/Driver/Reverse/oci8.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Reverse/oci8.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Reverse/oci8.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -146,19 +146,19 @@ if ($default === 'NULL') { $default = null; } - if (is_null($default) && $notnull) { + if ((null === $default) && $notnull) { $default = ''; } } $definition[0] = array('notnull' => $notnull, 'nativetype' => $column['type']); - if (!is_null($length)) { + if (null !== $length) { $definition[0]['length'] = $length; } - if (!is_null($unsigned)) { + if (null !== $unsigned) { $definition[0]['unsigned'] = $unsigned; } - if (!is_null($fixed)) { + if (null !== $fixed) { $definition[0]['fixed'] = $fixed; } if ($default !== false) { @@ -242,7 +242,7 @@ $indexnames = array_unique(array($db->getIndexName($index_name), $index_name)); $i = 0; $row = null; - while (is_null($row) && array_key_exists($i, $indexnames)) { + while ((null === $row) && array_key_exists($i, $indexnames)) { $args = array( $table, strtoupper($table), @@ -261,7 +261,7 @@ } $i++; } - if (is_null($row)) { + if (null === $row) { return $db->raiseError(MDB2_ERROR_NOT_FOUND, null, null, $index_name. ' is not an index on table '. $table_name, __FUNCTION__); } @@ -271,7 +271,7 @@ } $definition = array(); - while (!is_null($row)) { + while (null !== $row) { $row = array_change_key_case($row, CASE_LOWER); $column_name = $row['column_name']; if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) { @@ -365,7 +365,7 @@ $constraintnames = array_unique(array($db->getIndexName($constraint_name), $constraint_name)); $c = 0; $row = null; - while (is_null($row) && array_key_exists($c, $constraintnames)) { + while ((null === $row) && array_key_exists($c, $constraintnames)) { $args = array( $constraintnames[$c], strtoupper($constraintnames[$c]), @@ -413,7 +413,7 @@ } } - while (!is_null($row)) { + while (null !== $row) { $row = array_change_key_case($row, CASE_LOWER); $column_name = $row['column_name']; if ($db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) { Modified: pear/packages/MDB2/trunk/MDB2/Driver/Reverse/pgsql.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Reverse/pgsql.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Reverse/pgsql.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -148,7 +148,7 @@ ) { $pattern = '/^\'(.*)\'::[\w ]+$/i'; $default = $column['default'];#substr($column['adsrc'], 1, -1); - if (is_null($default) && $notnull) { + if ((null === $default) && $notnull) { $default = ''; } elseif (!empty($default) && preg_match($pattern, $default)) { //remove data type cast @@ -160,13 +160,13 @@ $autoincrement = true; } $definition[0] = array('notnull' => $notnull, 'nativetype' => $column['type']); - if (!is_null($length)) { + if (null !== $length) { $definition[0]['length'] = $length; } - if (!is_null($unsigned)) { + if (null !== $unsigned) { $definition[0]['unsigned'] = $unsigned; } - if (!is_null($fixed)) { + if (null !== $fixed) { $definition[0]['fixed'] = $fixed; } if ($default !== false) { Modified: pear/packages/MDB2/trunk/MDB2/Driver/Reverse/sqlite.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Reverse/sqlite.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Reverse/sqlite.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -201,7 +201,7 @@ $default = false; if (array_key_exists('default', $column)) { $default = $column['default']; - if (is_null($default) && $notnull) { + if ((null === $default) && $notnull) { $default = ''; } } @@ -214,13 +214,13 @@ 'notnull' => $notnull, 'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type']) ); - if (!is_null($length)) { + if (null !== $length) { $definition[0]['length'] = $length; } - if (!is_null($unsigned)) { + if (null !== $unsigned) { $definition[0]['unsigned'] = $unsigned; } - if (!is_null($fixed)) { + if (null !== $fixed) { $definition[0]['fixed'] = $fixed; } if ($default !== false) { Modified: pear/packages/MDB2/trunk/MDB2/Driver/Reverse/sqlsrv.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/Reverse/sqlsrv.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/Reverse/sqlsrv.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -131,7 +131,7 @@ $default = false; if (array_key_exists('column_default', $column)) { $default = $column['column_default']; - if (is_null($default) && $notnull) { + if ((null === $default) && $notnull) { $default = ''; } elseif (strlen($default) > 4 && substr($default, 0, 1) == '(' @@ -148,13 +148,13 @@ 'notnull' => $notnull, 'nativetype' => preg_replace('/^([a-z]+)[^a-z].*/i', '\\1', $column['type']) ); - if (!is_null($length)) { + if (null !== $length) { $definition[0]['length'] = $length; } - if (!is_null($unsigned)) { + if (null !== $unsigned) { $definition[0]['unsigned'] = $unsigned; } - if (!is_null($fixed)) { + if (null !== $fixed) { $definition[0]['fixed'] = $fixed; } if ($default !== false) { @@ -219,7 +219,7 @@ $index_name_mdb2 = $db->getIndexName($index_name); $result = $db->queryRow(sprintf($query, $index_name_mdb2)); - if (!PEAR::isError($result) && !is_null($result)) { + if (!PEAR::isError($result) && (null !== $result)) { // apply 'idxname_format' only if the query succeeded, otherwise // fallback to the given $index_name, without transformation $index_name = $index_name_mdb2; @@ -317,7 +317,7 @@ $constraint_name_mdb2 = $db->getIndexName($constraint_name); $result = $db->queryRow(sprintf($query, $constraint_name_mdb2)); - if (!PEAR::isError($result) && !is_null($result)) { + if (!PEAR::isError($result) && (null !== $result)) { // apply 'idxname_format' only if the query succeeded, otherwise // fallback to the given $index_name, without transformation $constraint_name = $constraint_name_mdb2; Modified: pear/packages/MDB2/trunk/MDB2/Driver/fbsql.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/fbsql.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/fbsql.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -116,7 +116,7 @@ $native_code = @fbsql_errno(); $native_msg = @fbsql_error(); } - if (is_null($error)) { + if (null === $error) { static $ecode_map; if (empty($ecode_map)) { $ecode_map = array( @@ -159,10 +159,11 @@ function beginTransaction($savepoint = null) { $this->debug('Starting transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint)); - if (!is_null($savepoint)) { + if (null !== $savepoint) { return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'savepoints are not supported', __FUNCTION__); - } elseif ($this->in_transaction) { + } + if ($this->in_transaction) { return MDB2_OK; //nothing to do } if (!$this->destructor_registered && $this->opened_persistent) { @@ -198,7 +199,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'commit/release savepoint cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'savepoints are not supported', __FUNCTION__); } @@ -236,7 +237,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'rollback cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'savepoints are not supported', __FUNCTION__); } @@ -464,13 +465,13 @@ return $result; } - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; } } - if (is_null($database_name)) { + if (null === $database_name) { $database_name = $this->database_name; } @@ -509,7 +510,7 @@ */ function _affectedRows($connection, $result = null) { - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; @@ -661,7 +662,7 @@ */ function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null) { - if (!is_null($rownum)) { + if (null !== $rownum) { $seek = $this->seek($rownum); if (PEAR::isError($seek)) { return $seek; @@ -681,7 +682,7 @@ $row = @fbsql_fetch_row($this->result); } if (!$row) { - if ($this->result === false) { + if (false === $this->result) { $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); return $err; @@ -753,11 +754,12 @@ function numCols() { $cols = @fbsql_num_fields($this->result); - if (is_null($cols)) { - if ($this->result === false) { + if (null === $cols) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return count($this->types); } return $this->db->raiseError(null, null, null, @@ -777,10 +779,11 @@ */ function nextResult() { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return false; } return @fbsql_next_result($this->result); @@ -799,7 +802,7 @@ { if (is_resource($this->result) && $this->db->connection) { $free = @fbsql_free_result($this->result); - if ($free === false) { + if (false === $free) { return $this->db->raiseError(null, null, null, 'Could not free result', __FUNCTION__); } @@ -832,10 +835,11 @@ function seek($rownum = 0) { if ($this->rownum != ($rownum - 1) && !@fbsql_data_seek($this->result, $rownum)) { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return MDB2_OK; } return $this->db->raiseError(MDB2_ERROR_INVALID, null, null, @@ -875,11 +879,12 @@ function numRows() { $rows = @fbsql_num_rows($this->result); - if (is_null($rows)) { - if ($this->result === false) { + if (null === $rows) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return 0; } return $this->db->raiseError(null, null, null, Modified: pear/packages/MDB2/trunk/MDB2/Driver/ibase.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/ibase.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/ibase.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -133,7 +133,7 @@ $native_code = null; } } - if (is_null($error)) { + if (null === $error) { $error = MDB2_ERROR; if ($native_code) { // try to interpret Interbase error code (that's why we need ibase_errno() @@ -280,14 +280,15 @@ function beginTransaction($savepoint = null) { $this->debug('Starting transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint)); - if (!is_null($savepoint)) { + if (null !== $savepoint) { if (!$this->in_transaction) { return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'savepoint cannot be released when changes are auto committed', __FUNCTION__); } $query = 'SAVEPOINT '.$savepoint; return $this->_doQuery($query, true); - } elseif ($this->in_transaction) { + } + if ($this->in_transaction) { return MDB2_OK; //nothing to do } $connection = $this->getConnection(); @@ -325,7 +326,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'commit/release savepoint cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { $query = 'RELEASE SAVEPOINT '.$savepoint; return $this->_doQuery($query, true); } @@ -360,7 +361,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'rollback cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { $query = 'ROLLBACK TO SAVEPOINT '.$savepoint; return $this->_doQuery($query, true); } @@ -682,7 +683,7 @@ return null; } - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; @@ -690,7 +691,7 @@ } $result = @ibase_query($connection, $query); - if ($result === false) { + if (false === $result) { $err =& $this->raiseError(null, null, null, 'Could not execute statement', __FUNCTION__); return $err; @@ -713,7 +714,7 @@ */ function _affectedRows($connection, $result = null) { - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; @@ -851,7 +852,7 @@ } else { break; } - if (is_null($placeholder_type)) { + if (null === $placeholder_type) { $placeholder_type_guess = $query[$p_position]; } @@ -865,7 +866,7 @@ } if ($query[$position] == $placeholder_type_guess) { - if (is_null($placeholder_type)) { + if (null === $placeholder_type) { $placeholder_type = $query[$p_position]; $question = $colon = $placeholder_type; } @@ -1056,7 +1057,7 @@ */ function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null) { - if ($this->result === true) { + if (true === $this->result) { //query successfully executed, but without results... $null = null; return $null; @@ -1065,7 +1066,7 @@ $null = null; return $null; } - if (!is_null($rownum)) { + if (null !== $rownum) { $seek = $this->seek($rownum); if (PEAR::isError($seek)) { return $seek; @@ -1085,7 +1086,7 @@ $row = @ibase_fetch_row($this->result); } if (!$row) { - if ($this->result === false) { + if (false === $this->result) { $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); return $err; @@ -1165,7 +1166,7 @@ */ function numCols() { - if ($this->result === true) { + if (true === $this->result) { //query successfully executed, but without results... return 0; } @@ -1175,11 +1176,11 @@ 'numCols(): not a valid ibase resource', __FUNCTION__); } $cols = @ibase_num_fields($this->result); - if (is_null($cols)) { - if ($this->result === false) { + if (null === $cols) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } elseif (null === $this->result) { return count($this->types); } return $this->db->raiseError(null, null, null, @@ -1201,7 +1202,7 @@ { if (is_resource($this->result) && $this->db->connection) { $free = @ibase_free_result($this->result); - if ($free === false) { + if (false === $free) { return $this->db->raiseError(null, null, null, 'Could not free result', __FUNCTION__); } @@ -1241,7 +1242,7 @@ function _fillBuffer($rownum = null) { if (isset($this->buffer) && is_array($this->buffer)) { - if (is_null($rownum)) { + if (null === $rownum) { if (!end($this->buffer)) { return false; } @@ -1255,7 +1256,7 @@ } $buffer = true; - while ((is_null($rownum) || $this->buffer_rownum < $rownum) + while (((null === $rownum) || $this->buffer_rownum < $rownum) && (!$this->limit || $this->buffer_rownum < $this->limit) && ($buffer = @ibase_fetch_row($this->result)) ) { @@ -1287,17 +1288,17 @@ */ function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null) { - if ($this->result === true || is_null($this->result)) { + if (true === $this->result || (null === $this->result)) { //query successfully executed, but without results... $null = null; return $null; } - if ($this->result === false) { + if (false === $this->result) { $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); return $err; } - if (!is_null($rownum)) { + if (null !== $rownum) { $seek = $this->seek($rownum); if (PEAR::isError($seek)) { return $seek; @@ -1362,7 +1363,7 @@ */ function seek($rownum = 0) { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); } @@ -1381,10 +1382,11 @@ */ function valid() { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return true; } if ($this->_fillBuffer($this->rownum + 1)) { @@ -1404,10 +1406,11 @@ */ function numRows() { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return 0; } $this->_fillBuffer(); @@ -1456,7 +1459,7 @@ */ function &_execute($result_class = true, $result_wrap_class = false) { - if (is_null($this->statement)) { + if (null === $this->statement) { $result =& parent::_execute($result_class, $result_wrap_class); return $result; } @@ -1488,7 +1491,7 @@ } $result = @call_user_func_array('ibase_execute', $parameters); - if ($result === false) { + if (false === $result) { $err =& $this->db->raiseError(null, null, null, 'Could not execute statement', __FUNCTION__); return $err; @@ -1518,13 +1521,13 @@ */ function free() { - if (is_null($this->positions)) { + if (null === $this->positions) { return $this->db->raiseError(MDB2_ERROR, null, null, 'Prepared statement has already been freed', __FUNCTION__); } $result = MDB2_OK; - if (!is_null($this->statement) && !@ibase_free_query($this->statement)) { + if ((null !== $this->statement) && !@ibase_free_query($this->statement)) { $result = $this->db->raiseError(null, null, null, 'Could not free statement', __FUNCTION__); } Modified: pear/packages/MDB2/trunk/MDB2/Driver/mssql.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/mssql.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/mssql.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -113,7 +113,7 @@ */ function errorInfo($error = null, $connection = null) { - if (is_null($connection)) { + if (null === $connection) { $connection = $this->connection; } @@ -126,7 +126,7 @@ } } $native_msg = @mssql_get_last_message(); - if (is_null($error)) { + if (null === $error) { static $ecode_map; if (empty($ecode_map)) { $ecode_map = array( @@ -237,14 +237,15 @@ function beginTransaction($savepoint = null) { $this->debug('Starting transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint)); - if (!is_null($savepoint)) { + if (null !== $savepoint) { if (!$this->in_transaction) { return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'savepoint cannot be released when changes are auto committed', __FUNCTION__); } $query = 'SAVE TRANSACTION '.$savepoint; return $this->_doQuery($query, true); - } elseif ($this->in_transaction) { + } + if ($this->in_transaction) { return MDB2_OK; //nothing to do } if (!$this->destructor_registered && $this->opened_persistent) { @@ -280,7 +281,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'commit/release savepoint cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { return MDB2_OK; } @@ -313,7 +314,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'rollback cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { $query = 'ROLLBACK TRANSACTION '.$savepoint; return $this->_doQuery($query, true); } @@ -590,13 +591,13 @@ return $result; } - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; } } - if (is_null($database_name)) { + if (null === $database_name) { $database_name = $this->database_name; } @@ -635,7 +636,7 @@ */ function _affectedRows($connection, $result = null) { - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; @@ -825,13 +826,13 @@ function lastInsertID($table = null, $field = null) { $server_info = $this->getServerVersion(); - if (is_array($server_info) && !is_null($server_info['major']) + if (is_array($server_info) && (null !== $server_info['major']) && $server_info['major'] >= 8 ) { $query = "SELECT IDENT_CURRENT('$table')"; } else { $query = "SELECT @@IDENTITY"; - if (!is_null($table)) { + if (null !== $table) { $query .= ' FROM '.$this->quoteIdentifier($table, true); } } @@ -900,7 +901,7 @@ $null = null; return $null; } - if (!is_null($rownum)) { + if (null !== $rownum) { $seek = $this->seek($rownum); if (PEAR::isError($seek)) { return $seek; @@ -920,7 +921,7 @@ $row = @mssql_fetch_row($this->result); } if (!$row) { - if ($this->result === false) { + if (false === $this->result) { $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); return $err; @@ -1001,11 +1002,12 @@ function numCols() { $cols = @mssql_num_fields($this->result); - if (is_null($cols)) { - if ($this->result === false) { + if (null === $cols) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return count($this->types); } return $this->db->raiseError(null, null, null, @@ -1025,10 +1027,11 @@ */ function nextResult() { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return false; } return @mssql_next_result($this->result); @@ -1047,7 +1050,7 @@ { if (is_resource($this->result) && $this->db->connection) { $free = @mssql_free_result($this->result); - if ($free === false) { + if (false === $free) { return $this->db->raiseError(null, null, null, 'Could not free result', __FUNCTION__); } @@ -1084,11 +1087,11 @@ function seek($rownum = 0) { if ($this->rownum != ($rownum - 1) && !@mssql_data_seek($this->result, $rownum)) { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); } - if (is_null($this->result)) { + if (null === $this->result) { return MDB2_OK; } return $this->db->raiseError(MDB2_ERROR_INVALID, null, null, @@ -1128,11 +1131,12 @@ function numRows() { $rows = @mssql_num_rows($this->result); - if (is_null($rows)) { - if ($this->result === false) { + if (null === $rows) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return 0; } return $this->db->raiseError(null, null, null, Modified: pear/packages/MDB2/trunk/MDB2/Driver/mysqli.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/mysqli.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/mysqli.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -189,7 +189,7 @@ $native_code = @mysqli_connect_errno(); $native_msg = @mysqli_connect_error(); } - if (is_null($error)) { + if (null === $error) { static $ecode_map; if (empty($ecode_map)) { $ecode_map = array( @@ -320,7 +320,7 @@ { $this->debug('Starting transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint)); $this->_getServerCapabilities(); - if (!is_null($savepoint)) { + if (null !== $savepoint) { if (!$this->supports('savepoints')) { return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'savepoints are not supported', __FUNCTION__); @@ -331,7 +331,8 @@ } $query = 'SAVEPOINT '.$savepoint; return $this->_doQuery($query, true); - } elseif ($this->in_transaction) { + } + if ($this->in_transaction) { return MDB2_OK; //nothing to do } $query = $this->start_transaction ? 'START TRANSACTION' : 'SET AUTOCOMMIT = 0'; @@ -364,7 +365,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'commit/release savepoint cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { if (!$this->supports('savepoints')) { return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'savepoints are not supported', __FUNCTION__); @@ -418,7 +419,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'rollback cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { if (!$this->supports('savepoints')) { return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'savepoints are not supported', __FUNCTION__); @@ -590,7 +591,7 @@ */ function setCharset($charset, $connection = null) { - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; @@ -606,7 +607,7 @@ ((50000 <= $client_info) && (50006 > $client_info))) ) { $query = "SET NAMES '".mysqli_real_escape_string($connection, $charset)."'"; - if (!is_null($collation)) { + if (null !== $collation) { $query .= " COLLATE '".mysqli_real_escape_string($connection, $collation)."'"; } return $this->_doQuery($query, true, $connection); @@ -748,13 +749,13 @@ return $result; } - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; } } - if (is_null($database_name)) { + if (null === $database_name) { $database_name = $this->database_name; } @@ -813,7 +814,7 @@ */ function _affectedRows($connection, $result = null) { - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; @@ -994,7 +995,7 @@ function _skipUserDefinedVariable($query, $position) { $found = strpos(strrev(substr($query, 0, $position)), '@'); - if ($found === false) { + if (false === $found) { return $position; } $pos = strlen($query) - strlen(substr($query, $position)) - $found - 1; @@ -1072,7 +1073,7 @@ } else { break; } - if (is_null($placeholder_type)) { + if (null === $placeholder_type) { $placeholder_type_guess = $query[$p_position]; } @@ -1093,7 +1094,7 @@ } if ($query[$position] == $placeholder_type_guess) { - if (is_null($placeholder_type)) { + if (null === $placeholder_type) { $placeholder_type = $query[$p_position]; $question = $colon = $placeholder_type; } @@ -1365,7 +1366,7 @@ */ function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null) { - if (!is_null($rownum)) { + if (null !== $rownum) { $seek = $this->seek($rownum); if (PEAR::isError($seek)) { return $seek; @@ -1386,7 +1387,7 @@ } if (!$row) { - if ($this->result === false) { + if (false === $this->result) { $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); return $err; @@ -1467,11 +1468,12 @@ function numCols() { $cols = @mysqli_num_fields($this->result); - if (is_null($cols)) { - if ($this->result === false) { + if (null === $cols) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return count($this->types); } return $this->db->raiseError(null, null, null, @@ -1522,7 +1524,7 @@ do { if (is_object($this->result) && $this->db->connection) { $free = @mysqli_free_result($this->result); - if ($free === false) { + if (false === $free) { return $this->db->raiseError(null, null, null, 'Could not free result', __FUNCTION__); } @@ -1556,10 +1558,11 @@ function seek($rownum = 0) { if ($this->rownum != ($rownum - 1) && !@mysqli_data_seek($this->result, $rownum)) { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return MDB2_OK; } return $this->db->raiseError(MDB2_ERROR_INVALID, null, null, @@ -1599,11 +1602,12 @@ function numRows() { $rows = @mysqli_num_rows($this->result); - if (is_null($rows)) { - if ($this->result === false) { + if (null === $rows) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return 0; } return $this->db->raiseError(null, null, null, @@ -1665,7 +1669,7 @@ */ function &_execute($result_class = true, $result_wrap_class = false) { - if (is_null($this->statement)) { + if (null === $this->statement) { $result =& parent::_execute($result_class, $result_wrap_class); return $result; } @@ -1745,7 +1749,7 @@ $query.= ' USING @'.implode(', @', array_values($this->positions)); } else { $result = @call_user_func_array('mysqli_stmt_bind_param', $parameters); - if ($result === false) { + if (false === $result) { $err =& $this->db->raiseError(null, null, null, 'Unable to bind parameters', __FUNCTION__); return $err; @@ -1827,7 +1831,7 @@ */ function free() { - if (is_null($this->positions)) { + if (null === $this->positions) { return $this->db->raiseError(MDB2_ERROR, null, null, 'Prepared statement has already been freed', __FUNCTION__); } @@ -1838,7 +1842,7 @@ $result = $this->db->raiseError(null, null, null, 'Could not free statement', __FUNCTION__); } - } elseif (!is_null($this->statement)) { + } elseif (null !== $this->statement) { $connection = $this->db->getConnection(); if (PEAR::isError($connection)) { return $connection; Modified: pear/packages/MDB2/trunk/MDB2/Driver/oci8.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/oci8.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/oci8.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -127,7 +127,7 @@ } $native_code = $error_data['code']; $native_msg = $error_data['message']; - if (is_null($error)) { + if (null === $error) { static $ecode_map; if (empty($ecode_map)) { $ecode_map = array( @@ -176,14 +176,15 @@ function beginTransaction($savepoint = null) { $this->debug('Starting transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint)); - if (!is_null($savepoint)) { + if (null !== $savepoint) { if (!$this->in_transaction) { return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'savepoint cannot be released when changes are auto committed', __FUNCTION__); } $query = 'SAVEPOINT '.$savepoint; return $this->_doQuery($query, true); - } elseif ($this->in_transaction) { + } + if ($this->in_transaction) { return MDB2_OK; //nothing to do } if (!$this->destructor_registered && $this->opened_persistent) { @@ -216,7 +217,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'commit/release savepoint cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { return MDB2_OK; } @@ -256,7 +257,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'rollback cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { $query = 'ROLLBACK TO SAVEPOINT '.$savepoint; return $this->_doQuery($query, true); } @@ -658,7 +659,7 @@ return null; } - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; @@ -701,7 +702,7 @@ */ function _affectedRows($connection, $result = null) { - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; @@ -813,7 +814,7 @@ } else { break; } - if (is_null($placeholder_type)) { + if (null === $placeholder_type) { $placeholder_type_guess = $query[$p_position]; } @@ -827,7 +828,7 @@ } if ($query[$position] == $placeholder_type_guess) { - if (is_null($placeholder_type)) { + if (null === $placeholder_type) { $placeholder_type = $query[$p_position]; $question = $colon = $placeholder_type; if (!empty($types) && is_array($types)) { @@ -1012,7 +1013,7 @@ */ function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null) { - if (!is_null($rownum)) { + if (null !== $rownum) { $seek = $this->seek($rownum); if (PEAR::isError($seek)) { return $seek; @@ -1032,7 +1033,7 @@ @OCIFetchInto($this->result, $row, OCI_RETURN_NULLS); } if (!$row) { - if ($this->result === false) { + if (false === $this->result) { $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); return $err; @@ -1117,11 +1118,12 @@ function numCols() { $cols = @OCINumCols($this->result); - if (is_null($cols)) { - if ($this->result === false) { + if (null === $cols) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return count($this->types); } return $this->db->raiseError(null, null, null, @@ -1146,7 +1148,7 @@ { if (is_resource($this->result) && $this->db->connection) { $free = @OCIFreeCursor($this->result); - if ($free === false) { + if (false === $free) { return $this->db->raiseError(null, null, null, 'Could not free result', __FUNCTION__); } @@ -1182,7 +1184,7 @@ function _fillBuffer($rownum = null) { if (isset($this->buffer) && is_array($this->buffer)) { - if (is_null($rownum)) { + if (null === $rownum) { if (!end($this->buffer)) { return false; } @@ -1192,7 +1194,7 @@ } $row = true; - while ((is_null($rownum) || $this->buffer_rownum < $rownum) + while (((null === $rownum) || $this->buffer_rownum < $rownum) && ($row = @OCIFetchInto($this->result, $buffer, OCI_RETURN_NULLS)) ) { ++$this->buffer_rownum; @@ -1231,14 +1233,15 @@ */ function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null) { - if ($this->result === false) { + if (false === $this->result) { $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); return $err; - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return null; } - if (!is_null($rownum)) { + if (null !== $rownum) { $seek = $this->seek($rownum); if (PEAR::isError($seek)) { return $seek; @@ -1303,7 +1306,7 @@ */ function seek($rownum = 0) { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); } @@ -1322,10 +1325,11 @@ */ function valid() { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return true; } if ($this->_fillBuffer($this->rownum + 1)) { @@ -1345,10 +1349,11 @@ */ function numRows() { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return 0; } $this->_fillBuffer(); @@ -1430,7 +1435,7 @@ */ function &_execute($result_class = true, $result_wrap_class = false) { - if (is_null($this->statement)) { + if (null === $this->statement) { $result =& parent::_execute($result_class, $result_wrap_class); return $result; } @@ -1479,7 +1484,7 @@ // variable (i.e. if it has been bound more than once): if (!is_a($this->values[$parameter], 'OCI-Lob')) { $this->values[$parameter] = @OCINewDescriptor($connection, OCI_D_LOB); - if ($this->values[$parameter] === false) { + if (false === $this->values[$parameter]) { $result = $this->db->raiseError(null, null, null, 'Unable to create descriptor for LOB in parameter: '.$parameter, __FUNCTION__); break; @@ -1496,7 +1501,7 @@ // variable (i.e. if it has been bound more than once): if (!is_a($this->values[$parameter], "OCI-Lob")) { $this->values[$parameter] = @OCINewDescriptor($connection, OCI_D_FILE); - if ($this->values[$parameter] === false) { + if (false === $this->values[$parameter]) { $result = $this->db->raiseError(null, null, null, 'Unable to create descriptor for BFILE in parameter: '.$parameter, __FUNCTION__); break; @@ -1512,7 +1517,7 @@ // variable (i.e. if it has been bound more than once): if (!is_a($this->values[$parameter], "OCI-Lob")) { $this->values[$parameter] = @OCINewDescriptor($connection, OCI_D_ROWID); - if ($this->values[$parameter] === false) { + if (false === $this->values[$parameter]) { $result = $this->db->raiseError(null, null, null, 'Unable to create descriptor for ROWID in parameter: '.$parameter, __FUNCTION__); break; @@ -1528,7 +1533,7 @@ // variable (i.e. if it has been bound more than once): if (!is_resource($this->values[$parameter]) || !get_resource_type($this->values[$parameter]) == "oci8 statement") { $this->values[$parameter] = @OCINewCursor($connection); - if ($this->values[$parameter] === false) { + if (false === $this->values[$parameter]) { $result = $this->db->raiseError(null, null, null, 'Unable to allocate cursor for parameter: '.$parameter, __FUNCTION__); break; @@ -1566,7 +1571,7 @@ if (!empty($lobs)) { foreach ($lob_keys as $i) { - if (!is_null($lobs[$i]['value']) && $lobs[$i]['value'] !== '') { + if ((null !== $lobs[$i]['value']) && $lobs[$i]['value'] !== '') { if (is_object($lobs[$i]['value'])) { // Probably a NULL LOB // @see http://bugs.php.net/bug.php?id=27485 @@ -1624,13 +1629,13 @@ */ function free() { - if (is_null($this->positions)) { + if (null === $this->positions) { return $this->db->raiseError(MDB2_ERROR, null, null, 'Prepared statement has already been freed', __FUNCTION__); } $result = MDB2_OK; - if (!is_null($this->statement) && !@OCIFreeStatement($this->statement)) { + if ((null !== $this->statement) && !@OCIFreeStatement($this->statement)) { $result = $this->db->raiseError(null, null, null, 'Could not free statement', __FUNCTION__); } Modified: pear/packages/MDB2/trunk/MDB2/Driver/pgsql.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/pgsql.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/pgsql.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -236,14 +236,15 @@ function beginTransaction($savepoint = null) { $this->debug('Starting transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint)); - if (!is_null($savepoint)) { + if (null !== $savepoint) { if (!$this->in_transaction) { return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'savepoint cannot be released when changes are auto committed', __FUNCTION__); } $query = 'SAVEPOINT '.$savepoint; return $this->_doQuery($query, true); - } elseif ($this->in_transaction) { + } + if ($this->in_transaction) { return MDB2_OK; //nothing to do } if (!$this->destructor_registered && $this->opened_persistent) { @@ -279,7 +280,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'commit/release savepoint cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { $query = 'RELEASE SAVEPOINT '.$savepoint; return $this->_doQuery($query, true); } @@ -313,7 +314,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'rollback cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { $query = 'ROLLBACK TO SAVEPOINT '.$savepoint; return $this->_doQuery($query, true); } @@ -532,7 +533,7 @@ */ function setCharset($charset, $connection = null) { - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; @@ -682,7 +683,7 @@ return $result; } - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; @@ -720,7 +721,7 @@ */ function _affectedRows($connection, $result = null) { - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; @@ -908,7 +909,7 @@ } else { break; } - if (is_null($placeholder_type)) { + if (null === $placeholder_type) { $placeholder_type_guess = $query[$p_position]; } @@ -922,7 +923,7 @@ } if ($query[$position] == $placeholder_type_guess) { - if (is_null($placeholder_type)) { + if (null === $placeholder_type) { $placeholder_type = $query[$p_position]; $question = $colon = $placeholder_type; if (!empty($types) && is_array($types)) { @@ -981,7 +982,7 @@ static $prep_statement_counter = 1; $statement_name = sprintf($this->options['statement_format'], $this->phptype, $prep_statement_counter++ . sha1(microtime() + mt_rand())); $statement_name = substr(strtolower($statement_name), 0, $this->options['max_identifiers_length']); - if ($pgtypes === false) { + if (false === $pgtypes) { $result = @pg_prepare($connection, $statement_name, $query); if (!$result) { $err =& $this->raiseError(null, null, null, @@ -1165,7 +1166,7 @@ */ function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null) { - if (!is_null($rownum)) { + if (null !== $rownum) { $seek = $this->seek($rownum); if (PEAR::isError($seek)) { return $seek; @@ -1185,7 +1186,7 @@ $row = @pg_fetch_row($this->result); } if (!$row) { - if ($this->result === false) { + if (false === $this->result) { $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); return $err; @@ -1266,11 +1267,12 @@ function numCols() { $cols = @pg_num_fields($this->result); - if (is_null($cols)) { - if ($this->result === false) { + if (null === $cols) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return count($this->types); } return $this->db->raiseError(null, null, null, @@ -1314,7 +1316,7 @@ { if (is_resource($this->result) && $this->db->connection) { $free = @pg_free_result($this->result); - if ($free === false) { + if (false === $free) { return $this->db->raiseError(null, null, null, 'Could not free result', __FUNCTION__); } @@ -1345,10 +1347,11 @@ function seek($rownum = 0) { if ($this->rownum != ($rownum - 1) && !@pg_result_seek($this->result, $rownum)) { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return MDB2_OK; } return $this->db->raiseError(MDB2_ERROR_INVALID, null, null, @@ -1388,11 +1391,12 @@ function numRows() { $rows = @pg_num_rows($this->result); - if (is_null($rows)) { - if ($this->result === false) { + if (null === $rows) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return 0; } return $this->db->raiseError(null, null, null, @@ -1425,7 +1429,7 @@ */ function &_execute($result_class = true, $result_wrap_class = false) { - if (is_null($this->statement)) { + if (null === $this->statement) { $result =& parent::_execute($result_class, $result_wrap_class); return $result; } @@ -1521,13 +1525,13 @@ */ function free() { - if (is_null($this->positions)) { + if (null === $this->positions) { return $this->db->raiseError(MDB2_ERROR, null, null, 'Prepared statement has already been freed', __FUNCTION__); } $result = MDB2_OK; - if (!is_null($this->statement)) { + if (null !== $this->statement) { $connection = $this->db->getConnection(); if (PEAR::isError($connection)) { return $connection; Modified: pear/packages/MDB2/trunk/MDB2/Driver/querysim.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/querysim.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/querysim.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -616,14 +616,15 @@ */ function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null) { - if ($this->result === false) { + if (false === $this->result) { $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); return $err; - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return null; } - if (!is_null($rownum)) { + if (null !== $rownum) { $seek = $this->seek($rownum); if (PEAR::isError($seek)) { return $seek; @@ -690,10 +691,11 @@ */ function _getColumnNames() { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return array(); } $columns = array_flip($this->result[0]); @@ -715,10 +717,11 @@ */ function numCols() { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return count($this->types); } $cols = count($this->result[0]); @@ -747,7 +750,7 @@ */ function seek($rownum = 0) { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); } @@ -784,10 +787,11 @@ */ function numRows() { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return 0; } $rows = count($this->result[1]); Modified: pear/packages/MDB2/trunk/MDB2/Driver/sqlite.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/sqlite.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/sqlite.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -131,7 +131,7 @@ // this hack to work around it, per bug #9599. $native_msg = preg_replace('/^sqlite[a-z_]+\(\)[^:]*: /', '', $native_msg); - if (is_null($error)) { + if (null === $error) { static $error_regexps; if (empty($error_regexps)) { $error_regexps = array( @@ -194,10 +194,11 @@ function beginTransaction($savepoint = null) { $this->debug('Starting transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint)); - if (!is_null($savepoint)) { + if (null !== $savepoint) { return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'savepoints are not supported', __FUNCTION__); - } elseif ($this->in_transaction) { + } + if ($this->in_transaction) { return MDB2_OK; //nothing to do } if (!$this->destructor_registered && $this->opened_persistent) { @@ -234,7 +235,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'commit/release savepoint cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'savepoints are not supported', __FUNCTION__); } @@ -269,7 +270,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'rollback cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { return $this->raiseError(MDB2_ERROR_UNSUPPORTED, null, null, 'savepoints are not supported', __FUNCTION__); } @@ -514,7 +515,7 @@ return $result; } - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; @@ -560,7 +561,7 @@ */ function _affectedRows($connection, $result = null) { - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; @@ -875,7 +876,7 @@ */ function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null) { - if (!is_null($rownum)) { + if (null !== $rownum) { $seek = $this->seek($rownum); if (PEAR::isError($seek)) { return $seek; @@ -895,7 +896,7 @@ $row = @sqlite_fetch_array($this->result, SQLITE_NUM); } if (!$row) { - if ($this->result === false) { + if (false === $this->result) { $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); return $err; @@ -976,11 +977,12 @@ function numCols() { $cols = @sqlite_num_fields($this->result); - if (is_null($cols)) { - if ($this->result === false) { + if (null === $cols) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return count($this->types); } return $this->db->raiseError(null, null, null, @@ -1011,10 +1013,11 @@ function seek($rownum = 0) { if (!@sqlite_seek($this->result, $rownum)) { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return MDB2_OK; } return $this->db->raiseError(MDB2_ERROR_INVALID, null, null, @@ -1054,11 +1057,12 @@ function numRows() { $rows = @sqlite_num_rows($this->result); - if (is_null($rows)) { - if ($this->result === false) { + if (null === $rows) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return 0; } return $this->db->raiseError(null, null, null, Modified: pear/packages/MDB2/trunk/MDB2/Driver/sqlsrv.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Driver/sqlsrv.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Driver/sqlsrv.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -112,17 +112,19 @@ */ function errorInfo($error = null, $connection = null) { - if (is_null($connection)) { - if(!$this->connection) $this->connect(); + if (null === $connection) { + if (!$this->connection) { + $this->connect(); + } $connection = $this->connection; } $native_code = null; - $native_msg = null; + $native_msg = null; if ($connection) { $retErrors = sqlsrv_errors(SQLSRV_ERR_ALL); - if($retErrors != null) { - foreach($retErrors as $arrError) { + if ($retErrors !== null) { + foreach ($retErrors as $arrError) { $native_msg .= "SQLState: ".$arrError[ 'SQLSTATE']."\n"; $native_msg .= "Error Code: ".$arrError[ 'code']."\n"; $native_msg .= "Message: ".$arrError[ 'message']."\n"; @@ -130,7 +132,7 @@ } } } - if (is_null($error)) { + if (null === $error) { static $ecode_map; if (empty($ecode_map)) { $ecode_map = array( @@ -220,14 +222,15 @@ function beginTransaction($savepoint = null) { $this->debug('Starting transaction/savepoint', __FUNCTION__, array('is_manip' => true, 'savepoint' => $savepoint)); - if (!is_null($savepoint)) { + if (null !== $savepoint) { if (!$this->in_transaction) { return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'savepoint cannot be released when changes are auto committed', __FUNCTION__); } $query = 'SAVE TRANSACTION '.$savepoint; return $this->_doQuery($query, true); - } elseif ($this->in_transaction) { + } + if ($this->in_transaction) { return MDB2_OK; //nothing to do } if (!$this->destructor_registered && $this->opened_persistent) { @@ -262,7 +265,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'commit/release savepoint cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { return MDB2_OK; } @@ -294,7 +297,7 @@ return $this->raiseError(MDB2_ERROR_INVALID, null, null, 'rollback cannot be done changes are auto committed', __FUNCTION__); } - if (!is_null($savepoint)) { + if (null !== $savepoint) { $query = 'ROLLBACK TRANSACTION '.$savepoint; return $this->_doQuery($query, true); } @@ -324,10 +327,12 @@ $host = $this->dsn['hostspec'] ? $this->dsn['hostspec'] : '.\\SQLEXPRESS'; $params = array( - 'UID'=>$username ? $username : null, - 'PWD'=>$password ? $password : null, + 'UID' => $username ? $username : null, + 'PWD' => $password ? $password : null, ); - if($database) $params['Database'] = $database; + if ($database) { + $params['Database'] = $database; + } if ($this->dsn['port'] && $this->dsn['port'] != 1433) { $host .= ','.$this->dsn['port']; @@ -338,7 +343,9 @@ return $this->raiseError(MDB2_ERROR_CONNECT_FAILED, null, null, 'unable to establish a connection', __FUNCTION__, __FUNCTION__); } - if(!is_null($database)) $this->connected_database_name = $database; + if (null !== $database) { + $this->connected_database_name = $database; + } if (!empty($this->dsn['charset'])) { $result = $this->setCharset($this->dsn['charset'], $connection); @@ -408,11 +415,10 @@ return MDB2_ERROR_CONNECT_FAILED; } $result = @sqlsrv_query($connection,'select name from master..sysdatabases where name = \''.strtolower($name).'\''); - if(@sqlsrv_fetch($result)) { + if (@sqlsrv_fetch($result)) { return true; - } else { - return MDB2_ERROR_NOT_FOUND; } + return MDB2_ERROR_NOT_FOUND; } // }}} @@ -509,13 +515,13 @@ return $result; } - if (is_null($connection)) { + if (null === $connection) { $connection = $this->getConnection(); if (PEAR::isError($connection)) { return $connection; } } - if (is_null($database_name)) { + if (null === $database_name) { $database_name = $this->database_name; } @@ -555,8 +561,10 @@ */ function _affectedRows($connection, $result = null) { - if(is_null($result)) $result = $this->result; - return sqlsrv_rows_affected($this->result); + if (null === $result) { + $result = $this->result; + } + return sqlsrv_rows_affected($this->result); } // }}} @@ -646,11 +654,10 @@ } return false; } - if(@sqlsrv_fetch($tableExits)) { + if (@sqlsrv_fetch($tableExits)) { return true; - } else { - return false; } + return false; } // }}} @@ -770,16 +777,16 @@ $this->limit = max(0, $limit - 1); $this->cursor = 0; $this->rows = array(); - $this->numFields = sqlsrv_num_fields( $result); - $this->fieldMeta = sqlsrv_field_metadata( $result); + $this->numFields = sqlsrv_num_fields($result); + $this->fieldMeta = sqlsrv_field_metadata($result); $this->numRowsAffected = sqlsrv_rows_affected($result); - while( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC)) { - if($row !== null) { - if($this->offset && $this->offset_count < $this->offset) { + while ($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) { + if ($row !== null) { + if ($this->offset && $this->offset_count < $this->offset) { $this->offset_count++; continue; } - foreach($row as $k => $v) { + foreach ($row as $k => $v) { if (is_object($v) && method_exists($v, 'format')) {//DateTime Object $row[$k] = $v->format("Y-m-d H:i:s"); } @@ -843,12 +850,14 @@ */ function &fetchRow($fetchmode = MDB2_FETCHMODE_DEFAULT, $rownum = null) { - if(!$this->result) return $this->db->raiseError(MDB2_ERROR_INVALID, null, null, 'no valid statement given', __FUNCTION__); + if (!$this->result) { + return $this->db->raiseError(MDB2_ERROR_INVALID, null, null, 'no valid statement given', __FUNCTION__); + } if (($this->limit && $this->rownum >= $this->limit) || ($this->cursor >= $this->rowcnt || $this->rowcnt == 0)) { $null = null; return $null; } - if (!is_null($rownum)) { + if (null !== $rownum) { $seek = $this->seek($rownum); if (PEAR::isError($seek)) { return $seek; @@ -857,8 +866,8 @@ $row = false; $arrNum = array(); - if($fetchmode == MDB2_FETCHMODE_ORDERED || $fetchmode == MDB2_FETCHMODE_DEFAULT) { - foreach($this->rows[$this->cursor] as $key=>$value) { + if ($fetchmode == MDB2_FETCHMODE_ORDERED || $fetchmode == MDB2_FETCHMODE_DEFAULT) { + foreach ($this->rows[$this->cursor] as $key=>$value) { $arrNum[] = $value; } } @@ -875,7 +884,8 @@ } $this->cursor++; - /*if($fetchmode == MDB2_FETCHMODE_OBJECT) { + /* + if ($fetchmode == MDB2_FETCHMODE_OBJECT) { $row = sqlsrv_fetch_object($this->result,$this->db->options['fetch_class']); } else { switch($fetchmode) { @@ -887,7 +897,7 @@ } $row = sqlsrv_fetch_array($this->result,$fetchmode); } - foreach($row as $key=>$value) { + foreach ($row as $key=>$value) { if (is_object($value) && method_exists($value, 'format')) {//is DateTime object $row[$key] = $value->format("Y-m-d H:i:s"); } @@ -900,7 +910,7 @@ $row = array_change_key_case($row, $this->db->options['field_case']); } if (!$row) { - if ($this->result === false) { + if (false === $this->result) { $err =& $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); return $err; @@ -944,9 +954,11 @@ */ function _getColumnNames() { - if(!$this->result) return $this->db->raiseError(MDB2_ERROR_INVALID, null, null, 'no valid statement given', __FUNCTION__); + if (!$this->result) { + return $this->db->raiseError(MDB2_ERROR_INVALID, null, null, 'no valid statement given', __FUNCTION__); + } $columns = array(); - foreach($this->fieldMeta as $col) { + foreach ($this->fieldMeta as $col) { $columns[$col['Name']] = $col['Type']; } if ($this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) { @@ -967,13 +979,16 @@ */ function numCols() { - if(!$this->result) return $this->db->raiseError(MDB2_ERROR_INVALID, null, null, 'no valid statement given', __FUNCTION__); + if (!$this->result) { + return $this->db->raiseError(MDB2_ERROR_INVALID, null, null, 'no valid statement given', __FUNCTION__); + } $cols = $this->numFields; if (!$cols) { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result) { return count($this->types); } return $this->db->raiseError(null, null, null, @@ -993,26 +1008,27 @@ */ function nextResult() { - if ($this->result === false) { + if (false === $this->result) { return $this->db->raiseError(MDB2_ERROR_NEED_MORE_DATA, null, null, 'resultset has already been freed', __FUNCTION__); - } elseif (is_null($this->result)) { + } + if (null === $this->result)) { return false; } $ret = sqlsrv_next_result($this->result); - if($ret) { + if ($ret) { $this->cursor = 0; $this->rows = array(); - $this->numFields = sqlsrv_num_fields( $this->result); - $this->fieldMeta = sqlsrv_field_metadata( $this->result); + $this->numFields = sqlsrv_num_fields($this->result); + $this->fieldMeta = sqlsrv_field_metadata($this->result); $this->numRowsAffected = sqlsrv_rows_affected($this->result); - while( $row = sqlsrv_fetch_array( $this->result, SQLSRV_FETCH_ASSOC)) { - if($row !== null) { - if($this->offset && $this->offset_count < $this->offset) { + while ($row = sqlsrv_fetch_array($this->result, SQLSRV_FETCH_ASSOC)) { + if ($row !== null) { + if ($this->offset && $this->offset_count < $this->offset) { $this->offset_count++; continue; } - foreach($row as $k => $v) { + foreach ($row as $k => $v) { if (is_object($v) && method_exists($v, 'format')) {//DateTime Object //$v->setTimezone(new DateTimeZone('GMT'));//TS_ISO_8601 with a trailing 'Z' is GMT $row[$k] = $v->format("Y-m-d H:i:s"); Modified: pear/packages/MDB2/trunk/MDB2/Extended.php =================================================================== --- pear/packages/MDB2/trunk/MDB2/Extended.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/MDB2/Extended.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -214,7 +214,7 @@ } } - if ($where !== false && !is_null($where)) { + if ((false !== $where) && (null !== $where)) { if (is_array($where)) { $where = implode(' AND ', $where); } Modified: pear/packages/MDB2/trunk/package.php =================================================================== --- pear/packages/MDB2/trunk/package.php 2009-12-28 11:17:10 UTC (rev 292714) +++ pear/packages/MDB2/trunk/package.php 2009-12-28 14:06:34 UTC (rev 292715) @@ -13,6 +13,7 @@ - fixed bug #16727: quote(url, 'clob')) fetches URL even if lob_allow_url_include option is false - fixed unreported bug in parseDSN() and oracle's Easy Connect syntax - PHP 5.3 compatibility fixes +- performance tweaks (reduced number of internal function calls) - added new sqlsrv driver (native SQL Server driver) [chrisdpucci]