Cannot create a .db file in the assets folder

I am trying to create a quizz.db file in the current folder by creating first a temporary quizz.db in the folder data and then creating tables inside and then copy it in the current folder. By debugging code, it shows that the folder is created. But I can't find it in the current folder. Here is the code

#include 
#include 
#include 
#include 

using namespace bb::cascades;
using namespace bb::data;

SQLTest::SQLTest(bb::cascades::Application *app): QObject(app)
{
    const QString fileName = QString("quizz.db");
    QString dataFolder = QDir::homePath();
    QString newFileName = dataFolder + "/" + fileName;
    QTemporaryFile file(newFileName);

    // Open the file that was created
    if (file.open())
    {
        // Create an SqlDataAccess object
        SqlDataAccess sda(newFileName);

        // Create a table called Employee in the database file
        sda.execute("CREATE TABLE Employee( firstName VARCHAR(50),lastName VARCHAR(50), salary INT);");

        // Insert employee records into the table
        sda.execute("INSERT INTO Employee (firstName, lastName, salary) VALUES (\"Mike\", \"Chepesky\", 42000);");
        sda.execute("INSERT INTO Employee (firstName, lastName, salary) VALUES (\"Westlee\", \"Barichak\", 55000);");
        sda.execute("INSERT INTO Employee (firstName, lastName, salary) VALUES (\"Ian\", \"Dundas\", 47000);");
        if(sda.hasError())
        {

        }
        else
            copyFileToAssetsFolder("quizz.db");
    }
}
void SQLTest::copyFileToAssetsFolder(const QString fileName)
{
    QString appFolder(QDir::homePath());
    appFolder.chop(4);
    QString originalFileName = appFolder + "app/native/assets/" + fileName;
    QFile newFile(originalFileName);
// If I enable this `if` condition the code satisfies it and removes the quizz.db file and then it satisfies the next `if` condition and successfully copies the quizz.db file from `data` folder to `assets` folder.
    /*if(newFile.exists())
        QDir().remove(originalFileName);*/
    // this `if` condition is not satisfied. Which should mean the quizz.db file has been created on assets folder.
    if (!newFile.exists())
    {
        // If the file is not already in the assets folder, we copy it from the
        // data folder (read and write) to the assets folder (read only).

        QString dataFolder = QDir::homePath();
        QString newFileName = dataFolder + "/" + fileName;
        QFile originalFile(newFileName);

        if (originalFile.exists())
        {
            // Create sub folders if any creates the SQL folder for a file path like e.g. sql/quotesdb
            QFileInfo fileInfo(originalFileName);
            QDir().mkpath (fileInfo.dir().path());

            if(!originalFile.copy(originalFileName)) {
                qDebug() << "Failed to copy file to path: " << originalFileName;
            }
        } else {
            qDebug() << "Failed to copy file data base file does not exists.";
        }
    }

   // mSourceInDataFolder = newFileName;
}

If activate the commented "If" condition of "copyFileToAssetsFolder" int he removes already created quizz.db file in the current folder (that Im unable to find) and goes inside the next ' if' and copy the quizz.db created on the folder "data" of active fodler. But in any case I don't find the quizz.db in the current folder. I really need help with this quickly. Thank you.

Thanks to read this to learn why you can have an application change the assets folder: https://developer.blackberry.com/native/documentation/bb10/com.qnx.doc.native_sdk.devguide/com.qnx.d...

Tags: BlackBerry Developers

Similar Questions

  • Cannot create a PDF file after the upgrades: Adobe 9.2 and Mac OS 10.6.2

    After the upgrade to Adobe Professional 9.2 and Mac 10.6.2 I lost the ability to create PDF files.

    The printer Adobe (display says that the printer is v. 9.0) indicates the status of the job as "Mistake" and has the following message; "You must install the software to use this printer. To install the software, choose software update from the Apple menu. If the software for your printer is not available in software update, contact the manufacturer of your printer. »

    I get errors when I try to create a PDF from a Web page.

    I get the following error when I try to create a pdf from a word file: "Acrobat cannot open 'AAA.docx' because it is not a type of supported file or because the file has been damaged (for example, it was sent as an attachment to e-mail and has not been correctly decoded).

    To create an Adobe PDF document, go to the source application. Then print the document in Adobe PDF format".

    (I can create a PDF from jpg files... but I never really have a need to do this...)

    I uninstalled Adobe Professional by using the uninstall program (then emptied the trash and restart), then reinstalled Adobe Professional from disk (and restarted).  After the reinstallation, I always get the same problems, even if I get no error message until Adobe Professional updates from 9.0 to 9.2.  Before the upgrade Adobe, v9.0 attempts to print to pdf just act as the pdf is created (no error message), but I do not get a backup fast, nor is a new pdf no matter where the document is located.

    Help, please!

    With OSX.6.x, the possibility of using the Adobe PDF printer has been lost. See the ad at the top of this forum (known issues with Snow Leopard).

  • Cannot create a .db file in the folder data

    I use this code

    const QString fileName = QString("rules.db");
        QString dataFolder = QDir::homePath();
        QString newFileName = dataFolder + "/" + fileName;
        QFile file(newFileName);
    
        if(file.exists())
        {
            qDebug()<<"FILE EXISTs";
        }
    

    leader. Exists() returns false. I don't understand what I'm doing wrong :-(

    .the calling on QFile creates the file if it does not exist.

  • Cannot save settings: unable to create a configuration file for the required configuration object

    When I try to open the application in the administrator account it say - could not save the settings: unable to create a configuration file for the required configuration object

    Thanks for the reply.i think that a virus changed I scan my computer and discovered C:\users\jason\AppData\local\temp\low\temporary internet files\content. IE5\TLIFXGRH\ why is Task Manager disabled people [1]

  • How to create a PDF file from the Clipboard in Adobe Acrobat Reader ms?

    Is it possible to create a PDF file from the Clipboard in Adobe Acrobat Reader ms?

    No, Acrobat Reader cannot create PDF files.

  • I can see other computers on a network of peer to peer windows XP but cannot access their shared files and the shared printer.

    I can see other computers on a network of peer to peer windows XP but cannot access their shared files and the shared printer. The computers are connected by a switch, fixed IP addresses that are correctly configured and point to a DNS server outside the network. When I try to open the icon for one of the computers, he asked for credentials. I try to type the user name for the computer that is sharing the resource and the password. It is the user account whose computer is loged on and belongs to the Administrators group. for example: user name (Computer1\username) password (password). It does not work. The Windows Firewall is disabled on all computers. It worked well there 2 days. I can't find anything wrong with the network settings. Does anyone have a solution? Thank you.

    If the portion of the machine has activated - Simple file sharing (i.e. it is XP Home or it is XP Pro with Simple (default) file sharing) - while all file sharing connections authenticate as user 'guest '.  It will not matter what username / password you provide, it will attempt to authenticate as 'guest '.  If the guest user has received a password or the guest account is not active, you will experience the symptoms you describe.

    If the serving machine running XP Pro and Simple file sharing is disabled, then you should be able to connect by specifying the user as computer\user and the password to connect.  To turn off Simple file sharing:

    "How to disable the file sharing simple and how to set permissions on a shared folder in Windows XP"
      <>http://support.Microsoft.com/kb/307874 >

    Also:
    "Description of the account in Windows XP"
      <>http://support.Microsoft.com/kb/300489 >

    HTH,
    JW

  • Moving files: I am wanting to put the existing files to a new folder, how do I create a new folder and move those file to the new folder?

    I am wanting to put the existing files to a new folder, how do I create a new folder and move those file to the new folder?

    I am wanting to put the existing files to a new folder, how do I create a new folder and move those file to the new folder?

    Hello

    Go t the location where you want to create the new folder, right-click and select new/folder. Name the folder.

    Go to where the files, select the files and then use the right mouse button to drag the files into the new folder. When you drop the file, a pop-up menu, select the Move option.

    Let us know if you have any other questions.

    Thank you for using Windows 7

    Ronnie Vernon MVP
  • "Sorry, Move Maker cannot open this project file. The file is not compatible with Windows Live Movie Maker or damaged. Please select a different project file. »

    Hello!
    I installed Win Live Movie Maker, but when I tried to open my .mswmm file I only got this message: "sorry, Move Maker cannot open this project file. The file is not compatible with Windows Live Movie Maker or damaged. Please select a different project file. "The file will open correctly in Windows Live Movie Maker 7, so everything should be OK. What I am doing wrong?

    Hello

    This is supported in Windows Live movie maker file type.

    http://help.live.com/help.aspx?project=wl_movie_makerv1&market=en-IE&querytype=topic&query=wl_movie_maker_ref_supportedfiles.htm

    For any request or problems related to Windows Live Movie maker, please post to the Windows Live Help forum.

    Here is the link: http://www.windowslivehelp.com/product.aspx?productid=5

    Diana

    Microsoft Answers Support Engineer

    Visit our Microsoft answers feedback Forum and let us know what you think.

    If this post can help solve your problem, please click the 'Mark as answer' or 'Useful' at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • Cannot open a pdf file from the website of immigration canada. Gets a message - you need a later version of the same player after update still not working

    Cannot open a pdf file from the website of immigration canada. Gets a message - you need a later version of the same player after update still not working

    10 Windows Internet Explorer with the Acrobat Reader plugin is available.

  • The initial launch of DW CC 2014, get following error: "cannot locate the resource file in the Configuration folder. This file is Spectialized to run Dreamweaver. Please reinstall the application. "This app has been updated through CC.

    I have to first remove the DW? With the help of PC Win 7.

    The error message: "Unable to locate the resource file in the Configuration folder", so it seems that something is missing. Could be a permission problem... I would suggest:

    1. go to a user admin account

    Connect using built in Administrator | Create the local admin account. 7, 8, Windows Vista

    Install or run Adobe applications in the new user account. Mac OS X

    2 remove the application DW CC 2014 by uninstalling or using the cleantool.

    https://helpx.Adobe.com/creative-cloud/help/install-apps.html#uninstall apps

    Use the CC cleaning tool to resolve installation problems. CC, CS3 - CS6

    3. manually delete the directories of config according to KB: (you need to of course search the CC 2014 folder instead of the older versions in the KB)

    Restore preferences | Dreamweaver CS4, CS5, CS5.5, CS6

    This step will ensure that also the configuration file will be regenerated on re installation!

    4 reinstall on the new admin account and test again. If works please go back to the old account and test again.

    Good luck!

  • Another: failed: cannot create a snapshot VSS of the source volumes. Error 2147549183 but on XP Pro

    I am changing a laptop Windows XP Pro using the converter software 4.0.1.

    He will start the conversion process, but after 10 seconds or so, I get the error: failed: cannot create a snapshot VSS of the source volumes. Error 2147549183

    The strange thing is my images of box Vista successfully without problem.

    I'm in a corporate environment. I moved the laptop test I try the image of an OU restrictive and placed in a non-restrictive ORGANIZATIONAL unit (without firewalls and others). I always have the same question.

    I made sure all the VSS services and these are running and active. I even tried MS KB Article 941956 comes to do even if it said it was only for Server 2003.

    Any other pointers on this? It seems that a lot of people get this error, but the only ones I can find are for server operating systems... not XP.

    In the event under application Viewer I have errors of:

    Type: error

    Event ID: 12292

    The volume shadow copy Service error. Error creating the Shadow Copy Provider COM with CLSID {65ee1dba-8ffa-4a58-ac1c-3470ee2f376a} class

    Type: WARNING

    Event ID: 4356

    {The COM system + impossible to create an instance of the Subscriber partition:{41e90f3e-56c1-4633-81c3-6e8bac8bdd70}!new:{d3938ab0-5b9d-11d1-8dd2-00aa004abd5e}. CoGetObject returned HRESULT 80070005

    Type: WARNING

    Event ID: 4353

    The event of COM + a system attempted to raise the EventObjectChange::ChangedSubscription event but received a bad return code. HRESULT was80040201

    Type: error

    Event ID: 8193

    Volume Shadow Copy Service Error: Unexpected error calling routine CoCreateInstance. HR = 0 x 80004002

    You are able to start these three services; EventSystem, swprv, vss?

    What is this command returns; "vssadmin list writers"?

    Joakim

  • Is it possible to create a new file using the XML via java Script?

    Hello everyone,

    Is it possible to create a new file using the XML via java Script

    • I have xml information that need to use for file name, size.
    • Based on xml file we can create a new file in InDesign with java script?
    • Kindly help me if anyone has an idea about this.

    I use InDesign CS4 on windows 7

    Sample file is attached below.

    Kind regards

    Siva

    <UpdateAd>
    <AdId>3403699</AdId>
    <Width type="mm">91,79</Width>
    <Height type="mm">80,00</Height>
    <ProductionCategory>4</ProductionCategory>
    <BookedCCIColors>sw</BookedCCIColors>
    <WorkFlowType>PDF</WorkFlowType>
    <CustomerNumber>652224</CustomerNumber>
    <CustName1>Erich Prang</CustName1>
    <Description/>
    <Description2>R</Description2>
    <UpdateIns>
    <Titel>RHZ</Titel>
    <Publication>B2</Publication>
    <RunDate>26-07-2011</RunDate>
    <Zone>H30</Zone>
    <KDDATEN>nein</KDDATEN>
    </UpdateIns>
    <WorkflowStep>IR</WorkflowStep>
    <Proof>No</Proof>
    </UpdateAd>
    
    

    xml.png

    Try this:

    var f =File.openDialog ();
    f.open('r');
    var xml = new XML(f.read());
    f.close();
    
    var myDocument = app.documents.add();
    myDocument.documentPreferences.pageHeight = xml..Height+"mm";
    myDocument.documentPreferences.pageWidth = xml..Width+"mm";
    var rect = myDocument.pages[0].rectangles,add();
    rect.geometricBounds = myDocument.pages[0].bounds;
    rect.strokeAlignment = StrokeAlignment.INSIDE_ALIGNMENT;
    rect.strokeColor = myDocument.swatches.item("Black");
    rect.strokeWeight = 1;
    myDocument.save(File(f.path + "/" + xml..AdId + ".indd"))
    

    Substances

  • create a txt file in the client machine

    Hi all

    I have


    Oracle9i Enterprise Edition Release 9.2.0.6.0 - Production
    PL/SQL Release 9.2.0.6.0 - Production
    CORE 9.2.0.6.0 Production
    AMT for Linux: release 9.2.0.6.0 - Production
    NLSRTL Version 9.2.0.6.0 - Production


    I want to create a file in my pc with utl_file for example

    {

    CREATE OR REPLACE PROCEDURE HELLOFLE IS
    v_MyFileHandle UTL_FILE. TYPE_DE_FICHIER;
    BEGIN
    v_MyFileHandle: = UTL_FILE. FOPEN ("C:------',' myfile.") TXT', 'w');
    UTL_FILE. Put_line (v_MyFileHandle, "something must printed");

    UTL_FILE. FCLOSE (v_MyFileHandle);
    EXCEPTION
    WHILE OTHERS THEN
    DBMS_OUTPUT. PUT_LINE ('ERROR' |) TO_CHAR (SQLCODE) | SQLERRM);
    NULL;
    END;


    }

    could you please help me, I'm new.


    Thank you

    Hitesh

    Your code looks OK and also fine requirement. You can create a text file on your PC, if you are working on the server or client.
    It works fine without any problems abs. The only thing to be supported is the path of directory and file mode.

    1 directory path - it must be created on the Oracle server, pointing to the location of the target file you. If target is the customer, you must use the name of the computer and the relative path to create the directory as below. If your machine name is CLIENT001 and the target location is C:\Test, then your directory must be on the server (as sysdba)

    conn uname/pass as sysdba
    create directory mydir as '\\CLIENT001\TEST\'
    

    Because file access operations are supported by the server, so the server must have read/write access on the directory path. In the direct words, target your path on the cleint must be shared for access to the R/W server.
    Also grant read, write on directory access to the user who executes the procedure UTL_FILE.

    2. If you want to create a new file on the location of the target file, it must be open in write mode (w) only. You have already done, which is correct.

    That thing you can change is the directory in your code and move forward. It should work properly

    CREATE OR REPLACE PROCEDURE HELLOFLE IS
    v_MyFileHandle UTL_FILE.FILE_TYPE;
    BEGIN
    v_MyFileHandle := UTL_FILE.FOPEN('C:\','myfile.TXT','w');
    UTL_FILE.PUT_LINE(v_MyFileHandle,'some thing should printed ');
    
    UTL_FILE.FCLOSE(v_MyFileHandle);
    EXCEPTION
    WHEN OTHERS THEN
    DBMS_OUTPUT.PUT_LINE('ERROR ' || TO_CHAR(SQLCODE) || SQLERRM);
    NULL;
    END; 
    
  • CANNOT write to files in the shared folder of XP on a PC running windows 7 - but good vice versa

    I have a laptop under Windows 7 (SP1) and a desktop running XP (SP3).  I have connected both via a wireless network. While I can see and access shared files/folders from one computer to the other computer, I can only read/write files in the shared folder on the portable computer that is running Windows 7.

    If I try and change a file in the shared folder from the PC under XP on my laptop, I get the message "this file is set to read-only. Try again with a different name "."  I know that the file is NOT checked for read-only. When I change the name of the file I get the error message "\\Desktop\SharedDocs\filename.doc you are not allowed to save in this location. Contact the administrator for approval.  You want to save in the folder my documents instead? "If I save the file to another location on the laptop under Win7 it save then OK.  I can not just save a modified version of the file in the same shared folder from desktop running XP.
    It seems that it must be something to do with permissions and access to the parameters of the desktop running XP but I can not find these. Fairly easy to find in Windows 7.
    Finally, I don't have a login/password set for the connection to the computer to Office XP.  I don't have a user name and password for the laptop Win7 but you have turned off password protected sharing.
    Anyone have a solution to this?
    Thank you

    OK - the problem is now resolved.

    I noticed that the read-only for the shared folder has been checked. When I unchecked it and also checked the box "allow network users to change my files" in the shared folder properties/sharing, I was able to modify and save files in the shared folder on my laptop.
    It's a little weird because I thought I had done this the other day where the results have been less successful.  Strange.
    Thanks for your help.

  • Windows search fails to find the files in the Documents folder

    Original title: Windows 7 search finds no files, even though all the settings have been verified and the search index has been rebuilt

    I recently bought a new Dell laptop Studio 1558 with Windows 7 Home Premium and moved through several hundred documents from my old PC to the new folder 'My Documents'.

    As many others have found, Windows Search has been completely useless. She seems to have no problem finding files in the music folder or image, but anything in the document library is invisible to the it - even if I get in a subfolder small for a file name I see just in front of me, Windows Search will announce that "no element not corresponding to your search.

    I took a number of steps so far to fix the problem, which none have worked:

    1. I checked which locations are indexed for search and ensured that the document library is among them (as well as all of my C drive).

    2. I checked that appropriate file extensions (.doc .docx .pdf, etc.) are all selected from the "File Types" list in indexing options (although I noticed that 'Description of filter' for .pdf bed "Registered IFilert is not found" - not this problem with Word documents).

    3. I have deleted and rebuilt the search index.

    4. I ran the troubleshooting Windows 7 Search tool, which reports that it cannot find any problems.

    5. I have read that some problems with Windows 7 search can be solved by changing a registry key (http://www.intowindows.com/how-to-fix-windows-7-search-problems/) but when I navigate to the folder in my registry, only following three keys are here (not the one mentioned in the difficulty):

    • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\ {0B2BAAEB-0042-4DCA-AA4D-3EE8648D03E5}
    • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\ {36011842-DCCC-40FE-AA3D-6177EA401788}
    • HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes\ {59BD6DD1-5CEC-4D7E-9AD2-ECC64154418D}

    A couple of things, I said - if I create a new word document and save it, Windows Search seems to immediately get back on it and is able to find. I also noticed that at first when I opened one of the word documents that have been transferred over the old PC and then closed it again, Windows Search picked up on it and could find it. So I went to try to open and close then all of my documents (an arduous task...), but the subject to halfway through Windows Search has ceased to be able to find them.

    All Word documents using Microsoft Word 2007 in .doc or .docx format, although the problem also applies to Excel, PDF and image files, so I don't think that the problem is with the word itself.

    I have tried everything I can think so far, including all the solutions, I could see suggested in previous discussions. I really need the search function working to effectively use my laptop so that any help would be welcome!

    Thank you, Jack

    Santosh thanks, I checked the permissions for the appropriate files and SYSTEM was present, which doesn't seem to be the problem. However, I found a solution that might work for other people are having the same problem.

    I noticed that if I changed the location of the files, Windows search suddenly seems to become aware that they existed and then indexed and followed them correctly - even if they were subsequently moved back to the original location. I just created a temporary folder outside my library of documents and then each subfolder in the folder my documents him and then come back, one by one. It was a bit laborious but the problem solved - I know not why it worked, but all the old files are now indexed and appear correctly when you use Windows Search, and it seems not to have any problems, follow-up of the newly created files.

    Cheers, Jack

Maybe you are looking for

  • officetimeline

    I switched from PC to Mac at work, but find the desktop calendar does not work. Is there something comparable?

  • update framework

    When I try to update framework for versions NET 2.0 - 3.5, it is never successful is a priority with microsoft and never download KB951847x86 why?

  • Hard drive crashed and now 'My Documents' reports 'access denied '.

    My drived by 'C' crashed. I replaced the trive and install a new copy of XP pro on a new drive. I plugged the old drive as slave and when I go to the 'Documents and Settings' area I am able to open most of all files except thoes in "Documents and Set

  • HADR drive boot failure

    After a power fluctuation my hard drive won't startI can boot from a floppy disk and Windows works fine on the hard drive after booting from a floppy how to repair the hard drive to start itself with windows XP second edition.marty at will

  • I can't burn my DVDs, why?

    Hello!I created a film editing photos with windows movie maker, and when I want the most serious on a dvd with windows DVD Creation, engraving is interrupted always in the same place, about 4% of the engraving, and a message appears: "error specified