-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathPGSQLConnectionInfo.m
50 lines (39 loc) · 974 Bytes
/
PGSQLConnectionInfo.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// PGSQLConnectionInfo.m
// PGSQLKit
//
// Created by Andy Satori on 4/21/09.
// Copyright 2009 Druware Software Designs. All rights reserved.
//
#import "PGSQLConnectionInfo.h"
@implementation PGSQLConnectionInfo
-(id)initWithConnection:(PGSQLConnection *)connection
{
[super init];
pgConnection = connection;
[pgConnection retain];
NSMutableString *cmd = [[NSMutableString alloc] init];
[cmd appendString:@"select current_database() as db, current_user as user, version() as version, current_schema() as schema"];
PGSQLRecordset *rs = [pgConnection open:cmd];
if (![rs isEOF])
{
//userName = [[rs fieldByIndex:1] asString];
versionString = [[rs fieldByIndex:2] asString];
//schemaName = [[rs fieldByIndex:3] asString];
}
[rs close];
[cmd release];
return self;
}
-(void)dealloc
{
[pgConnection release];
[super dealloc];
}
#pragma mark -
#pragma mark Simple Accessors
- (NSString *)versionString
{
return versionString;
}
@end