Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    tanjooxiang
    @tanjooxiang

    Hello all,

    Anyone have any idea why the ignoreCase true is not working when your query have join?

    E.g

    select({
    from: "Customers",
    ignoreCase:true,
    where:{
    country: "mexico"
    },
    join: {
    with: 'Orders',
    on: 'Customers.customerId=Orders.customerId',
    type: 'left'
    }
    });

    Ujjwal Gupta
    @ujjwalguptaofficial

    @MerlinB yes possible, inside a web worker open jsstore without web worker and from outside use a web worker connection.

    But opening multiple connection everywhere might be confusing. So its better to create one connection anywhere and communicate with each other. Like send message to a web worker or vice versa..

    Ujjwal Gupta
    @ujjwalguptaofficial
    @tanjooxiang i see you have added an issue. I will fix it and let you know.
    Merlin
    @MerlinB

    Thanks. Another thing that came up: I was trying to create a query using a keyPath similar to this:

    db.select({
      where: {
        x: [a, b],
        or: {
          x: [b, a]
        }
      }
    })

    The or condition doesn't work as expected and seems to make (a, b OR a OR b) out of it.

    Ujjwal Gupta
    @ujjwalguptaofficial
    ok i see @MerlinB - please add an issue for it. I will work on fix asap.
    Merlin
    @MerlinB
    Will do
    Ujjwal Gupta
    @ujjwalguptaofficial
    @/all anyone who wants to create tutorial videos, you are very welcome to create it for jsstore. If content & everything are good - I will put it on jsstore official website. Thanks.
    Mohit Lohia
    @mlohia_twitter
    Hi Ujjwal, I'm trying to store blob object for pdf, txt, png, jpeg etc file formats. After calling insert api on table, i can see the record in database but the OBJECT column for blob is missing the value. Its empty. I have checked the format and everything, but the blob value is not getting stored. Can you help with this ?
    Merlin
    @MerlinB
    I am trying to construct a complex query and struggling with finding a solution. I would like to insert a second condition in the last part of the query so that the second part becomes equivalent to:
        [{
            "customerId": 88,
            "orderId": {
                "<": 10300
            },
           {
            or: {
                "orderId": {
                    ">": 10400
                }
            }
          }
        }]
    Ujjwal Gupta
    @ujjwalguptaofficial
    Hi @mlohia_twitter , can't stay what's happeing. If you can provide me a sample repo or point me to any link then i would be able to help.
    @MerlinB could you provide a sql equivalent query of your query ?and i will provide you jsstore equivalent query.
    Ujjwal Gupta
    @ujjwalguptaofficial
    @mlohia_twitter you can message me private if you want me to look at your app. Thanks.
    Merlin
    @MerlinB

    Sure, heres the SQL:

    SELECT * FROM Orders
    WHERE ((shipperId = 3 AND employeeId = 4)
    OR (shipperId = 2 AND employeeId = 3))
    AND ((orderId < 10300 AND customerId = 88) OR orderID > 10400);

    These should be 11 results as tested here

    Ujjwal Gupta
    @ujjwalguptaofficial

    @MerlinB is your requirements similar to the above query. If that then it can be solved by using intersection.

    so query will be something like this -

    var query1 = {
                from: 'Orders',
                where: [{
                    shipperId: 3,
                    employeeId: 4
                }, {
                    or: {
                        shipperId: 2,
                        employeeId: 3
                    }
                }]
            };
    
            var query2 = {
                from: 'Orders',
                where: [{
                    orderId: {
                        '<': 10300
                    },
                    customerId: 88
                },
                {
                    or: {
                        orderId: {
                            '>': 10400
                        }
                    }
                }
                ]
            };
    
            con.intersect([query1, query2])
    let me know if this can solve your problem, then i will implement intersect.

    But if you need more nesting of queries, then i will have to do some changes which will take more time.

    let me know

    Merlin
    @MerlinB
    Thank you, that would work as long as LIMIT and ORDER BY work alongside it.
    Merlin
    @MerlinB
    It seems that neither LIMIT or ORDER BY work alongside it. I will open an issue for that.
    Ujjwal Gupta
    @ujjwalguptaofficial
    ok
    Matthew Khaw
    @mattkhaw

    @ujjwalguptaofficial Hi, want to ask about this error => "{type: "indexeddb_not_supported", message: "Browser does not support IndexedDB"}". I'm getting this error on Cordova iOS WkWebView environment when I'm trying to use Worker for JsStore connection. It works fine on Android.

    Basically what I've did is retrieve the contents of jsstore.worker.js and create it as a blob to populate the Worker instance. Once I've done that, the JsStore.Connection is initialised by passing that particular instance. However, when I try to execute any commands that error pops up. If I don't use web workers, it works as intended. It is indeed a weird problem. Not sure whether you know what causes this issue.

    Ujjwal Gupta
    @ujjwalguptaofficial

    @mattkhaw creating worker using blob doesn't work on some browsers, so my guess is this might be causing issues.

    Ealier my approach was also to create worker using blob but due to cross browsing issue, i need to provide as seperate file.

    Matthew Khaw
    @mattkhaw

    @ujjwalguptaofficial I see. So, the best solution is to not use workers in this case? The only idea that I can come up with is to wrap the JsStore calls in a web worker. Then just interact with the web worker. That would work right?

    Also, what do you mean by separate file? You mean include the jsstore.worker.js file in the index?

    Do you have any examples that I can refer to? I mean your suggested approach. Thanks in advance.

    Ujjwal Gupta
    @ujjwalguptaofficial
    @mattkhaw why you are using worker using blob ?
    Can't you use like simple js file as an asset ?
    Ujjwal Gupta
    @ujjwalguptaofficial
    I am talking about this code -
    const getWorkerPath = () => {
    
        // return dev build when env is development
        if (process.env.NODE_ENV === 'development') {
    
            return require("file-loader?name=scripts/[name].[hash].js!jsstore/dist/jsstore.worker.js");
    
        }
        else { // return prod build when env is production
    
            return require("file-loader?name=scripts/[name].[hash].js!jsstore/dist/jsstore.worker.min.js");
    
        }
    };
    
    const workerPath = getWorkerPath();
    export const connection = new JsStore.Connection(new Worker(workerPath));
    Matthew Khaw
    @mattkhaw

    @ujjwalguptaofficial I've tried using the worker normally but I got SecurityError on iOS. The reason why that happens is because of the file:// URL from what I've read so far. A workaround for this is to open the local file and put the scripts into a blob and initialise the worker that way. I know there's another solution, which involves creating a local server but I don't wish to go that route since I don't want to overcomplicate it so much.

    Referring to the next post, I see. That only applies if I use webpack, which I'm not using at the moment. I haven't tried using Cordova with webpack yet. So far, I just copied JsStore to store within www folder and open the worker.js file manually.

    Matthew Khaw
    @mattkhaw
    @ujjwalguptaofficial just an update. I found out what is causing the problem. When I was creating the blob, I specified the type incorrectly. It should be "application/javascript" but I wrote it as "text/javascript". Now it is working fine. Thanks for your help.
    Ujjwal Gupta
    @ujjwalguptaofficial
    great @mattkhaw , always glad to help :).
    Matthew Khaw
    @mattkhaw

    @ujjwalguptaofficial actually, referring to my previous post, it's still not working. It only works when I initialize it without the worker, then i reinitialize it with a worker again but that's not the correct way.

    Anyways, thanks for your help. I guess I'll just wrap it in a web worker and call the web worker to execute the JsStore commands instead. That should do the trick right?

    Ujjwal Gupta
    @ujjwalguptaofficial
    should work @mattkhaw. Let me know your findings.
    Matthew Khaw
    @mattkhaw
    @ujjwalguptaofficial Sorry to bother you again, but I couldn't figure out what's wrong with the transaction API. I tried to use transaction but it just gives me an error stating, "start is not defined". I wonder what's missing.
    Matthew Khaw
    @mattkhaw
    @ujjwalguptaofficial never mind. I found out that I need to call it from the context itself.
    Robby
    @badgerblue
    Hello, I have a quick syntax question if anyone can help. I can't find the documentation.
    How do I "sortBy"? var results = await connection.select({ from: "Users", sortBy: "points", });
    Robby
    @badgerblue
    oops found it out. Thanks anyway
    Bernie Drahola
    @BernieDrahola_twitter
    Creating a new database with a bunch of tables goes like this: var database = {
    name: "database name",
    tables: [table1, table2, table3]
    } How can I add another table4 to it?
    Bernie Drahola
    @BernieDrahola_twitter
    I am getting this even though the table exists: {message: "Table 'LandkreisTable' does not exist", type: "table_not_exist"}
    message: "Table 'LandkreisTable' does not exist"
    type: "table_not_exist"
    This is with v2, not v3. Any ideas as to why the table shows as missing when trying to add records to it?
    Ujjwal Gupta
    @ujjwalguptaofficial
    @BernieDrahola_twitter v2 is deprecated, please update to v3. V2 problem can't be solved now.
    drstrangeglove
    @drstrangeglove
    Hi. I'm in the process of migrating a web app from webSQL to indexddb using jstore and sqlweb. I have found that if I have a number in a field/column name it doesn't work. So for example, one of the existing column names is 'image1', but this throws an error, whereas if I change it to 'imageone' then it is okay. Is it not possible to use a number in a field/column name?
    drstrangeglove
    @drstrangeglove
    Also it does not seem possible to have a number in a table name.
    Ujjwal Gupta
    @ujjwalguptaofficial
    @drstrangeglove there was issue with table name & column name in sqlweb. Its fixed now in latest version - 1.4.0.
    drstrangeglove
    @drstrangeglove
    Hi Ujjwal. Thanks for your quick reply. I have upgraded to 1.4.0 and it's all good now. Just to say thank you for your fantastic work. JsStore/SQLWeb has made the transition from WebSQL to IndexdDB much easier than it would otherwise have been.
    1 reply
    l388
    @l388
    I'm working with jsStore. Is there an example of backing up and restoring an indexed DB with jsStore,
    such as dumpToFile(dbName, ... ) and restoreFromFile (dbName, ... )
    7 replies
    ersaurabh101
    @ersaurabh101
    hello ujjwal how are you
    i am converting my project from ionic 3 to ionic 4
    Installing jsstore on ionic 4 is simple as explained in installation guide or is there anything special needed to be done ?
    1 reply
    Paolo-N
    @Paolo-N
    Hi everybody! Is there a way to set a boolean (as false) as default value in column?
    If I set a default true value everything is working fine, but is not working with default false value :(
    Paolo-N
    @Paolo-N
    Actually, whatever can be evalueted as false in javascript is not working as default value for a column
    1 reply