Grokbase
x

Will Hawes (wd...@gmail.com)

Profile | Posts (30)

User Information

Display Name:Will Hawes
Partial Email Address:wd...@gmail.com
Posts:
30 total
11 in Catalyst Framework
2 in catalyst@lists.scsys.co.uk
4 in DBIx::Class
2 in dbix-class@lists.scsys.co.uk
10 in HTML::FormFu
1 in HTML::FormFu

5 Most Recent

All Posts
1) Will Hawes [Catalyst] How to register a stored procedure with the model?
| +1 vote
2008/9/25 Kai Andresen <kai.andresen@gmail.com>:...
catalyst@lists.scsys.co.uk
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
2008/9/25 Kai Andresen <kai.andresen@gmail.com>:
> Hi all,
>
> I need to call an Oracle stored procedure, and a function, where can I find
> som reference material on that?

http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class/Manual/Cookbook.pod#Using_database_functions_or_stored_procedures
2) Will Hawes [Dbix-class] "having" attribute problems with SQLite
| +1 vote
The 0.08010 docs in DBIx::Class::ResultSet contain an example for the "having" attribute that shows...
catalyst@lists.scsys.co.ukdbix-class@lists.scsys.co.uk
[ Profile | Reply to groups ] [ Flat  Thread  Threaded ]
The 0.08010 docs in DBIx::Class::ResultSet contain an example for the
"having" attribute that shows parameter values being passed using a
hashref:

having => { 'count(employee)' => { '>=', 100 } }

Meanwhile, in the test suite there are a couple of tests using
"having" (76joins.t in 0.08010 and 77prefetch.t in 0.08 trunk), but
these both pass a scalar ref instead, like this:

$rs = $rs->search( undef, {  having =>{ 'count(*)'=> \'> 2' }});

DBIC_TRACE shows the following SQL is generated for the above test:

SELECT me.artistid, me.name FROM artist me LEFT JOIN cd cds ON (
cds.artist = me.artistid ) GROUP BY me.name HAVING ( ( ( MAX(cds.cdid)
< 5 ) AND ( count(*) > 2 ) ) ):

And here's what happens if the test is altered to use the hashref syntax:

$rs = $rs->search( undef, { having =>{ 'count(*)'=> { '>', 2' }}});

SELECT me.artistid, me.name FROM artist me LEFT JOIN cd cds ON (
cds.artist = me.artistid ) GROUP BY me.name HAVING ( ( ( MAX(cds.cdid)
< 5 ) AND ( count(*) > ? ) ) ): '2'

Both look fine to me and I'm not getting any errors, but I'm seeing
the scalarref syntax return rows as expected, while the hashref syntax
returns zero rows irrespective of what's in the database.

I've observed this on two machines, one running DBD::SQLite 1.14 and
DBI 1.607 and the other DBD::SQLite 1.13 and DBI 1.57.

I don't have a database server handy to test against other drivers
atm, but since DBIx::Class::Storage::DBI calls $sth->bind_param when
the hashref syntax is used I'm guessing the DBIC docs are correct and
that this may be a DBD problem of some sort.

I've not found reference to anything similar in the list archives -
can anyone else confirm this behaviour before I go any further?
3) Will Hawes [Dbix-class] NULL values and DBIx::Class::InflateColumn::DateTime
| +1 vote
2008/8/3 Matt S Trout <dbix-class@trout.me.uk>: Having reviewed the InflateColumn and...
catalyst@lists.scsys.co.ukdbix-class@lists.scsys.co.uk
[ Profile | Reply to groups ] [ Flat  Thread  Threaded ]
2008/8/3 Matt S Trout <dbix-class@trout.me.uk>:
> On Sun, Aug 03, 2008 at 01:13:39PM +0100, Will Hawes wrote:
>> The InflateColumn::DateTime helper currently throws "Invalid date
>> format: " for rows that contain NULL, even if the column info has
>> is_nullable => 1. The docs show that either default_value =>
>> '0000-00-00' or datetime_undef_if_invalid => 1 could be used to work
>> around this, but bypassing inflation completely based on the presence
>> of is_nullable => 1 would be trivial and probably more sensible.
>
> We already bypass inflation of any column that's undef.
>
> get_inflated_column in DBIx::Class::InflateColumn calls _inflate_column
> and the first thing that does is
>
> return $value unless defined $value; # NULL is NULL is NULL
>
> so I'm really not sure how you've contrived to get undef passed to an
> inflator ...

Having reviewed the InflateColumn and InflateColumn::DateTime source
and rewritten my code from scratch, neither am I, as it now works
perfectly.

I wasn't trying to do anything wacky - I just have a single nullable
column defined as "datetime" and am inflating/deflating that. I'd used
InflateColumn as a temporary workaround and unfortunately the original
code never made it into my repository, so I can't even check back to
see what I'd done wrong. Slap.

Clearly one to file under "user error", sorry list.
4) Will Hawes [Dbix-class] NULL values and DBIx::Class::InflateColumn::DateTime
| +1 vote
The InflateColumn::DateTime helper currently throws "Invalid date format: " for rows that contain...
catalyst@lists.scsys.co.ukdbix-class@lists.scsys.co.uk
[ Profile | Reply to groups ] [ Flat  Thread  Threaded ]
The InflateColumn::DateTime helper currently throws "Invalid date
format:  " for rows that contain NULL, even if the column info has
is_nullable => 1. The docs show that either default_value =>
'0000-00-00' or datetime_undef_if_invalid => 1 could be used to work
around this, but bypassing inflation completely based on the presence
of is_nullable => 1 would be trivial and probably more sensible. Happy
to patch if others are in agreement, what do you think?
5) Will Hawes [Catalyst] Variable Catalyst seems to be undefined.
| +1 vote
2008/5/9 Kieren Diment <diment@gmail.com>: And if in doubt, just use some warn statements or...
catalyst@lists.scsys.co.uk
[ Profile | Reply to group ] [ Flat  Thread  Threaded ]
2008/5/9 Kieren Diment <diment@gmail.com>:
>
> On 10 May 2008, at 00:01, Chris Devine wrote:
>
>> TIA for any insight. I am new to Catalyst, using ver. 5.7012. I am working
>> through JR's examples as well trying to modify them. I found a strange
>> problem (to me) that I couldn't find any solution for by searching.
>>
>> Loosely based on Addressbook, it seems that the variable Catalyst in
>> index.tt2 is not defined. I first noticed this by
>> Catalyst.uri_for('/login')
>> returning ''.
>>
>> Does anyone have any pointers on debugging this?

And if in doubt, just use some warn statements or $c->log->debug calls
in your view class, along with Data::Dumper, to see what is being
passed to the template.

spacer
Profile | Posts (30)
Home > People > Will Hawes