by

Where communities thrive


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

    @agroXXI_news_twitter unlike mysql server - indexeddb is client side database, so it has some limitation.

    but for your case, you can use regex or like query.

    AgroXXI
    @agroXXI_news_twitter
    Thank you, I know about the features of the local database, but I thought that it would be possible to somehow simulate the calculation of the weight of keywords to compile relevant results.
    Kampenuss
    @Kampenuss_twitter
    I hope everyone is safe in this unusual time! Today our project got a setback because we realized that NativeScript (https://www.nativescript.org/) does not support IndexedDB. We use Angular to build the webapp and we extensively use IndexedDB. Our plan was to use NativeScript to build native Android and iOS app, and use electron.js to build native Windows and MacOS app. This link (https://medium.com/jsstore/indexeddb-operation-in-electron-app-part-1-a001f7551d70) says that JsStore would work for electron.js, but I was not able to find if this library would work also with NativeScript. Could you please share your thoughts of what are the possibilities? Ideally we would use something that works for building on all platforms using the same codebase.
    Ujjwal Gupta
    @ujjwalguptaofficial
    @Kampenuss_twitter as per my understanind - nativescript runs your javascript code but not inside a webview, so services like localStorge, cookies, indexeddb is not supported.
    Kampenuss
    @Kampenuss_twitter
    @ujjwalguptaofficial Correct, and we found "nativescript-webview-interface" (https://www.npmjs.com/package/nativescript-webview-interface) which is able to pass data back and forward between webview and mobile device storage. But this lib does not work with electron.js. It sounds like JsStore does the same thing but only on MacOS and Win OS, so my question is if it works also for mobile devices, or it is only for computers?
    Ujjwal Gupta
    @ujjwalguptaofficial

    Its work on all devices @Kampenuss_twitter. But not sure how this will work in webview of nativescript.

    We have integration of saucelabs for different devices and browser, you can take a look at official github page. It also works on most of popular browsers in mobile devices. You can also verify it by loading idbstudio in any browser. Here is idbstudio link - https://ujjwalguptaofficial.github.io/idbstudio/

    Kampenuss
    @Kampenuss_twitter
    Thank you @ujjwalguptaofficial
    AgroXXI
    @agroXXI_news_twitter

    Hi! JsStore - vesion 3.7.6 - The query does not display anything: SELECT * FROM table WHERE Column1 = keytext1 AND (Column2 LIKE '%keytext2%' OR Column3 LIKE '%keytext2%' OR Column4 LIKE '%keytext2%') on a real base.

    var results = connection.select({
    from: "table",
    limit: 10,
    where:
    [{
    Column1: keytext1
    },
    {
    Column2: {like: '%keytext2%'},
    or: {
    Column3: {like: '%keytext2%'},
    Column4: {like: '%keytext2%'}
    }
    }
    ]
    });

    In IDBStudio example everything works right!

    Ujjwal Gupta
    @ujjwalguptaofficial
    @agroXXI_news_twitter can't say what's wrong in there - might be datas or some implementation issue. If you can provide me a repo then i can help.
    AgroXXI
    @agroXXI_news_twitter
    My app https://www.agroxxi.ru/goshandbook/pro This is Russian language project. So far Public Access. Database - «AgroxxiDB», table - «pest». The frame does not work where: [ {}, {} ] If where: [ {} ] or where: {} - then is work! Inside {} everything works separately
    AgroXXI
    @agroXXI_news_twitter
    In console.log - array input data and results query. Var.1: right filters = [{}] - is work, var.2: filters + search form = [{}, {}] - is not work!
    Ujjwal Gupta
    @ujjwalguptaofficial
    sorry for late reply @agroXXI_news_twitter , have you tried installing idbstudio for your application and then visualizing data ?
    I opened your app - its not loading any data and showing "The database is loading" .
    AgroXXI
    @agroXXI_news_twitter
    Hi! My base loading 7-10 minutes. When it boots up, the message will disappear.
    Ujjwal Gupta
    @ujjwalguptaofficial
    @agroXXI_news_twitter i have messaged you in private chat. Let's take it from there.
    Merlin
    @MerlinB
    Hey there! Is it at all possible to set up a Jsstore connection from within a web worker?
    Merlin
    @MerlinB
    My situation is that I have multiple web workers and normal application code from which I would like to access the same database.
    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.