Update of /cvsroot/pgsqlformac/pgCocoaDB In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7546 Modified Files: ChangeLog Connection.h Connection.m ExplorerModel.m ExplorerNode.h ExplorerNode.m Schema.h Schema.m Log Message: Add color to Explorer View, add index count function. Index: ChangeLog =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ChangeLog,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ChangeLog 21 Jun 2006 11:47:09 -0000 1.11 --- ChangeLog 16 Jul 2006 23:13:06 -0000 1.12 *************** *** 1,2 **** --- 1,11 ---- + 2006-06-24 11:16 ntiffin + + * Connection.h, Connection.m, ExplorerModel.m, Schema.m: Add SQL + log functions, correct bug in schema dealloc. + + 2006-06-21 06:47 ntiffin + + * ChangeLog: Test commits mail list. + 2006-06-20 11:26 ntiffin Index: Schema.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Schema.m,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Schema.m 24 Jun 2006 16:16:33 -0000 1.15 --- Schema.m 16 Jul 2006 23:13:06 -0000 1.16 *************** *** 22,26 **** Field * versionField; ! self = [super init]; connection = theConnection; [connection retain]; --- 22,26 ---- Field * versionField; ! [super init]; connection = theConnection; [connection retain]; *************** *** 134,137 **** --- 134,149 ---- } + -(int)getIndexCountFromSchema:(NSString *)schemaName fromTableName:(NSString *) tableName; + { + NSString *sql; + + sql = [NSString stringWithFormat:@"SELECT count(*) FROM pg_catalog.pg_indexes WHERE schemaname = '%@' AND tablename = '%@'", schemaName, tableName]; + #if PGCOCOA_LOG_SQL + NSLog(sql); + #endif + RecordSet * results = [connection execQueryNoLog:sql]; + + return [[[[[results itemAtIndex: 0] fields] itemAtIndex:0] value] intValue]; + } -(RecordSet *)getIndexNamesFromSchema:(NSString *)schemaName fromTableName:(NSString *) tableName; *************** *** 139,143 **** NSString *sql; ! sql = [NSMutableString stringWithFormat:@"%s'%@'%s'%@'%s","SELECT indexname \ FROM pg_catalog.pg_indexes WHERE schemaname = ", schemaName, " AND tablename = ", tableName, " ORDER BY indexname ASC"]; //return [self getNamesFromSchema:schemaName fromType: @"i"]; --- 151,155 ---- NSString *sql; ! sql = [NSString stringWithFormat:@"%s'%@'%s'%@'%s","SELECT indexname \ FROM pg_catalog.pg_indexes WHERE schemaname = ", schemaName, " AND tablename = ", tableName, " ORDER BY indexname ASC"]; //return [self getNamesFromSchema:schemaName fromType: @"i"]; *************** *** 152,156 **** { NSString * sql; ! sql = [NSMutableString stringWithString:@"SELECT schema_name FROM information_schema.schemata ORDER BY schema_name"]; #if PGCOCOA_LOG_SQL NSLog(sql); --- 164,168 ---- { NSString * sql; ! sql = [NSString stringWithString:@"SELECT schema_name FROM information_schema.schemata ORDER BY schema_name"]; #if PGCOCOA_LOG_SQL NSLog(sql); Index: Schema.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Schema.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** Schema.h 2 Jun 2006 11:48:17 -0000 1.9 --- Schema.h 16 Jul 2006 23:13:06 -0000 1.10 *************** *** 63,68 **** -(NSString *)getViewCommentFromSchema:(NSString *)schemaName fromViewName:(NSString *)viewName; ! // get server info -(RecordSet *)getLocks; @end --- 63,69 ---- -(NSString *)getViewCommentFromSchema:(NSString *)schemaName fromViewName:(NSString *)viewName; ! // get server info or misc -(RecordSet *)getLocks; + -(int)getIndexCountFromSchema:(NSString *)schemaName fromTableName:(NSString *) tableName; @end Index: Connection.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Connection.m,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Connection.m 24 Jun 2006 16:16:33 -0000 1.10 --- Connection.m 16 Jul 2006 23:13:06 -0000 1.11 *************** *** 330,333 **** --- 330,343 ---- - (RecordSet *)execQuery:(NSString *)sql { + #if PG_COCOA_DEBUG == 1 + return [self execQuery:sql logInfo:0 logSQL:0]; + #else + return [self execQuery:sql logInfo:0 logSQL:0]; + #endif + } + + + - (RecordSet *)execQueryLog:(NSString *)sql + { return [self execQuery:sql logInfo:1 logSQL:0]; } Index: Connection.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/Connection.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Connection.h 24 Jun 2006 16:16:33 -0000 1.5 --- Connection.h 16 Jul 2006 23:13:06 -0000 1.6 *************** *** 71,74 **** --- 71,75 ---- - (RecordSet *)execQuery:(NSString *)sql; - (RecordSet *)execQueryNoLog:(NSString *)sql; + - (RecordSet *)execQueryLog:(NSString *)sql; - (RecordSet *)execQuery:(NSString *)sql logInfo:(bool)logInfo logSQL:(bool)logSQL; - (NSString *)execCommand:(NSString *)sql; Index: ExplorerNode.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerNode.m,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ExplorerNode.m 13 May 2006 18:04:00 -0000 1.3 --- ExplorerNode.m 16 Jul 2006 23:13:06 -0000 1.4 *************** *** 52,55 **** --- 52,60 ---- -(NSString *) name { + return [name string]; + } + + -(NSAttributedString *) attributedName + { return name; } *************** *** 91,100 **** -(void)setName:(NSString *)s { - [s retain]; [name release]; ! name = s; } ! -(void)setBaseTable:(NSString *)s; { [s retain]; --- 96,110 ---- -(void)setName:(NSString *)s { [name release]; ! name = [[NSAttributedString alloc] initWithString:s]; ! [name retain]; } ! -(void)setNameColor:(NSColor *)s ! { ! ; //TODO ! } ! ! -(void)setBaseTable:(NSString *)s { [s retain]; *************** *** 103,107 **** } ! -(void)setExplorerType:(NSString *)s; { [s retain]; --- 113,117 ---- } ! -(void)setExplorerType:(NSString *)s { [s retain]; Index: ExplorerModel.m =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerModel.m,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ExplorerModel.m 24 Jun 2006 16:16:33 -0000 1.6 --- ExplorerModel.m 16 Jul 2006 23:13:06 -0000 1.7 *************** *** 473,477 **** // What is returned depends upon which column it is going to appear. if ([identifier isEqual:@"col1"]) ! return [item name]; if ([identifier isEqual:@"col2"]) return [item displayColumn2]; --- 473,488 ---- // What is returned depends upon which column it is going to appear. if ([identifier isEqual:@"col1"]) ! { ! if ([[item explorerType] isEqualToString:@"Schema Child"] ) ! { ! NSDictionary *attributes = [[NSDictionary alloc] initWithObjectsAndKeys:[NSColor blueColor], NSForegroundColorAttributeName, nil]; ! NSAttributedString *myString = [[NSAttributedString alloc] initWithString:[item name] attributes: attributes]; ! return myString; ! } ! else ! { ! return [item name]; ! } ! } if ([identifier isEqual:@"col2"]) return [item displayColumn2]; Index: ExplorerNode.h =================================================================== RCS file: /cvsroot/pgsqlformac/pgCocoaDB/ExplorerNode.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ExplorerNode.h 13 May 2006 18:04:00 -0000 1.2 --- ExplorerNode.h 16 Jul 2006 23:13:06 -0000 1.3 *************** *** 12,16 **** NSMutableArray * children; ExplorerNode * parent; ! NSString * name; // name of this node displayed in column 1 // of the outline view NSString * baseTable; // pg_catalog table where the oid resides --- 12,16 ---- NSMutableArray * children; ExplorerNode * parent; ! NSAttributedString * name; // name of this node displayed in column 1 // of the outline view NSString * baseTable; // pg_catalog table where the oid resides *************** *** 26,29 **** --- 26,30 ---- // Accessor methods -(NSString *)name; + //-(NSAttributedString *) attributedName; -(NSString *)baseTable; -(NSString *)explorerType; *************** *** 34,37 **** --- 35,39 ---- -(void)setName:(NSString *)s; + -(void)setNameColor:(NSColor *)s; -(void)setBaseTable:(NSString *)s; -(void)setExplorerType:(NSString *)s; |