Alasql: Salesforce Locker Service

Created on 13 Jun 2018  Β·  22Comments  Β·  Source: agershun/alasql

Hello Team,

We are using your solution with great pleasure within Salesforce (and Sharepoint) scripting. Till the latest version release of Salesforce everything was working fine but since a week (summer 18 release) we get an error. (Actually no error but it just stops working)

Now Salesforce has introduced the Locker Service which seems to cause the issue:
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/security_code.htm

When we set the working version back to "before" Locker Service everything works as expected.

Question: Do you recognize what is causing the issue code wise and can you fix this?

Kind regards,
Mario

! Bug Code not provided to reproduce Code quality

All 22 comments

Hi Mario

Thanks for reaching out. I feel convinced that the demand for use strict is the main reason it's not running anymore.

We should look into this. Im a bit worried about the autogenerated code for the JISON parser but hopefully it turns out ok.

If we manage to get this going, would you be interested in writing an article describing how/why you use AlaSQL in your salesforce setup?

Hello Mathias,

Thanks. And of course.

Kind regards,
Mario

Are you using SQL triggers?

(Have managed to implement use strict but having a nasty bug related to triggers. If you dont use them we can make a special version for you to test if it solves the issue.)

Hello Mathias,

No. I don’t use them. ( I wasn’t aware we have them πŸ˜‰)

Kind regards,
Mario

The latest release 0.4.6 is now in strict mode (and all bugs identified by the regression test are fixed)

Would it be possible for you to check if the last version of AlaSQL is working in your salesforce setup?

Hmmmm.

Any chance you can share the SQL running for me to get some leads?

Hello Matthias,

Give me a few days and I will set something up.

Kind regards,
Mario

Sent from my iPhone

On 17 Jun 2018, at 13:47, Mathias Rangel Wulff <[email protected]notifications@github.com> wrote:

Hmmmm.

Any chance you can share the SQL running for me to get some leads?

β€”
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/agershun/alasql/issues/1017#issuecomment-397873397, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AlK5Xm_kBcMSm89raNAVzGju_UZr-tQWks5t9kHegaJpZM4UmXWb.

Hello Mathias,

I have setup a Salesforce Dev Org:
Url: https://alasql-dev-ed.lightning.force.com
Login: [email protected]alasql@kyoo.studio
PW: L%j1LS5X

The Salesforce page where we call the alasql function: https://alasql-dev-ed.lightning.force.com/lightning/n/ALASQL
You get a popup with the error message.

The alasql and jquery are included in a resource zip which we call on the above page.
You can upload an updated zip here: https://alasql-dev-ed.lightning.force.com/lightning/setup/StaticResources/home
After this just refresh the above page and you can see the updated error message.

If you have any questions please let me know. OK?

Hope you can resolve.

Kind regards,
Mario

Cool. Ill have a look at it in the weekend.

You're trying to Log In to Salesforce. To make sure your Salesforce account is secure, we have to verify your identity.
Enter the verification code we emailed to ma*@oo.studio.
Verification Code

Can you help me login? You might want to change the email to [email protected] so I can do the verification thing myself?

Hello Mathias,

I have changed the email address to [email protected]m@rawu.dk

Kind regards,
Mario

Perfect. I will look into this in the weekend.

With the latest changes no error is displayed - but I see no output on the https://alasql-dev-ed.lightning.force.com/lightning/n/ALASQL page.

Is it meant to provide any output after alasqlResult =?

Hello Mathias,

The Static Resource must also include β€œjquery.min.js”

You left it out? And now I included it again: With the correct result πŸ˜‰ Good Job !!

The code used is:
var source = [{"Title":"Item 01"},{"Title":"Item 02"}]
var result = alasql('SELECT * FROM ? ', [source]);
console.log('result: '+result);
component.set('v.alasqlResult', JSON.stringify(result));

You can see the result on the page now πŸ˜‰

Just in case: If you want to code yourselves you can do this as follows:

  1. Open the Developer Console:
    [cid:[email protected]]

  2. Open the ALASQL Component:
    [cid:[email protected]]

  3. You can open the Component (page) and the Controller (script)
    The code is not hard to read.

If questions please ask.

Thanks so far.

Kind regards,
Mario

From: Mathias Rangel Wulff notifications@github.com
Sent: Saturday, 14 July 2018 00:09
To: agershun/alasql alasql@noreply.github.com
Cc: Mario Kyoo mario@kyoo.studio; Author author@noreply.github.com
Subject: Re: [agershun/alasql] Salesforce Locker Service (#1017)

With the latest changes no error is displayed - but I see no output on the alasql-dev-ed.lightning.force.com/lightning/n/ALASQL page.

Is it meant to provide any output after alasqlResult =?

β€”
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/agershun/alasql/issues/1017#issuecomment-404966268, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AlK5XhjLOF48s3pE2FOtOohZyiU3r_Csks5uGRp9gaJpZM4UmXWb.

Perfect!

The updated version is now deployed as version 0.4.7.

I would love to play around a bit if you could let the link be open a week or so more :)

Hello Mathias,

Great. Thanks a lot.
Take as long as you want. There are no cost involved.

Kind regards,
Mario

Hello Mathias or Andrey,

