aboutsummaryrefslogtreecommitdiffstats
path: root/Frameworks/PostgresKit/Source/FLXPostgresConnectionUtils.m
diff options
context:
space:
mode:
authorstuconnolly <stuart02@gmail.com>2012-09-07 09:57:31 +0000
committerstuconnolly <stuart02@gmail.com>2012-09-07 09:57:31 +0000
commite8bf8bf422b83a55cefd1bdf149f380a822eb880 (patch)
tree6c9b5114ca6be1aebb28e212352599018e4115a7 /Frameworks/PostgresKit/Source/FLXPostgresConnectionUtils.m
parent1a20cd03f29b0c0ee842008b1445ba54ad23dc69 (diff)
downloadsequelpro-e8bf8bf422b83a55cefd1bdf149f380a822eb880.tar.gz
sequelpro-e8bf8bf422b83a55cefd1bdf149f380a822eb880.tar.bz2
sequelpro-e8bf8bf422b83a55cefd1bdf149f380a822eb880.zip
Remove object quoting and keep track of data type support.
Diffstat (limited to 'Frameworks/PostgresKit/Source/FLXPostgresConnectionUtils.m')
-rw-r--r--Frameworks/PostgresKit/Source/FLXPostgresConnectionUtils.m8
1 files changed, 4 insertions, 4 deletions
diff --git a/Frameworks/PostgresKit/Source/FLXPostgresConnectionUtils.m b/Frameworks/PostgresKit/Source/FLXPostgresConnectionUtils.m
index e988c7f2..73235766 100644
--- a/Frameworks/PostgresKit/Source/FLXPostgresConnectionUtils.m
+++ b/Frameworks/PostgresKit/Source/FLXPostgresConnectionUtils.m
@@ -49,7 +49,7 @@
*/
- (NSArray *)schemas
{
- return [self isConnected] ? [self _executeAndReturnResult:[NSString stringWithFormat:@"SELECT \"schema_name\" FROM \"information_schema\".\"schemata\" WHERE \"catalog_name\" = %@", [self quote:[self database]]]] : nil;
+ return [self isConnected] ? [self _executeAndReturnResult:[NSString stringWithFormat:@"SELECT \"schema_name\" FROM \"information_schema\".\"schemata\" WHERE \"catalog_name\" = '%@'", [self database]]] : nil;
}
/**
@@ -63,7 +63,7 @@
{
if (![self isConnected] || !schema || ![schema length]) return nil;
- return [self _executeAndReturnResult:[NSString stringWithFormat:@"SELECT \"table_name\" FROM \"information_schema\".\"tables\" WHERE \"table_catalog\" = %@ AND \"table_schema\" = %@ AND \"table_type\" = 'BASE TABLE'", [self quote:[self database]], [self quote:schema]]];
+ return [self _executeAndReturnResult:[NSString stringWithFormat:@"SELECT \"table_name\" FROM \"information_schema\".\"tables\" WHERE \"table_catalog\" = '%@' AND \"table_schema\" = '%@' AND \"table_type\" = 'BASE TABLE'",[self database], schema]];
}
/**
@@ -79,7 +79,7 @@
if (![self isConnected] || !table || ![table length] || !schema || ![schema length]) return nil;
NSString *join = @"\"information_schema\".\"table_constraints\" t INNER JOIN \"information_schema\".\"key_column_usage\" k ON t.\"constraint_name\" = k.\"constraint_name\"";
- NSString *where = [NSString stringWithFormat:@"t.\"constraint_type\" = 'PRIMARY KEY' AND t.\"table_catalog\" = %@ AND t.\"table_schema\" = %@ AND t.\"table_name\" = %@", [self quote:[self database]], [self quote:schema], [self quote:table]];
+ NSString *where = [NSString stringWithFormat:@"t.\"constraint_type\" = 'PRIMARY KEY' AND t.\"table_catalog\" = '%@' AND t.\"table_schema\" = '%@' AND t.\"table_name\" = '%@'", [self database], schema, table];
FLXPostgresResult *result = [self executeWithFormat:@"SELECT k.\"column_name\" FROM %@ WHERE %@", join, where];
@@ -98,7 +98,7 @@
{
if (![self isConnected] || !table || ![table length] || !schema || ![schema length]) return nil;
- return [self _executeAndReturnResult:[NSString stringWithFormat:@"SELECT \"column_name\" FROM \"information_schema\".\"columns\" WHERE \"table_catalog\" = %@ AND \"table_schema\" = %@ AND \"table_name\" = %@", [self quote:[self database]], [self quote:schema], [self quote:table]]];
+ return [self _executeAndReturnResult:[NSString stringWithFormat:@"SELECT \"column_name\" FROM \"information_schema\".\"columns\" WHERE \"table_catalog\" = '%@' AND \"table_schema\" = '%@' AND \"table_name\" = '%@'", [self database], schema, table]];
}
#pragma mark -