From 44cf4df2bbe2e9208faef346abc0a64e62432592 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 7 Dec 2010 11:16:55 +0000 Subject: =?UTF-8?q?=E2=80=A2=20Bundle=20command=20support=20-=20fixed=20is?= =?UTF-8?q?sue=20for=20commands=20without=20assigning=20a=20key=20equivale?= =?UTF-8?q?nt=20-=20output=20table=20meta=20data=20about=20type,=20type=20?= =?UTF-8?q?grouping,=20length,=20auto=5Finc,=20PRI=20key=20etc.=20for=20Da?= =?UTF-8?q?ta=20Table=20scope=20commands=20and=20sequelpro=20url=20scheme?= =?UTF-8?q?=20command=20ExecuteQuery?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/SPDatabaseDocument.m | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'Source/SPDatabaseDocument.m') diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index cc5185ac..5f05573c 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -4691,6 +4691,28 @@ NSArray *columnDefinition = [theResult fetchResultFieldsStructure]; + // Write table meta data + NSMutableString *tableMetaData = [NSMutableString string]; + for(NSDictionary* col in columnDefinition) { + [tableMetaData appendFormat:@"%@\t", [col objectForKey:@"type"]]; + [tableMetaData appendFormat:@"%@\t", [col objectForKey:@"typegrouping"]]; + [tableMetaData appendFormat:@"%@\t", ([col objectForKey:@"char_length"]) ? : @""]; + [tableMetaData appendFormat:@"%@\t", [col objectForKey:@"UNSIGNED_FLAG"]]; + [tableMetaData appendFormat:@"%@\t", [col objectForKey:@"AUTO_INCREMENT_FLAG"]]; + [tableMetaData appendFormat:@"%@\t", [col objectForKey:@"PRI_KEY_FLAG"]]; + [tableMetaData appendString:@"\n"]; + } + NSError *err = nil; + [tableMetaData writeToFile:metaFileName + atomically:YES + encoding:NSUTF8StringEncoding + error:&err]; + if(err != nil) { + NSLog(@"Error while writing “%@”", tableMetaData); + NSBeep(); + return; + } + // write data NSInteger i, j; NSArray *theRow; -- cgit v1.2.3