Skip to content

Instantly share code, notes, and snippets.

Created August 7, 2011 09:09
Show Gist options
  • Save anonymous/1130222 to your computer and use it in GitHub Desktop.
Save anonymous/1130222 to your computer and use it in GitHub Desktop.
#import <Foundation/Foundation.h>
@interface HCPCSCodes : NSObject
@property (nonatomic, copy) NSString *code;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *description;
@end
#import "HCPCSCodes.h"
@implementation HCPCSCodes
@synthesize code;
@synthesize name;
@synthesize description;
- (void)dealloc
{
[code release];
[name release];
[description release];
[super dealloc];
}
@end
-(NSMutableArray *) getHCPCSCodes
{
sqlite3 *database = HCPCSCodesDatabase();
NSMutableArray *HCPCSCodes = [[[NSMutableArray alloc] init] autorelease];
NSString *nsquery = [[NSString alloc] initWithFormat:@"SELECT * FROM EMPLOYEE ORDER BY EMPLOYEE_ID"];
const char *query = [nsquery UTF8String];
[nsquery release];
sqlite3_stmt *statement;
int prepareCode = (sqlite3_prepare_v2( database, query, -1, &statement, NULL));
if(prepareCode == SQLITE_OK) {
while (sqlite3_step(statement) == SQLITE_ROW) {
HCPCSCodes *newHCPCSCode = [[HCPCSCodes alloc] init];
newHCPCSCode.code = sqlite3_column_int(statement, 0);
newHCPCSCode.name = sqlite3_column_int(statement, 2);
newHCPCSCode.description = sqlite3_column_int(statement, 3);
[HCPCSCodes addObject:newHCPCSCode];
[newHCPCSCode release];
}
sqlite3_finalize(statement);
}
return HCPCSCodes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment