Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary tables returning error #126

Closed
neofuture opened this issue Feb 11, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@neofuture
Copy link

commented Feb 11, 2019

Describe the bug
When using a temporary JSON/table error is returned unable to select table

Example

<html>
<head>
    <script src="https://cdn.jsdelivr.net/npm/@nano-sql/core@2.1.8/dist/nano-sql.min.js"></script>

</head>
<body>

<script>
    window.onload = function(){
        let data = [
            {
                "EQBVID": 1,
                "ActID": 1,
                "ActDesc": "Reminder",
                "ActCol": 255,
                "ActOnDiary": true,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": true,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 2,
                "ActID": 2,
                "ActDesc": "Appointment",
                "ActCol": 65280,
                "ActOnDiary": true,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 3,
                "ActID": 3,
                "ActDesc": "Survey",
                "ActCol": 16711935,
                "ActOnDiary": true,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": false
            },
            {
                "EQBVID": 4,
                "ActID": 4,
                "ActDesc": "Fitting",
                "ActCol": 8454143,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 5,
                "ActID": 5,
                "ActDesc": "Remedial",
                "ActCol": 65535,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 11,
                "ActID": 101,
                "ActDesc": "Booked Hoilday",
                "ActCol": 16744576,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": false,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": true,
                "ActOnApp": true
            },
            {
                "EQBVID": 12,
                "ActID": 102,
                "ActDesc": "Booked Off",
                "ActCol": 16744703,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": false,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": true,
                "ActOnApp": true
            },
            {
                "EQBVID": 13,
                "ActID": 103,
                "ActDesc": "Booked Meeting",
                "ActCol": 16744703,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": false,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": true,
                "ActOnApp": true
            },
            {
                "EQBVID": 14,
                "ActID": 104,
                "ActDesc": "Appointment Blowout",
                "ActCol": 33023,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": false
            },
            {
                "EQBVID": 15,
                "ActID": 105,
                "ActDesc": "PRA Blowout",
                "ActCol": 8421631,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": false
            },
            {
                "EQBVID": 16,
                "ActID": 106,
                "ActDesc": "Appointment Reappoint",
                "ActCol": 0,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": false
            },
            {
                "EQBVID": 17,
                "ActID": 107,
                "ActDesc": "Booked Training",
                "ActCol": 12632256,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": false,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": true,
                "ActOnApp": true
            },
            {
                "EQBVID": 18,
                "ActID": 108,
                "ActDesc": "Email",
                "ActCol": 16777088,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": false
            },
            {
                "EQBVID": 19,
                "ActID": 109,
                "ActDesc": "Delivery Van",
                "ActCol": 0,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": true,
                "ActAllResults": true,
                "ActOnApp": true
            },
            {
                "EQBVID": 20,
                "ActID": 110,
                "ActDesc": "90% Invoice Sign Off",
                "ActCol": 0,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": true,
                "ActOnApp": false
            },
            {
                "EQBVID": 21,
                "ActID": 111,
                "ActDesc": "20 % Invoice Sign Off",
                "ActCol": 0,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": false
            },
            {
                "EQBVID": 22,
                "ActID": 113,
                "ActDesc": "Cash Sale",
                "ActCol": 65535,
                "ActOnDiary": true,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": false
            },
            {
                "EQBVID": 23,
                "ActID": 117,
                "ActDesc": "Inspection",
                "ActCol": 65535,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 26,
                "ActID": 118,
                "ActDesc": "Update",
                "ActCol": 4194368,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": false
            },
            {
                "EQBVID": 27,
                "ActID": 119,
                "ActDesc": "Incomplete Fit",
                "ActCol": 255,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 28,
                "ActID": 121,
                "ActDesc": "Contract Check",
                "ActCol": 0,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": true,
                "ActAllResults": true,
                "ActOnApp": false
            },
            {
                "EQBVID": 29,
                "ActID": 122,
                "ActDesc": "Survey Check",
                "ActCol": 0,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": true,
                "ActAllResults": true,
                "ActOnApp": false
            },
            {
                "EQBVID": 30,
                "ActID": 123,
                "ActDesc": "Customer Service Visit",
                "ActCol": 8388863,
                "ActOnDiary": true,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 35,
                "ActID": 124,
                "ActDesc": "Tiling",
                "ActCol": 0,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 31,
                "ActID": 125,
                "ActDesc": "Building Work",
                "ActCol": 0,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 32,
                "ActID": 126,
                "ActDesc": "Carpentry Work",
                "ActCol": 0,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 34,
                "ActID": 127,
                "ActDesc": "Plumbing Work",
                "ActCol": 0,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 33,
                "ActID": 128,
                "ActDesc": "Electrical Work",
                "ActCol": 0,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 37,
                "ActID": 129,
                "ActDesc": "Hard worktop",
                "ActCol": 0,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 36,
                "ActID": 130,
                "ActDesc": "Flooring",
                "ActCol": 0,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 38,
                "ActID": 131,
                "ActDesc": "IM Visit",
                "ActCol": 0,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 40,
                "ActID": 135,
                "ActDesc": "Showroom Remedial",
                "ActCol": 12615935,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": false,
                "ActAllResults": true,
                "ActOnApp": true
            },
            {
                "EQBVID": 41,
                "ActID": 136,
                "ActDesc": "Trailer Set-up / Breakdown",
                "ActCol": 12615935,
                "ActOnDiary": true,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": true,
                "ActAllResults": true,
                "ActOnApp": true
            },
            {
                "EQBVID": 42,
                "ActID": 139,
                "ActDesc": "Order",
                "ActCol": 0,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": false
            },
            {
                "EQBVID": 44,
                "ActID": 142,
                "ActDesc": "*Product Change*",
                "ActCol": 16777215,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": false,
                "ActAllUsers": true,
                "ActAllReasons": true,
                "ActAllResults": true,
                "ActOnApp": false
            },
            {
                "EQBVID": 6,
                "ActID": 10000,
                "ActDesc": "Customer Delivery",
                "ActCol": 16777088,
                "ActOnDiary": false,
                "ActOnResourcePlanner": true,
                "ActOnSchedule": true,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": true
            },
            {
                "EQBVID": 7,
                "ActID": 10001,
                "ActDesc": "Confirm Appointment",
                "ActCol": 16777088,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": false
            },
            {
                "EQBVID": 8,
                "ActID": 10002,
                "ActDesc": "Call",
                "ActCol": 16777088,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": false
            },
            {
                "EQBVID": 9,
                "ActID": 10003,
                "ActDesc": "Letter",
                "ActCol": 16777088,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": false
            },
            {
                "EQBVID": 10,
                "ActID": 10004,
                "ActDesc": "Production",
                "ActCol": 16777215,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": true,
                "ActAllResults": true,
                "ActOnApp": false
            },
            {
                "EQBVID": 24,
                "ActID": 50000,
                "ActDesc": "Email Out",
                "ActCol": 16777088,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": true,
                "ActAllResults": true,
                "ActOnApp": false
            },
            {
                "EQBVID": 25,
                "ActID": 50001,
                "ActDesc": "Text (SMS)",
                "ActCol": 16777088,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": true,
                "ActAllReasons": true,
                "ActAllResults": true,
                "ActOnApp": false
            },
            {
                "EQBVID": 39,
                "ActID": 50002,
                "ActDesc": "Design@Web Invite",
                "ActCol": 16777088,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": false
            },
            {
                "EQBVID": 43,
                "ActID": 50003,
                "ActDesc": "Email In",
                "ActCol": 16777088,
                "ActOnDiary": false,
                "ActOnResourcePlanner": false,
                "ActOnSchedule": false,
                "ActOnHistory": true,
                "ActAllUsers": false,
                "ActAllReasons": false,
                "ActAllResults": false,
                "ActOnApp": false
            }
        ];

        nSQL().query("select").from(data).where(["ActDesc", "LIKE", "%Invoice%"]).exec().then((rows) => {
            console.log(rows);
        });
    }
</script>
</body>
</html>

Expected behavior
Records with the word Invoice would be matched and returned

Actual Behaviour

Unhandled Promise Rejection: Can't get selected table!
@ClickSimply

This comment has been minimized.

Copy link
Owner

commented Feb 13, 2019

.from wasn't initially intended to be used with temporary tables, but this has been taken care of.

Should be good in 2.1.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.