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!

In reply to DBIx can't read SQL server 2008 varchar(max) column by Thai Heng

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.