On Wed Apr 02, 2008 at 08:50:02AM +0200, Peter Rabbitson wrote:
> Mark Lawrence wrote:
> >On Tue Apr 01, 2008 at 08:35:38PM -0500, Jonathan Rockway wrote:
> >>* On Tue, Apr 01 2008, Peter Rabbitson wrote:
> >>
> >>> __PACKAGE__->add_colu
n only index one column. Why
> not do:
>
> __PACKAGE__->add_index( idx_foo_bar => [qw/foo bar/] );
How often do you need to know the name of an index? Why not go one
simpler and do:
__PACKAGE__->add_index(qw/foo bar/);
Which could return the autogenerated nam
ou are the kind of person who likes to automate CGI
tests that way.
For example, I often do the following which tells you why you are
getting an Internal Server Error without having to tail/grep the
webserver log file:
HTTP_HOST=localhost REQUEST_URI=/some/path/ perl -Ilib bin/script.cgi
See http
On Wed Mar 12, 2008 at 04:20:16PM +, Matt Lawrence wrote:
> Mark Lawrence wrote:
> >On Wed Mar 12, 2008 at 03:37:33PM +, Matt Lawrence wrote:
> >
> >>Mark Lawrence wrote:
> >>
> >>>On Wed Mar 12, 2008 at 12:30:14PM +, Matt Lawrence w
On Wed Mar 12, 2008 at 03:37:33PM +, Matt Lawrence wrote:
> Mark Lawrence wrote:
> >On Wed Mar 12, 2008 at 12:30:14PM +, Matt Lawrence wrote:
> >
> >>Mark Lawrence wrote:
> >>
> >>>You don't deal with binary (non-printable) data. Assu
On Wed Mar 12, 2008 at 12:30:14PM +, Matt Lawrence wrote:
> Mark Lawrence wrote:
> >
> >You don't deal with binary (non-printable) data. Assuming this is method
> >is for debugging purposes its usefulness is limited to pure text and
> >won'
uot;$extra extra placeholder", $extra==1?'':'s', " in SQL";
> +}
> +elsif (@bind_vals) {
> +warn @bind_vals." extra bind parameter", @bind_vals==1?'':'s';
> +}
> +
> +return $sql;
> +}
You
my $quote = $self->dbh->quote($_);
$sql =~ s/\?/$quote/;
}
}
return $sql;
}
Feel free to use as you like.
Mark.
--
Mark Lawrence
___
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
tions. Either have to do some
more investigation into the reason for the overload (maybe there are
some legitmate string comparisons somewhere), or ask the person who
wrote it...
Mark.
--
Mark Lawrence
___
List: http://lists.scsys.co.uk/cgi-bin/mailma
ication.
If what you posted was simply some pseudo SQL then please ignore my
ramblings.
Regards,
Mark.
--
Mark Lawrence
___
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.or
On Wed Sep 19, 2007 at 04:16:32PM +0300, [EMAIL PROTECTED] wrote:
> [EMAIL PROTECTED]([EMAIL PROTECTED])@Wed, Sep 19, 2007 at 02:49:43PM +0300:
> > Mark Lawrence([EMAIL PROTECTED])@Wed, Sep 19, 2007 at 12:58:24PM +0200:
> > > On Wed Sep 19, 2007 at 11:50:26AM +0300, [EMAI
On Wed Sep 19, 2007 at 12:58:24PM +0200, Mark Lawrence wrote:
> SELECT
> t1.id,
> CASCADE(t2.lang, t1.lang) AS lang,
> CASCADE(t2.title, t1.title) AS title,
> CASCADE(t2.body, t1.body) AS body,
> FROM
> entry
a related object that has a translation
> too... That's a big mess for me.
On the SQL side you can juse keep on adding CASCADEs and JOINs as many
times as you want. Unfortunately this doesn't really translate well to
pure Object(table)-
On Wed Sep 12, 2007 at 05:25:20PM +0100, Matt S Trout wrote:
> On Thu, Sep 06, 2007 at 08:07:14PM +0200, Mark Lawrence wrote:
> >
> > Bitwise operators can be overloaded with Perl's overload.pm which is how
> > SQL::DB (and Tangram, where I first saw thi
On Wed Sep 12, 2007 at 05:23:28PM +0100, Matt S Trout wrote:
> On Thu, Sep 06, 2007 at 02:25:44PM +0200, Mark Lawrence wrote:
> >
> > The second reason is extensibility. Take for example
> > SQL::Abstract::select (to be fair, the other query types are ok):
> >
t
> the above code work?
Looks perfectly valid to me, with the usual proviso's associated with
parsing / interpolating strings.
> Well, that's one of the situations I meant where SQL::DB could be useful
> (even more in the example in point 4), *provided* that you resort to
> s
to store, retrieve and manipulate a query, but I can see how that would
be useful. I think the SQL::DB answer would be to store the inputs, not
the abstract representation. The query only exists while it is being
built.
> In a word, it seems that SQL::DB is not very good to offer on abstract
> representation of the queries, IMHO.
I agree!
> SQL::DB is cute, is very perlish and it is written in a very clean and
> structured way (both the docs and the code), and I've certainly greatly
> underestimated it (I apologize for that) and I largely missed its point.
>
> Nonetheless, I don't see any significant advantage over SQL::Abstract,
> or rather, I see only disadvantages (albeit slight in the most common
> cases), as shown in points 1, 2 and 4 above.
>
> Yet, it has a broader scope than SQL::Abstract and space to evolve.
Thanks for the time and effort you've put into you mails. Has really
helped me to clarify what SQLDB does and doesn't do.
Cheers,
Mark.
--
Mark Lawrence
___
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]
On Fri Sep 07, 2007 at 02:43:05PM +0200, Emanuele Zeppieri wrote:
> Mark Lawrence wrote:
> You instead just overload the operators and fully rely only on the Perl
> expression parser, right?
Yes!
> So I misunderstood before, but that's probably even more limited than
>
On Fri Sep 07, 2007 at 02:12:31PM +0200, Emanuele Zeppieri wrote:
> Mark Lawrence wrote:
>
> >foreach my $field ($form->param) {
> >my @vals = $form->param($field) or next;
> >$expr= $expr & ( @v
);
}
else {
$expr = $expr & ($cd->year < $year);
}
}
Cheers,
Mark.
--
Mark Lawrence
___
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]
etc are
also overloaded which may help to keep things clearer:
... where => $table->column gt ( $x < $y ? $y : $y )
> So ... I like it intellectually, but I'm not sure I would buy it for my
> projects. I have to look into it in more details, though.
Luckily I'm not
On Fri Sep 07, 2007 at 09:09:28AM +0200, Emanuele Zeppieri wrote:
> Mark Lawrence wrote:
>
> >I'm not sure why people keep thinking SQL::DB requires more string
> >manipulation than SQL::Abstract. Going back to one of the examples
> >I first posted:
> >
&
On Fri Sep 07, 2007 at 01:23:48AM +0200, Emanuele Zeppieri wrote:
> Mark Lawrence wrote:
> >There is another *implicit* AND between the two conditions. At first
> >(and second glance) this is very different from the actual intended SQL,
> >not to mention the complexi
ely their big brothers (&&,||,not,and,or) cannot be overloaded.
Because the bitwise ops have similar meanings to their counterparts
their usage looks "close enough" to the real thing, so it doesn't take
long to get comfortable with that.
Mark.
--
Mark Lawrence
7;t you?)
I was referring to the syntax being an even closer approximation to the
SQL, which in my mind has some benefit. I don't quite understand how
your statement relates to that.
> So I had to make a De Morgan's law engine inside my parser. Took me all of
> two hours, and it works just peachy.
That is my point. Relying on Perl's logic operators means that you
don't have to do the De Morgan translations. The "!" equates directly
as "NOT", and in the above case automatically applies to the combined
condition inside the brackets. A direct mapping.
Regards,
Mark.
--
Mark Lawrence
___
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]
ssible to do this:
my $age = $r->age;
my $lname = $r->lname;
where => $lname->like('%son%') & ! ($age < 10 | $age > 20 )
Thanks,
Mark.
--
Mark Lawrence
___
List: http://lists.rawmode.org/cgi-bin/mailman/li
o
select all columns from a table with an unknown structure? Or is it
a question of efficiency?
Regards,
Mark.
[1] I don't know SQL::Translator so can't comment there. However it
looks to me like it does things backwards. SQL into Perl classes?
Perl classes are near
eration part, SQL::DB
is actually the module that ties this together with DBI.
As is usually the case with early development, documentation is lacking,
to say the least. So are a whole heap of unit tests and not every SQL
expression has been implemented. However I've already successfully used
SQL
28 matches
Mail list logo