Created
August 7, 2011 09:09
-
-
Save anonymous/1130222 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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