aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbamse16 <marius@marius.me.uk>2009-03-11 04:26:30 +0000
committerbamse16 <marius@marius.me.uk>2009-03-11 04:26:30 +0000
commit14e31698388f4472cedf62dbd4f60a5749de0306 (patch)
tree13cfb496637ae7cfabca806f9d2d7db0d05aea8f
parente8d8d6cc38cc92b7201806ed42db50a4c4b324ea (diff)
downloadsequelpro-14e31698388f4472cedf62dbd4f60a5749de0306.tar.gz
sequelpro-14e31698388f4472cedf62dbd4f60a5749de0306.tar.bz2
sequelpro-14e31698388f4472cedf62dbd4f60a5749de0306.zip
Small fixes clang complained about. Others will follow
-rw-r--r--Source/TableContent.m13
-rw-r--r--Source/TablesList.m9
2 files changed, 15 insertions, 7 deletions
diff --git a/Source/TableContent.m b/Source/TableContent.m
index 3443a73f..9548f191 100644
--- a/Source/TableContent.m
+++ b/Source/TableContent.m
@@ -1156,7 +1156,6 @@
- (BOOL)addRowToDB
{
NSArray *theColumns, *columnNames;
- NSMutableArray *fieldValues = [[NSMutableArray alloc] init];
NSMutableString *queryString;
NSString *query;
CMMCPResult *queryResult;
@@ -1166,7 +1165,6 @@
int i;
if ( !isEditingRow || currentlyEditingRow == -1) {
- [fieldValues release];
return YES;
}
@@ -1183,6 +1181,7 @@
theColumns = [tableDataInstance columns];
columnNames = [tableDataInstance columnNames];
+ NSMutableArray *fieldValues = [[NSMutableArray alloc] init];
// Get the field values
for ( i = 0 ; i < [columnNames count] ; i++ ) {
rowObject = [[filteredResult objectAtIndex:currentlyEditingRow] objectForKey:[columnNames objectAtIndex:i]];
@@ -1824,13 +1823,19 @@ objectValueForTableColumn:(NSTableColumn *)aTableColumn
if ( [tableColumnWidths objectForKey:database] == nil ) {
[tableColumnWidths setObject:[NSMutableDictionary dictionary] forKey:database];
} else {
- [tableColumnWidths setObject:[[tableColumnWidths objectForKey:database] mutableCopy] forKey:database];
+ //[NSMutableArray arrayWithArray:array]; vs [array mutableCopy];
+ //[tableColumnWidths setObject:[[tableColumnWidths objectForKey:database] mutableCopy] forKey:database];
+ [tableColumnWidths setObject:[NSMutableArray arrayWithArray:[tableColumnWidths objectForKey:database]] forKey:database];
+
}
// get table object
if ( [[tableColumnWidths objectForKey:database] objectForKey:table] == nil ) {
[[tableColumnWidths objectForKey:database] setObject:[NSMutableDictionary dictionary] forKey:table];
} else {
- [[tableColumnWidths objectForKey:database] setObject:[[[tableColumnWidths objectForKey:database] objectForKey:table] mutableCopy] forKey:table];
+ //[NSMutableArray arrayWithArray:array]; vs [array mutableCopy];
+ //[[tableColumnWidths objectForKey:database] setObject:[[[tableColumnWidths objectForKey:database] objectForKey:table] mutableCopy] forKey:table];
+ [[tableColumnWidths objectForKey:database] setObject:[NSMutableArray arrayWithArray:[[tableColumnWidths objectForKey:database] objectForKey:table]] forKey:table];
+
}
// save column size
[[[tableColumnWidths objectForKey:database] objectForKey:table] setObject:[NSNumber numberWithFloat:[[[aNotification userInfo] objectForKey:@"NSTableColumn"] width]] forKey:[[[aNotification userInfo] objectForKey:@"NSTableColumn"] identifier]];
diff --git a/Source/TablesList.m b/Source/TablesList.m
index e1122768..602e4644 100644
--- a/Source/TablesList.m
+++ b/Source/TablesList.m
@@ -139,8 +139,6 @@ copies a table, if desired with content
- (IBAction)copyTable:(id)sender
{
CMMCPResult *queryResult;
- NSScanner *scanner = [NSScanner alloc];
- NSString *scanString;
// NSArray *fieldNames;
// NSArray *theRow;
// NSMutableString *rowValue = [NSMutableString string];
@@ -151,8 +149,9 @@ copies a table, if desired with content
if ( [tablesListView numberOfSelectedRows] != 1 )
return;
- if ( ![tableSourceInstance saveRowOnDeselect] || ![tableContentInstance saveRowOnDeselect] )
+ if ( ![tableSourceInstance saveRowOnDeselect] || ![tableContentInstance saveRowOnDeselect] ) {
return;
+ }
[tableWindow endEditingFor:nil];
//open copyTableSheet
@@ -187,10 +186,14 @@ copies a table, if desired with content
} else {
//insert new table name in create syntax and create new table
+ NSScanner *scanner = [NSScanner alloc];
+ NSString *scanString;
+
[scanner initWithString:[[queryResult fetchRowAsDictionary] objectForKey:@"Create Table"]];
[scanner scanUpToString:@"(" intoString:nil];
[scanner scanUpToString:@"" intoString:&scanString];
[mySQLConnection queryString:[NSString stringWithFormat:@"CREATE TABLE `%@` %@", [copyTableNameField stringValue], scanString]];
+ [scanner release];
if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
//error while creating new table