Lasso 9.2.3 vs, 9.3 action_param

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Lasso 9.2.3 vs, 9.3 action_param

lizquigg
I did some updating of code from Lasso 8.6 to Lasso 9.2.3 and I was able to use:

[var('id')=(action_param('id'))]
[var('firstname') = action_param('firstname')]
[var('lastname') = action_param('lastname')]

[inline(  -host=Array(
-datasource='postgreSQL',
-name=$hostsql,
-port=$portsql,
-username=$usersql,
-password=$pwsql),
-database=$database,
-table='attendees',
'firstname'=$firstname,
'lastname'=$lastname,
-Keyfield='id',
-KeyValue=$id,
-Update)]

Now when I try to run this in Lasso 9.3, it seems totally unhappy with the the parameters.

If I run it as above, I get:
22P02 ERROR: invalid input syntax for integer: "" LINE 1: ...country" = '',"yesno1" = '',"publish" = '' WHERE ("id" = '') ^
None of the strings look right.

So I changed it to use web_request->param
[var('id')=(web_request->param('id'))]
[var('firstname') = web_request->param('firstname')]
[var('lastname') = web_request->param('lastname')]

22P02 ERROR: invalid input syntax for integer: "\x3136" LINE 1: ..."yesno1" = '\x59',"publish" = '\x59' WHERE ("id" = '\x3136') ^

So I think it must want a asString

[var('firstname') = web_request->param('firstname')->asString]
[var('lastname') = web_request->param('lastname')->asString]

22P02 ERROR: invalid input syntax for integer: "\x3136" LINE 1: ...y" = '',"yesno1" = '',"publish" = '' WHERE ("id" = '\x3136') ^
It still is not getting the correct values for the parameters. I decide to do the web_request->param within the inline.

I tried to change it to:

