반응형
sql이 사용하기 편하다 - 단점은 느리다 ㅡㅡ;
https://www.sqlite.org/download.html
- SQLite 의 SQL 문은 대소문자 구분이 없다.
#import <sqlite3.h> sqlite3 *database; NSString *databaseName = @"audreyDev001.db";;;;;;;;;;;;;;;;;;; NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);;;;;;;;;;;;;; NSString *documentsDir = [documentPaths objectAtIndex:0];;;;;;;;;;;;;;;;;;;; NSString *databasePath = [documentsDir stringByAppendingPathComponent:databaseName];;;;;;;;;;;; NSString *currentProgressString = @""; if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK) { NSString *query = @"select mId \ from table_user;"; const char *sqlStatement = [query cStringUsingEncoding:NSASCIIStringEncoding]; sqlite3_stmt *compiledStatement; if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) { // Loop through the results and add them to the feeds array while(sqlite3_step(compiledStatement) == SQLITE_ROW) { currentProgressString = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 0)]; break; } } sqlite3_finalize(compiledStatement);;;;;;;;;;;;;;;;;;;;;;;;;; } sqlite3_close(database);;;;;;;;;;;;;;;;;;;;;;;;;;;; |
DFCT_LIST*data=[[DFCT_LISTalloc]init]; data.id_mbil=sqlite3_column_int(compiledStatement,0); data.cd_dong=[NSStringstringWithUTF8String:(char*)sqlite3_column_text(compiledStatement,1)]; data.nohs=[NSStringstringWithUTF8String:(char*)sqlite3_column_text(compiledStatement,2)]; data.id_rgon=sqlite3_column_int(compiledStatement,13); |
NSString *col = [NSString stringWithUTF8String:(char *)sqlite3_column_name(compiledStatement, i)]; NSString *data = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, i)]; |
SELECT
select user_id from audrey_user_id; |
select count(a.myid) from mylist a; |
나머지는 ... 다른 곳이 워낙 잘 나와있어서... 구글링 ㄱ
반응형
'C++' 카테고리의 다른 글
SOAP protocol (0) | 2021.05.18 |
---|---|
자주 쓰는 팝업 구현방법, 그리고 데이터 넘기기 (0) | 2021.05.18 |
서버 개발자와 작업시 찾기 힘든 에러... (0) | 2021.05.18 |
순수 학문으로 다시 돌아 갑니다. (0) | 2021.05.18 |
USB-C, Thunderbolt3 (0) | 2021.02.28 |
최근댓글