I have constructed the following statement:
alasql.fn.writeButton = function(name) {
return '{"buttonAction":"addTab","buttonValue":"'+name+'"}';
}
result = alasql('SELECT Title, {label:Form,[value]:writeButton(CONCAT("{\"label\":\"",Title,"\",\"value\":\"",Title,"\"}")),[action]:"{!c.buttonAction}"} AS [Form] FROM ?', [result]);

it returns:
[{"Title":"Kyoo Demo Form","Form":{"value":"{"buttonAction":"addTab","buttonValue":"{"label":"Kyoo Demo Form","value":"Kyoo Demo Form"}"}","action":"{!c.buttonAction}"}},{"Title":"test","Form":{"value":"{"buttonAction":"addTab","buttonValue":"{"label":"test","value":"test"}"}","action":"{!c.buttonAction}"}}]

As you can see we end up with a ” in the object where we need only the β€œ.

But if we only use ” instead of \” alasql returns an error.

Can you advise how to fix this?

Kind regards,
Mario

From: Mario Kyoo
Sent: Saturday, 14 July 2018 21:45
To: agershun/alasql reply@reply.github.com
Cc: agershun/alasql alasql@noreply.github.com; Author author@noreply.github.com
Subject: Re: [agershun/alasql] Salesforce Locker Service (#1017)

Hello Mathias,

Great. Thanks a lot.
Take as long as you want. There are no cost involved.

Kind regards,
Mario
Sent from my iPhone

On 14 Jul 2018, at 21:02, Mathias Rangel Wulff <[email protected]notifications@github.com> wrote:

Perfect!

The updated version is now deployed as version 0.4.7.

I would love to play around a bit if you could let the link be open a week or so more :)

β€”
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/agershun/alasql/issues/1017#issuecomment-405043297, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AlK5XtUlgGAokg39mn-jAb7_DKviqsurks5uGkBGgaJpZM4UmXWb.

Hello Mathias,

Playing a bit I think I should do it as follows:
result = alasql('SELECT Title, ({"label":"Form","value":{"label":Title,"value":Title},"action":"{!c.buttonAction}"}) AS [Form] FROM ?', [result]);

Kind regards,
Mario

From: Mario Kyoo
Sent: Saturday, 15 September 2018 19:54
To: agershun/alasql reply@reply.github.com
Cc: agershun/alasql alasql@noreply.github.com; Author author@noreply.github.com
Subject: Escape double quote in select statement

Hello Mathias or Andrey,

I have constructed the following statement:
alasql.fn.writeButton = function(name) {
return '{"buttonAction":"addTab","buttonValue":"'+name+'"}';
}
result = alasql('SELECT Title, {label:Form,[value]:writeButton(CONCAT("{\"label\":\"",Title,"\",\"value\":\"",Title,"\"}")),[action]:"{!c.buttonAction}"} AS [Form] FROM ?', [result]);

it returns:
[{"Title":"Kyoo Demo Form","Form":{"value":"{"buttonAction":"addTab","buttonValue":"{"label":"Kyoo Demo Form","value":"Kyoo Demo Form"}"}","action":"{!c.buttonAction}"}},{"Title":"test","Form":{"value":"{"buttonAction":"addTab","buttonValue":"{"label":"test","value":"test"}"}","action":"{!c.buttonAction}"}}]

As you can see we end up with a ” in the object where we need only the β€œ.

But if we only use ” instead of \” alasql returns an error.

Can you advise how to fix this?

Kind regards,
Mario

From: Mario Kyoo
Sent: Saturday, 14 July 2018 21:45
To: agershun/alasql reply@reply.github.com
Cc: agershun/alasql <[email protected]alasql@noreply.github.com>; Author <[email protected]author@noreply.github.com>
Subject: Re: [agershun/alasql] Salesforce Locker Service (#1017)

Hello Mathias,

Great. Thanks a lot.
Take as long as you want. There are no cost involved.

Kind regards,
Mario
Sent from my iPhone

On 14 Jul 2018, at 21:02, Mathias Rangel Wulff <[email protected]notifications@github.com> wrote:

Perfect!

The updated version is now deployed as version 0.4.7.

I would love to play around a bit if you could let the link be open a week or so more :)

β€”
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/agershun/alasql/issues/1017#issuecomment-405043297, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AlK5XtUlgGAokg39mn-jAb7_DKviqsurks5uGkBGgaJpZM4UmXWb.

So, did you manage to solve it?

Hello Mathias,

Yes. Thanks. Actually it was quite easy. Could not find documentation about it though so it took a while with trial and error to learn.

Thanks for following up this fast.

Kind regards
Mario

Sent from my iPhone

On 16 Sep 2018, at 09:30, Mathias Rangel Wulff <[email protected]notifications@github.com> wrote:

So, did you manage to solve it?

β€”
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHubhttps://github.com/agershun/alasql/issues/1017#issuecomment-421715993, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AlK5XsZmJ2nJTEjzN73MhcVbj0GhoVIfks5ubf4qgaJpZM4UmXWb.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daffodilistic picture daffodilistic  Β·  3Comments

Serge-SDL picture Serge-SDL  Β·  4Comments

karubimania picture karubimania  Β·  6Comments

thierrygervais picture thierrygervais  Β·  6Comments

fredt34 picture fredt34  Β·  5Comments