diff options
author | Bibiko <bibiko@eva.mpg.de> | 2009-06-09 22:19:15 +0000 |
---|---|---|
committer | Bibiko <bibiko@eva.mpg.de> | 2009-06-09 22:19:15 +0000 |
commit | 6f8253e66be9dac0c3c96e16d9f97fda3fc7e818 (patch) | |
tree | 7848c2b90d9c577da4e5d49be32d2c6c11cd8960 /Source/CMMCPResult.h | |
parent | 0cf5b0031043c160b002b7bd02f31c9f4e5eb626 (diff) | |
download | sequelpro-6f8253e66be9dac0c3c96e16d9f97fda3fc7e818.tar.gz sequelpro-6f8253e66be9dac0c3c96e16d9f97fda3fc7e818.tar.bz2 sequelpro-6f8253e66be9dac0c3c96e16d9f97fda3fc7e818.zip |
• introduced the method (NSArray *)fetchResultFieldsStructure to CMMCPResult
- it returns an array of dicts containing general information about each field of the result array of the last executed query
dict example so far for:
SELECT ucs_comp AS co FROM comp_ucs3 AS co_table
AUTO_INCREMENT_FLAG = 0;
BINARY_FLAG = 0;
BLOB_FLAG = 0;
ENUM_FLAG = 0;
MULTIPLE_KEY_FLAG = 1;
NOT_NULL_FLAG = 0;
NUM_FLAG = 0;
PART_KEY_FLAG = 1;
PRI_KEY_FLAG = 0;
SET_FLAG = 0;
UNIQUE_KEY_FLAG = 0;
UNSIGNED_FLAG = 0;
ZEROFILL_FLAG = 0;
byte_length = 30;
char_length = 10;
charset_collation = utf8_general_ci;
charset_name = utf8;
charsetnr = 33;
db = test;
decimals = 0;
flags = 16392;
max_byte_length = 4;
max_char_length = 1;
name = co;
org_name = ucs_comp;
org_table = comp_ucs3;
table = co_table;
type = VARCHAR;
typegrouping = string;
Hint: To test that new method one can add the following code after the execution of a mysql query:
NSArray *fStruct = [NSArray arrayWithArray:[theResult fetchResultFieldsStructure]];
Diffstat (limited to 'Source/CMMCPResult.h')
-rw-r--r-- | Source/CMMCPResult.h | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/Source/CMMCPResult.h b/Source/CMMCPResult.h index 68f7061a..e6c99fde 100644 --- a/Source/CMMCPResult.h +++ b/Source/CMMCPResult.h @@ -26,10 +26,29 @@ #import <Cocoa/Cocoa.h> #import <MCPKit_bundled/MCPKit_bundled.h> -#define FIELD_TYPE_BIT 16 +#define FIELD_TYPE_BIT 16 +#define MAGIC_BINARY_CHARSET_NR 63 @interface CMMCPResult : MCPResult +typedef struct st_our_charset +{ + unsigned int nr; + const char *name; + const char *collation; + unsigned int char_minlen; + unsigned int char_maxlen; +} OUR_CHARSET; + + - (id)fetchRowAsType:(MCPReturnType)aType; +- (NSArray *)fetchResultFieldsStructure; + + +- (NSString *)mysqlTypeToStringForType:(unsigned int)type withCharsetNr:(unsigned int)charsetnr withFlags:(unsigned int)flags withLength:(unsigned long long)length; +- (NSString *)mysqlTypeToGroupForType:(unsigned int)type withCharsetNr:(unsigned int)charsetnr withFlags:(unsigned int)flags; +- (NSString *)find_charsetName:(unsigned int)charsetnr; +- (NSString *)find_charsetCollation:(unsigned int)charsetnr; +- (unsigned int)find_charsetMaxByteLengthPerChar:(unsigned int)charsetnr; @end |