http://www.perlmonks.org?node_id=1089630

Thai Heng has asked for the wisdom of the Perl Monks concerning the following question:

I use DBIx to retrieve some varchar(max) column, but the program is dead, not executed when retrieve only one row. The following is the output:
c:\temp\perl\DBIx\hengaini>perl ecis_odbc.pl MyApp::Schema=HASH(0x33c928) select * from T_SEARCH where %s
my script as follows:
#!/usr/bin/perl use v5.14.2; use strict; use warnings; use utf8; use MyApp::Schema; use open ":encoding(gbk)", ":std"; my $schema = MyApp::Schema->connect('dbi:ODBC:DSN=ecis_yl','sa','73545 +00', {odbc_trace_file => 'c:\temp\odbc.trc', odbc_trace => 1} ); say $schema; my $rs = $schema->resultset('Search'); while (my $search = $rs->next) { say $search->mysql; }
I use DBIx, and result 'Search' file Search.pm as follows:
package MyApp::Schema::Result::Search; use base qw/DBIx::Class::Core/; __PACKAGE__->table('dbo.t_search'); __PACKAGE__->add_columns(qw/ searchid searchname title mysql /); __PACKAGE__->set_primary_key('searchid'); 1;
The table "T_search" in SQL Server 2008 defination as follows :
CREATE TABLE [dbo].[T_Search]( [searchId] [varchar](10) NOT NULL, [searchName] [varchar](50) NOT NULL, [mysql] [varchar](max) NOT NULL, [formName] [varchar](30) NULL, [formAction] [varchar](30) NULL, [mykey] [varchar](30) NULL, [title] [varchar](120) NULL, [orderBy] [varchar](64) NULL, [groupBy] [varchar](30) NULL, [pageSize] [smallint] NOT NULL, [entityName] [varchar](30) NULL, [ds] [varchar](12) NULL, [remark] [varchar](80) NULL, CONSTRAINT [PK_T_SearchValue22] PRIMARY KEY NONCLUSTERED ( [searchId] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY + = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY] GO select max(len(mysql)) from T_Search --10516
My questions are: 1. how to debug this question? 2. What's wrong? Thanks!