@@ -117,8 +117,9 @@ discard block |
||
| 117 | 117 | { |
| 118 | 118 | $this->queryInit( $query, $params ); |
| 119 | 119 | |
| 120 | - if ( $this->lastStatement === self::QUERY_TYPE_EXPLAIN ) |
|
| 121 | - return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC ); |
|
| 120 | + if ( $this->lastStatement === self::QUERY_TYPE_EXPLAIN ) { |
|
| 121 | + return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC ); |
|
| 122 | + } |
|
| 122 | 123 | |
| 123 | 124 | $Columns = $this->sQuery->fetchAll( \PDO::FETCH_NUM ); |
| 124 | 125 | |
@@ -141,8 +142,9 @@ discard block |
||
| 141 | 142 | { |
| 142 | 143 | $this->queryInit( $query, $params ); |
| 143 | 144 | |
| 144 | - if ( $this->lastStatement === self::QUERY_TYPE_EXPLAIN ) |
|
| 145 | - return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC ); |
|
| 145 | + if ( $this->lastStatement === self::QUERY_TYPE_EXPLAIN ) { |
|
| 146 | + return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC ); |
|
| 147 | + } |
|
| 146 | 148 | |
| 147 | 149 | $result = $this->sQuery->fetch( $fetchmode ); |
| 148 | 150 | $this->sQuery->closeCursor(); // Frees up the connection to the server so that other SQL statements may be issued, |
@@ -159,8 +161,9 @@ discard block |
||
| 159 | 161 | { |
| 160 | 162 | $this->queryInit( $query, $params ); |
| 161 | 163 | |
| 162 | - if ( $this->lastStatement === self::QUERY_TYPE_EXPLAIN ) |
|
| 163 | - return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC ); |
|
| 164 | + if ( $this->lastStatement === self::QUERY_TYPE_EXPLAIN ) { |
|
| 165 | + return $this->sQuery->fetchAll( \PDO::FETCH_ASSOC ); |
|
| 166 | + } |
|
| 164 | 167 | |
| 165 | 168 | $result = $this->sQuery->fetchColumn(); |
| 166 | 169 | $this->sQuery->closeCursor(); // Frees up the connection to the server so that other SQL statements may be issued |
@@ -225,24 +228,22 @@ discard block |
||
| 225 | 228 | /** |
| 226 | 229 | * Add parameters to the parameter array |
| 227 | 230 | */ |
| 228 | - if ( self::isArrayAssoc( $parameters ) ) |
|
| 229 | - $this->bindMore( $parameters ); |
|
| 230 | - else |
|
| 231 | - foreach ( $parameters as $key => $val ) |
|
| 231 | + if ( self::isArrayAssoc( $parameters ) ) { |
|
| 232 | + $this->bindMore( $parameters ); |
|
| 233 | + } else { |
|
| 234 | + foreach ( $parameters as $key => $val ) |
|
| 232 | 235 | $this->parameters[] = array( $key + 1, $val ); |
| 236 | + } |
|
| 233 | 237 | |
| 234 | 238 | if ( count( $this->parameters ) ) { |
| 235 | 239 | foreach ( $this->parameters as $param => $value ) { |
| 236 | 240 | if ( is_int( $value[ 1 ] ) ) { |
| 237 | 241 | $type = \PDO::PARAM_INT; |
| 238 | - } |
|
| 239 | - elseif ( is_bool( $value[ 1 ] ) ) { |
|
| 242 | + } elseif ( is_bool( $value[ 1 ] ) ) { |
|
| 240 | 243 | $type = \PDO::PARAM_BOOL; |
| 241 | - } |
|
| 242 | - elseif ( is_null( $value[ 1 ] ) ) { |
|
| 244 | + } elseif ( is_null( $value[ 1 ] ) ) { |
|
| 243 | 245 | $type = \PDO::PARAM_NULL; |
| 244 | - } |
|
| 245 | - else { |
|
| 246 | + } else { |
|
| 246 | 247 | $type = \PDO::PARAM_STR; |
| 247 | 248 | } |
| 248 | 249 | $this->sQuery->bindValue( $value[ 0 ], $value[ 1 ], $type ); |
@@ -300,10 +301,11 @@ discard block |
||
| 300 | 301 | { |
| 301 | 302 | $queryString = trim( $queryString ); |
| 302 | 303 | |
| 303 | - if ( preg_match( '/^(select|insert|update|delete|replace|show|desc|explain)[\s]+/i', $queryString, $matches ) ) |
|
| 304 | - return strtoupper( $matches[ 1 ] ); |
|
| 305 | - else |
|
| 306 | - return self::QUERY_TYPE_OTHER; |
|
| 304 | + if ( preg_match( '/^(select|insert|update|delete|replace|show|desc|explain)[\s]+/i', $queryString, $matches ) ) { |
|
| 305 | + return strtoupper( $matches[ 1 ] ); |
|
| 306 | + } else { |
|
| 307 | + return self::QUERY_TYPE_OTHER; |
|
| 308 | + } |
|
| 307 | 309 | } |
| 308 | 310 | |
| 309 | 311 | /** |
@@ -312,8 +314,9 @@ discard block |
||
| 312 | 314 | */ |
| 313 | 315 | public static function isArrayAssoc( array $arr ) |
| 314 | 316 | { |
| 315 | - if ( array() === $arr ) |
|
| 316 | - return false; |
|
| 317 | + if ( array() === $arr ) { |
|
| 318 | + return false; |
|
| 319 | + } |
|
| 317 | 320 | |
| 318 | 321 | return array_keys( $arr ) !== range( 0, count( $arr ) - 1 ); |
| 319 | 322 | } |