MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: (passing variables to) [sql array]



******    message to minivend-users from Stephen Anspach <spach@la.razorfish.com>     ******

from a ways back, a question asked but never answered on the list:

On Mon, 31 Aug 1998, Dan Busarow wrote:

> ******    message to minivend-users from Dan Busarow <dan@dpcsys.com>     ******
[snip]
> A simple example, just reversing the replacement of spaces with '_'
> 
> [perl interpolate=1]
>    $a = tag_data('session', 'arg');
>    $a =~ s/_/ /g;
>    my $string =<<'EOF';
> [sql array]select * from cat2man where Category = '$a'[/sql]
> EOF
> ...[/perl]
> 
> $a doesn't get expanded within the select statement, the mysql log entry
> for the query is
> 
>         42 Query      select * from cat2man where Category = '$a'
> 
> Also tried
> 
>    my $string =<<EOF;
> [sql array]
> [arg]$a[/arg]   
> select * from cat2man where Category = %s[/sql]
> EOF
> 
> which creates the same query with a '$a'
> 
> Someone whack me with a clue by 4 please :)

	argh!  i'm struggling with the same problem!  i can't seem to
get the value of a scratch variable passed into a sql query no matter
what i do.  look:

	this works:

[perl interpolate=1]

my $string =<<'EOF';
[sql type=array]
[arg]31900[/arg]
select ups1 from products where sku = %s
[/sql]

EOF

$string;

[/perl]

	this doesn't:

[perl interpolate=1]

my $string =<<'EOF';
[sql type=array]
[arg][scratch randitem][/arg]
select ups1 from products where sku = %s
[/sql]

EOF

$string;

[/perl]

	naturally, [scratch randitem] is set correctly.  i've tried
things like:

[perl interpolate=1]

$num = [scratch randitem];

my $string =<<'EOF';
[sql type=array]
[arg]$num[/arg]
select ups1 from products where sku = %s
[/sql]

EOF

$string;

[/perl]

	which, of course, doesn't work either.  dan, did you or
anybody ever solve this?  is this just bad syntax on my part?  thanks
a million in advance...


 |   ||  |||  ||       r  a  z  o  r  f  i  s  h  , los angeles

 stephen anspach
       [ director of technology ]

                                      >> (1) 310.581.5599 x 104

-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: