2009-01-28 165 views
0

我想完成一個iPhone應用程序。爲此,我需要從MySQL獲取數據庫到SQLite。對於這種情況,我確實使用了一些類似波紋管的代碼 -從MySQL獲取數據庫到SQLite

MCPConnection *theConnec; 
MCPResult *theRes; 
//initialize connection string vars 
NSString *dbURL = @"XXXXXX"; 
NSString *userName = @"XXXXXX"; 
NSString *pass = @"XXXXXX"; 
//open connection to database 
theConnec = [theConnec initToHost:dbURL withLogin:userName password:pass usingPort:3306]; 
//NSLog(@"The connection to database was successfull"); 
[theConnec selectDB:@"XXXXXX"]; 
//{ 
// NSLog(@"Database found"); 
//} 
//else 
//{ 
// NSLog(@"Database not found"); 
//} 
theRes = [theConnec queryString:@"select * from seahawk_tag"]; 
//get the number of rows 
NSInteger numberOfRows = [theRes numofRows]; 
NSLog(@"Query of MySQL Database %@", numberOfRows); 
return NSApplicationMain(argc, (const char **) argv); 
[theConnec release]; 

但是,此代碼無法正常工作。這裏還提到我使用了一些框架,比如cocoa.framework,cocos2d,openGLES.framework,openAL.framework,APPKit.framework,MCPKit.framework,Quartzcore.framewrok。 ,最後我收到CIColer.h丟失的錯誤消息。

freinds,如果你知道的解決方案,或者如果u有另一個代碼,然後請幫我

+0

你把代碼標籤放在代碼周圍。它看起來現在加密了。 – dmajkic 2009-01-28 11:12:28

回答

1

你問如何輪詢遠程數據庫,或者如何出口前?

輪詢遠程數據庫和導入數據應該是作爲打開套接字到遠程分貝,執行查詢,並再次關閉一樣簡單。