develooper Front page | perl.perl6.language | Postings from April 2005

Re: Fwd: Re: embedding languages in Perl 6

Thread Previous | Thread Next
From:
BÁRTHÁZI András
Date:
April 20, 2005 11:36
Subject:
Re: Fwd: Re: embedding languages in Perl 6
Message ID:
4266A137.2030207@barthazi.hu
Hi,

> What is the benefit of this syntax over having a simple function that
> takes one argument, interpolating variables from CALLER::?
> 
>     for sql 'SELECT * FROM table WHERE id=$id' { ... }

The difference is between compile time parsing and runtime parsing. This 
expression can be transformed to a prepare statement plus a call, which 
is not just faster, but more safer, if $id contains aposthropes or other 
characters.

Maybe other abstraction would be possible, too.

What about this (I'm not really sure, if it's ok):

INSERT INTO table (col1, col2) VALUES %row;

And it will be:

INSERT INTO table (col1, col2) VALUES (?,?)

   and

%row.col1, %row.col2 will be insert as values.

Bye,
   Andras

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About