Initial import.
FossilOrigin-Name: de46b0e10c5d9f516acbbf2ea01d84d0d5ac126412949d459265279262a1b87e
This commit is contained in:
commit
dbfce3528e
15 changed files with 586 additions and 0 deletions
46
PGResult.m
Normal file
46
PGResult.m
Normal file
|
@ -0,0 +1,46 @@
|
|||
#import "PGResult.h"
|
||||
#import "PGResultRow.h"
|
||||
|
||||
@implementation PGResult
|
||||
+ PG_resultWithResult: (PGresult*)result
|
||||
{
|
||||
return [[[self alloc] PG_initWithResult: result] autorelease];
|
||||
}
|
||||
|
||||
- PG_initWithResult: (PGresult*)result_
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
result = result_;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
if (result != NULL)
|
||||
PQclear(result);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (size_t)count
|
||||
{
|
||||
return PQntuples(result);
|
||||
}
|
||||
|
||||
- (id)objectAtIndex: (size_t)index
|
||||
{
|
||||
if (index > PQntuples(result))
|
||||
@throw [OFOutOfRangeException
|
||||
exceptionWithClass: [self class]];
|
||||
|
||||
return [PGResultRow rowWithResult: self
|
||||
row: index];
|
||||
}
|
||||
|
||||
- (PGresult*)PG_result
|
||||
{
|
||||
return result;
|
||||
}
|
||||
@end
|
Loading…
Add table
Add a link
Reference in a new issue