Copy sqlite data

Hi
i have app with cocos2d-x and sqlit
i create sqlite data base in desktop and entry data to it and now size of file is begger than 1m
i use this post to copy data from assest to writeable path bute in many time i can not run qury becuse data base not copy yet .is this why true for big data?i try to use thread but can not do it .
have any idea?
i write a some code too but it get error for delay of responsi function in main thread :frowning:

#if CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
    String* source=String::create(FileUtils::sharedFileUtils()->fullPathForFilename("Englingdb.s3db"));
    std::string dbPathCopy=FileUtils::sharedFileUtils()->getWritablePath()+"Englingdb.s3db";

    auto data =  FileUtils::getInstance()->getDataFromFile(source->_string);

    unsigned char* dataSize=data.getBytes();

    if (!UserDefault::getInstance()->getBoolForKey("FirstRun"))
    {
        CCLog("File Not Found");


     FILE* dest = fopen(dbPathCopy.c_str(), "wb");


        for(ssize_t i=0;i<data.getSize();i++){
            std::fwrite(dataSize+i,1,1, dest);
            //CCLOG("%i",i);

        }
     CC_SAFE_DELETE_ARRAY(dataSize);
     fclose(dest);
     UserDefault::getInstance()->setBoolForKey("FirstRun",true);
     CCLog("fresh");
     UserDefault::getInstance()->flush();
    }
    else{
      CCLog("File  Found");

    }


#endif