| @@ 259-282 (lines=24) @@ | ||
| 256 | $pk = explode( '`,`', $pk ); |
|
| 257 | $table->primary = $pk; |
|
| 258 | } |
|
| 259 | if ( is_array( $table->primary ) && count( $table->primary ) == 1 ) { |
|
| 260 | $pk_column_name = $table->primary[0]; |
|
| 261 | switch( strtolower( $table->columns->$pk_column_name->type ) ) { |
|
| 262 | // Integers, exact value |
|
| 263 | case 'tinyint': |
|
| 264 | case 'smallint': |
|
| 265 | case 'int': |
|
| 266 | case 'integer': |
|
| 267 | case 'bigint': |
|
| 268 | // Fixed point, exact value |
|
| 269 | case 'decimal': |
|
| 270 | case 'numeric': |
|
| 271 | // Floating point, approximate value |
|
| 272 | case 'float': |
|
| 273 | case 'double': |
|
| 274 | case 'real': |
|
| 275 | // Date and Time |
|
| 276 | case 'date': |
|
| 277 | case 'datetime': |
|
| 278 | case 'timestamp': |
|
| 279 | $table->single_int_paging_column = $pk_column_name; |
|
| 280 | break; |
|
| 281 | } |
|
| 282 | } |
|
| 283 | $keys = preg_grep( '/^((?:UNIQUE )?INDEX|(?:UNIQUE )?KEY)\s+/i', $sql ); |
|
| 284 | if ( !count( $keys ) ) |
|
| 285 | return $table; |
|
| @@ 312-335 (lines=24) @@ | ||
| 309 | ||
| 310 | $uniques = get_object_vars( $table->uniques ); |
|
| 311 | foreach( $uniques as $idx => $val ) { |
|
| 312 | if ( is_array( $val ) && count( $val ) == 1 ) { |
|
| 313 | $pk_column_name = $val[0]; |
|
| 314 | switch( strtolower( $table->columns->$pk_column_name->type ) ) { |
|
| 315 | // Integers, exact value |
|
| 316 | case 'tinyint': |
|
| 317 | case 'smallint': |
|
| 318 | case 'int': |
|
| 319 | case 'integer': |
|
| 320 | case 'bigint': |
|
| 321 | // Fixed point, exact value |
|
| 322 | case 'decimal': |
|
| 323 | case 'numeric': |
|
| 324 | // Floating point, approximate value |
|
| 325 | case 'float': |
|
| 326 | case 'double': |
|
| 327 | case 'real': |
|
| 328 | // Date and Time |
|
| 329 | case 'date': |
|
| 330 | case 'datetime': |
|
| 331 | case 'timestamp': |
|
| 332 | $table->single_int_paging_column = $pk_column_name; |
|
| 333 | break; |
|
| 334 | } |
|
| 335 | } |
|
| 336 | } |
|
| 337 | ||
| 338 | if ( empty( $table->primary ) ) { |
|