-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Open
Description
Description
The getColumnMeta function currently returns a small subset of the flags from the native mysql library as shown here:
php-src/ext/pdo_mysql/mysql_statement.c
Lines 790 to 801 in 6727f54
if (IS_NOT_NULL(F->flags)) { | |
add_next_index_string(&flags, "not_null"); | |
} | |
if (IS_PRI_KEY(F->flags)) { | |
add_next_index_string(&flags, "primary_key"); | |
} | |
if (F->flags & MULTIPLE_KEY_FLAG) { | |
add_next_index_string(&flags, "multiple_key"); | |
} | |
if (F->flags & UNIQUE_KEY_FLAG) { | |
add_next_index_string(&flags, "unique_key"); | |
} |
php-src/ext/mysqlnd/mysqlnd_enum_n_def.h
Lines 337 to 353 in 6727f54
#define NOT_NULL_FLAG 1 | |
#define PRI_KEY_FLAG 2 | |
#define UNIQUE_KEY_FLAG 4 | |
#define MULTIPLE_KEY_FLAG 8 | |
#define BLOB_FLAG 16 | |
#define UNSIGNED_FLAG 32 | |
#define ZEROFILL_FLAG 64 | |
#define BINARY_FLAG 128 | |
#define ENUM_FLAG 256 | |
#define AUTO_INCREMENT_FLAG 512 | |
#define TIMESTAMP_FLAG 1024 | |
#define SET_FLAG 2048 | |
#define NO_DEFAULT_VALUE_FLAG 4096 | |
#define ON_UPDATE_NOW_FLAG 8192 | |
#define PART_KEY_FLAG 16384 | |
#define GROUP_FLAG 32768 | |
#define NUM_FLAG 32768 |
These flags provide valuable information about the column returned and how to potentially process it. For instance, one might need to treat binary strings different from non-binary strings. Without the binary flag, it is impossible to know whether or not a string might require special handling without examining the values of the result set. Additionally, consider adding a native_flags attribute which returns the unmodified numeric value of the flags from the mysql library.