[Dbix-class] Weird search issue
fREW Schmidt
frioux at gmail.com
Thu Feb 12 17:06:49 GMT 2009
Ok, here is my code:
return $self->basic_data({
> table =3D> 'Customer',
> search =3D> {
> id =3D> "AA001",
> },
> columns =3D> [qw/id name price_approval_required comments/],
> });
>
and I am calling this function that I wrote:
sub basic_data {
> my $self =3D shift;
> my $params =3D shift;
> my $table =3D $params->{table};
> my $search =3D $params->{search};
> my $columns =3D $params->{columns};
> my $rows =3D $self->query->param('limit') || 25;
> my $page =3D ($self->query->param('start')?(
> $self->query->param('start')/$rows + 1 ):1);
> my $order_by =3D
> ($self->query->param('sort')?$self->query->param('sort').'
> '.$self->query->param('dir'):'id');
> use DBIx::Class::ResultClass::HashRefInflator;
> my $rs_full =3D $self->schema()->resultset($table)->search($search,{
> order_by =3D> $order_by,
> columns =3D> $columns,
> });
> my $data =3D { data =3D> []};
> $data->{total} =3D $rs_full->count;
> my $rs =3D $rs_full->search({},{
> rows =3D> $rows,
> page =3D> $page,
> });
> $rs->result_class('DBIx::Class::ResultClass::HashRefInflator');
> while (my $operation_code =3D $rs->next() ) {
> push @{$data->{data}}, $operation_code;
> }
> return $self->json_body($data);
> }
>
yet I am getting this error:
[Thu Feb 12 10:57:16 2009] [error] [client 127.0.0.1] [Dispatch] ERROR for
> request
> '/devcgi/init.plx/controller_WorkOrderEntry/customer?cusomter_id=3DAA001':
> Error executing run mode 'customer': DBIx::Class::ResultSet::next(): DBI
> Exception: DBD::ODBC::st fetchrow_array failed: [Microsoft][SQL Native
> Client]String data, right truncation (SQL-01004) [for Statement "SELECT *
> FROM
> [Thu Feb 12 10:57:16 2009] [error] [client 127.0.0.1] (
> [Thu Feb 12 10:57:16 2009] [error] [client 127.0.0.1] SELECT TOP 25 *
> FROM
> [Thu Feb 12 10:57:16 2009] [error] [client 127.0.0.1] (
> [Thu Feb 12 10:57:16 2009] [error] [client 127.0.0.1] SELECT TOP
> 25 me.id, me.name, me.price_approval_required, me.comments FROM Customers
> me WHERE ( id =3D ? ) ORDER BY id ASC
> [Thu Feb 12 10:57:16 2009] [error] [client 127.0.0.1] ) AS foo
> [Thu Feb 12 10:57:16 2009] [error] [client 127.0.0.1] ORDER BY id DESC
> [Thu Feb 12 10:57:16 2009] [error] [client 127.0.0.1] ) AS bar
> [Thu Feb 12 10:57:16 2009] [error] [client 127.0.0.1] ORDER BY id ASC
> [Thu Feb 12 10:57:16 2009] [error] [client 127.0.0.1] " with ParamValues:
> 1=3D'A.A.0.0.1.'] at C:\\Documents and Settings\\frew\\My
> Documents\\Code\\aircraft_ducting/ACD/Controller.pm line 75
>
Anyone have any idea why it is adding dots between each character in the
search?
-fREW
-- =
fREW Schmidt
http://blog.afoolishmanifesto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20090212/9e3=
cdc59/attachment.htm
More information about the DBIx-Class
mailing list