aboutsummaryrefslogtreecommitdiffstats
path: root/Source/CustomQuery.m
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2010-01-20 23:51:15 +0000
committerrowanbeentje <rowan@beent.je>2010-01-20 23:51:15 +0000
commita485d370c24cb6378a52c3452dc0cdbadfefd50f (patch)
treef3bb2ded2b5571d860d7677cca509d575ec5ef81 /Source/CustomQuery.m
parent38ed0a7356c24b2113e157fbec26004100b5f1e9 (diff)
downloadsequelpro-a485d370c24cb6378a52c3452dc0cdbadfefd50f.tar.gz
sequelpro-a485d370c24cb6378a52c3452dc0cdbadfefd50f.tar.bz2
sequelpro-a485d370c24cb6378a52c3452dc0cdbadfefd50f.zip
Address Issue #546 (format string bugs):
- Fix incorrect uses of [NSString stringWithFormat:] with preconstructed strings and no arguments in SPUserManager - To fix display issues, replace NSBeginAlertSheet (which includes automatic sprintf expansion of the message) with a safely-escaped SPBeginAlertSheet in many files
Diffstat (limited to 'Source/CustomQuery.m')
-rw-r--r--Source/CustomQuery.m11
1 files changed, 6 insertions, 5 deletions
diff --git a/Source/CustomQuery.m b/Source/CustomQuery.m
index e35a7b26..790db8f5 100644
--- a/Source/CustomQuery.m
+++ b/Source/CustomQuery.m
@@ -42,6 +42,7 @@
#import "SPConstants.h"
#import "SPEncodingPopupAccessory.h"
#import "SPDataStorage.h"
+#import "SPAlertSheets.h"
@implementation CustomQuery
@@ -162,7 +163,7 @@
// This should never evaluate to true as we are now performing menu validation, meaning the 'Save Query to Favorites' menu item will
// only be enabled if the query text view has at least one character present.
if ([[textView string] isEqualToString:@""]) {
- NSBeginAlertSheet(NSLocalizedString(@"Empty query", @"empty query message"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ SPBeginAlertSheet(NSLocalizedString(@"Empty query", @"empty query message"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
NSLocalizedString(@"Cannot save an empty query.", @"empty query informative message"));
return;
}
@@ -179,7 +180,7 @@
// This should never evaluate to true as we are now performing menu validation, meaning the 'Save Query to Favorites' menu item will
// only be enabled if the query text view has at least one character present.
if ([[textView string] isEqualToString:@""]) {
- NSBeginAlertSheet(NSLocalizedString(@"Empty query", @"empty query message"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ SPBeginAlertSheet(NSLocalizedString(@"Empty query", @"empty query message"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
NSLocalizedString(@"Cannot save an empty query.", @"empty query informative message"));
return;
}
@@ -1545,7 +1546,7 @@
// Check for errors while UPDATE
if ( ![[mySQLConnection getLastErrorMessage] isEqualToString:@""] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, nil, nil, nil,
+ SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), NSLocalizedString(@"Cancel", @"cancel button"), nil, tableWindow, self, nil, nil, nil,
[NSString stringWithFormat:NSLocalizedString(@"Couldn't write field.\nMySQL said: %@", @"message of panel when error while updating field to db"), [mySQLConnection getLastErrorMessage]]);
return;
@@ -1555,7 +1556,7 @@
// This shouldn't happen – for safety reasons
if ( ![mySQLConnection affectedRows] ) {
if ( [prefs boolForKey:SPShowNoAffectedRowsError] ) {
- NSBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ SPBeginAlertSheet(NSLocalizedString(@"Warning", @"warning"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
NSLocalizedString(@"The row was not written to the MySQL database. You probably haven't changed anything.\nReload the table to be sure that the row exists and use a primary key for your table.\n(This error can be turned off in the preferences.)", @"message of panel when no rows have been affected after writing to the db"));
} else {
NSBeep();
@@ -1569,7 +1570,7 @@
[self performQueries:[NSArray arrayWithObject:lastExecutedQuery] withCallback:NULL];
} else {
- NSBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
+ SPBeginAlertSheet(NSLocalizedString(@"Error", @"error"), NSLocalizedString(@"OK", @"OK button"), nil, nil, tableWindow, self, nil, nil, nil,
[NSString stringWithFormat:NSLocalizedString(@"Updating field content failed. Couldn't identify field origin unambiguously (%ld match%@). It's very likely that while editing this field the table `%@` was changed by an other user.", @"message of panel when error while updating field to db after enabling it"),
(long)numberOfPossibleUpdateRows, (numberOfPossibleUpdateRows>1)?@"es":@"", tableForColumn]);