简体   繁体   中英

JayData provider failing to load for sqLite and indexedDb

I'm trying to use JayData using the sqLite provider via

myDB = new MyDatabase({ provider: 'sqLite' , databaseName: 'MyDB', version: 1 });

But when It runs this line it echos to console the following message twice

"Provider fallback failed!"

I have tried manually loading the sqLite provider and not loading it but it did not fix the issue. If I swap the provider setting to 'indexedDb' the JayData js is automatically trying to load the IndexedDbProvider.js class from the wrong directory

GET http://192.168.2.49/Test/jaydataproviders/IndexedDbProvider.js

when it should be

GET http://192.168.2.49/Test/js/Jaydata/jaydataproviders/IndexedDbProvider.js

Does anyone know either why I am getting the error using sqLite or how to get the provider to auto load from the correct directory? I have also tried loading the indexedDB provider manually but it does not fix the issue and it still tries to load the provider incorrectly

I have copied the latest JayData code straight into the SiteRoot/js folder under Jaydata it should be self consistent within that folder I haven't changed or moved any files

My database schema is large but essentially similar to the following entity and database definition

    $data.Entity.extend("Image", {
        id: { type: "int", key: true, computed: true },
        location: { type: String, required: true, maxLength: 500 },
        classification: { type: "int", required: true },
        name: { type: String, maxLength: 500 }
    });
$data.Entity.extend("Inventory", {
    id: { type: "int", key: true, computed: true },
    name: { type: String, required: true, maxLength: 200 },
    description: { type: String, required: true, maxLength: 1000 },
    imageId: { type: "int", required: true}
});    
    $data.EntityContext.extend("MyDatabase", {
        Images: { type: $data.EntitySet, elementType: Image } ,
        Inventories: {type: $data.EntitySet, elementType: Inventory }
    });

I have some js code from here that specifically loads the correct js files in sequence using getScript and debugging in firefox confirms the files are loading in order

I am loading the files in the following sequence

  1. Jquery 2.1.3
  2. /js/Jaydata/jaydata.js (The default Jaydata.js file unmodified)
  3. /js/DB/DBSchema.js (My schema defining the database objects)
  4. /js/DB/DBUtilities.js (Some functions to help working with the database)
  5. /js/main.js

Step 5 on page ready $(function() assigns the database variable and onReady checks if the database is initialized

myDB = new MyDatabase({ provider: 'indexedDb' , databaseName:'MyDB', version: 1 });

        myDB.onReady(function() {
                logThis('Connected to DB');
                checkIfInitilizeIsNeeded();
        });

This is where the provider fails to load

Thanks for any help

According to this page JayData doesnt support firefox using webSql or sqLite though it should have worked with indexeddb

I've tested it using chrome and it seems to be happy so yea little dodgy 2nd most popular browser on the planet but nm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM