After go through the database-related posts in cocos2dx’s forum.
Most of posts suggest us to use CCUserDefault to store persistent data.
I thinks that it is a great approach to store small size of data, such as highest score, user’s name…etc.
However, I am going to store about 1000 maps configuration, and read this configuration file back in program when user changes his map every time.
Without SQL, I don’t know how to do it well, and I think it will be slow if I parse a xml configuration by CCUserDefault for 1000 maps every time.
So, does anyone figure out how to link a sqlite library?
There is a related post : http://www.cocos2d-x.org/boards/10/topics/1959
(Actually, I don’t know where to start to something mentioned in this post……)
Or, please let me know how you guys manipulate large size of persistent data in cocos2dx
Then, I tried to add lsqlite3 in “LOCAL_LDLIBS” afterlcocos2d….to include this library to my cocos2dx project
But, when I run build_native.sh, it shows that they can’t find the library :
/home/eddyxd/Android/ndk-r5/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/…/lib/gcc/arm-linux-androideabi/4.4.3/…/…/…/…/arm-linux-androideabi/bin/ld: cannot find -lsqlite3
I am sorry that is my first time to deal with a opensource project, can anyone give me some suggestion to add a library to the project?
I think that it is should be work because cocos2dx do the similar things in the Android.mk file…
The article doesn’t say the file is not packed into .apk, it just say that, the file is not compressed, but still packed into
.apk file if you change file extension to .mp3 or others.
Does anyone have any working code to do this? I’m trying to copy an existing database as in Ivan Lo’s example but I’m running into all sorts of problems! When I read in the database in for copying using CCFileUtils::sharedFileUtils()>getFileData I only get the first bytes of the file not the whole file.
The other thing I’m trying is to just try and open the file in read only mode, I can open it on iOS but not on Android. This is the code I’m using . All I get is the Opening Wrong error.
<pre>
sqlite3 pDB = NULL;
char errMsg = NULL;
//string sqlstr;
int result;
CCFileUtils* fileUtils = CCFileUtils::sharedFileUtils;
unsigned long size = 0;
const char* fileName = “pronouns.mp3”;
string path = fileUtils>fullPathForFilename(fileName);
CCLog(“s", path.c_str());
result = sqlite3\_open(path.c\_str(),&pDB);
if (result != SQLITE\_OK)
CCLog("OPENING WRONG, d, MSG:%s”,result,errMsg);