aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormltownsend <mltownsend@gmail.com>2009-08-11 18:04:18 +0000
committermltownsend <mltownsend@gmail.com>2009-08-11 18:04:18 +0000
commit43f065eac4c0514e1cbc4b77361a6de55cd5e149 (patch)
treee1d986e6918deb2f5b87a4ab37eca9ea1a3e8474
parent73ebc8d1fcec1d9b23bbee6e323ddb3f39ce9b15 (diff)
downloadsequelpro-43f065eac4c0514e1cbc4b77361a6de55cd5e149.tar.gz
sequelpro-43f065eac4c0514e1cbc4b77361a6de55cd5e149.tar.bz2
sequelpro-43f065eac4c0514e1cbc4b77361a6de55cd5e149.zip
Minor tweaks.
-rw-r--r--Source/SPUserManager.m34
1 files changed, 19 insertions, 15 deletions
diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m
index 9ef3e8ba..8fddb2aa 100644
--- a/Source/SPUserManager.m
+++ b/Source/SPUserManager.m
@@ -95,10 +95,10 @@
selector:@selector(contextDidSave:)
name:NSManagedObjectContextDidSaveNotification
object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(contextDidChange:)
- name:NSManagedObjectContextObjectsDidChangeNotification
- object:nil];
+ //[[NSNotificationCenter defaultCenter] addObserver:self
+// selector:@selector(contextDidChange:)
+// name:NSManagedObjectContextObjectsDidChangeNotification
+// object:nil];
[tabView selectTabViewItemAtIndex:0];
NSTableColumn *tableColumn = [outlineView tableColumnWithIdentifier:COLUMNIDNAME];
@@ -107,7 +107,8 @@
[imageAndTextCell setEditable:NO];
[tableColumn setDataCell:imageAndTextCell];
- [NSThread detachNewThreadSelector:@selector(_initializeUsers) toTarget:self withObject:nil];
+ [NSThread detachNewThreadSelector:@selector(_initializeUsers) toTarget:self withObject:nil];
+ [window makeKeyAndOrderFront:nil];
}
- (void)_initializeUsers
@@ -182,6 +183,7 @@
}
[array release];
}
+ [outlineView reloadData];
}
- (void)initializeChild:(NSManagedObject *)child withItem:(NSDictionary *)item
@@ -529,16 +531,18 @@
[[self connection] selectDB:@"mysql"];
for(NSManagedObject *user in insertedUsers)
{
- NSString *createStatement = [NSString stringWithFormat:@"CREATE USER %@@%@ IDENTIFIED BY %@;",
- [[[user parent] valueForKey:@"user"] tickQuotedString],
- [[user valueForKey:@"host"] tickQuotedString],
- [[[user parent] valueForKey:@"password"] tickQuotedString]];
- // Create user in database
- [[self connection] queryString:[NSString stringWithFormat:createStatement]];
-
- if ([self checkAndDisplayMySqlError])
- {
- [self grantPrivilegesToUser:user];
+ if ([user parent] != nil) {
+ NSString *createStatement = [NSString stringWithFormat:@"CREATE USER %@@%@ IDENTIFIED BY %@;",
+ [[[user parent] valueForKey:@"user"] tickQuotedString],
+ [[user valueForKey:@"host"] tickQuotedString],
+ [[[user parent] valueForKey:@"password"] tickQuotedString]];
+ // Create user in database
+ [[self connection] queryString:[NSString stringWithFormat:createStatement]];
+
+ if ([self checkAndDisplayMySqlError])
+ {
+ [self grantPrivilegesToUser:user];
+ }
}
}