[inline(  -host=Array(
-datasource='postgreSQL',
-name=$hostsql,
-port=$portsql,
-username=$usersql,
-password=$pwsql),
-database=$database,
-table='attendees',
'firstname'=(web_request->param('firstname')),
'lastname'=(web_request->param('lastname')),
-Keyfield='id',
-KeyValue=(web_request->param('id’)),
-Update)]

It does not give an error message [error_msg] and  [Error_currentError] after the update.

[Error_Msg]<br>
[Error_CurrentError] on update.<br>

[inline(  -host=Array(
-datasource='postgreSQL',
-name=$hostsql,
-port=$portsql,
-username=$usersql,
-password=$pwsql),
-database=$database,
-table='attendees',
'firstname'=(web_request->param('firstname')->asString),
'lastname'=(web_request->param('lastname')->asString),
'id'=(web_request->param('id')->asInteger),
-Update)]

Same thing.

I tried putting the actual value of id (16) for a particular record and it did the same thing. After the update code if I do a search, I find the record o.k.,but without the update.

I did not imagine moving from Lasso 9.2.3 to Lasso 9.3 to be so difficult.
It seems very onerous if one has to struggle so to provide the correct parameters to code.

This is my first test with trying to update a record so maybe there is something completely different wrong.  I am working with the same development server for PostgreSQL.

Is there something obvious I am doing wrong?

Thanks.





Elizabeth K. Quigg
Education Technology Specialist

Education Office
Fermi National Accelerator Laboratory
630 840 2631 office
ed.fnal.gov<http://ed.fnal.gov/>
[hidden email]<http://person@...>

Connect with us!
Facebook <http://www.facebook.com/FermilabEd>  |  Twitter<http://twitter.com/FermilabEd>





#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>
Reply | Threaded
Open this post in threaded view
|

Re: Lasso 9.2.3 vs, 9.3 action_param

Jolle Carlestam-2
Are you sure that you’re actually having any values to work with? The eror message seems to indicate something else.

I would dig into what you’re receiving from the client. Try outputting web_request -> params. If you can access the log in the console do a
stdoutnl(’params ’ + web_request -> params)
early in your code.

To access the log from the command line
sudo tail -f -n 50 /var/lasso/[instancename]/lasso.out.txt

Also, not as a solution but a recommendation. Download my replacement of web_request -> param here
https://gist.github.com/jolle-c/d72c8af689cb7e79ccc1

With it you can do
local(
        id = wrp(’id’),
        firstname = wrp('firstname'),
        lastname = wrp(’lastname')
)
And some other cool stuff with params.

Also grab Ke’s DS. Way more efficient than inlines.
https://github.com/Zeroloop/ds
Once setup you can replace your inline with
ds_attendees -> updaterow(map(’firstname’ = #firstname, ’lastname’ = #lastname), ’id’ = #id)

But, first make sure that you actually are getting the values as recommended above.

HDB
Jolle


> 8 apr. 2016 kl. 00:39 skrev Elizabeth K Quigg <[hidden email]>:
>
> I did some updating of code from Lasso 8.6 to Lasso 9.2.3 and I was able to use:
>
> [var('id')=(action_param('id'))]
> [var('firstname') = action_param('firstname')]
> [var('lastname') = action_param('lastname')]
>
> [inline(  -host=Array(
> -datasource='postgreSQL',
> -name=$hostsql,
> -port=$portsql,
> -username=$usersql,
> -password=$pwsql),
> -database=$database,
> -table='attendees',
> 'firstname'=$firstname,
> 'lastname'=$lastname,
> -Keyfield='id',
> -KeyValue=$id,
> -Update)]
>
> Now when I try to run this in Lasso 9.3, it seems totally unhappy with the the parameters.
>
> If I run it as above, I get:
> 22P02 ERROR: invalid input syntax for integer: "" LINE 1: ...country" = '',"yesno1" = '',"publish" = '' WHERE ("id" = '') ^
> None of the strings look right.
>
> So I changed it to use web_request->param
> [var('id')=(web_request->param('id'))]
> [var('firstname') = web_request->param('firstname')]
> [var('lastname') = web_request->param('lastname')]
>
> 22P02 ERROR: invalid input syntax for integer: "\x3136" LINE 1: ..."yesno1" = '\x59',"publish" = '\x59' WHERE ("id" = '\x3136') ^
>
> So I think it must want a asString
>
> [var('firstname') = web_request->param('firstname')->asString]
> [var('lastname') = web_request->param('lastname')->asString]
>
> 22P02 ERROR: invalid input syntax for integer: "\x3136" LINE 1: ...y" = '',"yesno1" = '',"publish" = '' WHERE ("id" = '\x3136') ^
> It still is not getting the correct values for the parameters. I decide to do the web_request->param within the inline.
>
> I tried to change it to:
>
> [inline(  -host=Array(
> -datasource='postgreSQL',
> -name=$hostsql,
> -port=$portsql,
> -username=$usersql,
> -password=$pwsql),
> -database=$database,
> -table='attendees',
> 'firstname'=(web_request->param('firstname')),
> 'lastname'=(web_request->param('lastname')),
> -Keyfield='id',
> -KeyValue=(web_request->param('id’)),
> -Update)]
>
> It does not give an error message [error_msg] and  [Error_currentError] after the update.
>
> [Error_Msg]<br>
> [Error_CurrentError] on update.<br>
>
> [inline(  -host=Array(
> -datasource='postgreSQL',
> -name=$hostsql,
> -port=$portsql,
> -username=$usersql,
> -password=$pwsql),
> -database=$database,
> -table='attendees',
> 'firstname'=(web_request->param('firstname')->asString),
> 'lastname'=(web_request->param('lastname')->asString),
> 'id'=(web_request->param('id')->asInteger),
> -Update)]
>
> Same thing.
>
> I tried putting the actual value of id (16) for a particular record and it did the same thing. After the update code if I do a search, I find the record o.k.,but without the update.
>
> I did not imagine moving from Lasso 9.2.3 to Lasso 9.3 to be so difficult.
> It seems very onerous if one has to struggle so to provide the correct parameters to code.
>
> This is my first test with trying to update a record so maybe there is something completely different wrong.  I am working with the same development server for PostgreSQL.
>
> Is there something obvious I am doing wrong?
>
> Thanks.
>
>
>
>
>
> Elizabeth K. Quigg
> Education Technology Specialist
>
> Education Office
> Fermi National Accelerator Laboratory
> 630 840 2631 office
> ed.fnal.gov<http://ed.fnal.gov/>
> [hidden email]<http://person@...>
>
> Connect with us!
> Facebook <http://www.facebook.com/FermilabEd>  |  Twitter<http://twitter.com/FermilabEd>
>
>
>
>
>
> #############################################################
>
> This message is sent to you because you are subscribed to
>  the mailing list Lasso [hidden email]
> Official list archives available at http://www.lassotalk.com
> To unsubscribe, E-mail to: <[hidden email]>
> Send administrative queries to  <[hidden email]>


#############################################################

This message is sent to you because you are subscribed to
  the mailing list Lasso [hidden email]
Official list archives available at http://www.lassotalk.com
To unsubscribe, E-mail to: <[hidden email]>
Send administrative queries to  <[hidden email]>