Ronald, see my question "HM>> below".

>>> "Ronald J Kimball" <[EMAIL PROTECTED]> 03/10/05 10:39 AM >>>

> Javier, I might be way off here, but looks to me like this
statement:
> 
>    my($sql) = "UPDATE GLOBALSettings SET Lang = '$::lang_code'";
> 
> has $::lang_code in *single quotes* - I'm not sure about this in
this
> context, but won't the single quotes will keep $::lang_code from
being
> interpolated?

The string is a double-quoted string.  The single-quotes are just
literal
characters inside a double-quoted string.  They have no special
meaning
here.

HM>> I understand the single quotes have no meaning here in this
double quoted string, but what about when the string is used in the
execute - will $::lang_code be interpolated properly even though it
is being surrounded by single quotes?  Can you explain to me how this
gets processed - seems like it should be a simple concept, but quoting
in situations like this has always been a stumbling block for me :-(

Thanks.

Hardy


This is still good advice though:

> Why not make that
> 
>   my($sql) = 'UPDATE GLOBALSettings SET Lang = ?';
> 
> and then add the $::lang_code as a parameter in the execute, like
> this:
> 
>      if ($criteria) {
>           my $rc = $sth->execute ( $::lang_code, $criteria ) or
>                               &Error("Unable to execute statement",
> "$sql with criteria $criteria");
>      } else {
>       my $rc = $sth->execute ($::lang_code) or
>                               &Error("Unable to execute statement",
> $sql);
>      }


Ronald


Reply via email to