Hello friends I am working on the perl, mysql project and I wants to retrieve the database value from the MySQL database using DBIx::class. I have written following code

#!/usr/bin/perl -w use strict; BEGIN { unshift (@INC,"/view/sawans1_Ndb_0037_work/vobs/pp/pptai/common/Nightl +yDB"); } use DBIx::Class; use Configuration qw( &get_common_path ); use lib &Configuration::get_common_path(); use Common; use Database::ConnectionManager; my $host; my $user; my $pw; my $dump_flag; my $dump_dir; my $us_desc_info=& _get_us_desc(); print $us_desc_info; sub _get_api_schema{ my $db = $Configuration::DB_SCHEMA_NAME; $host = $Configuration::DB_HOST_NAME; $user = $Configuration::DB_USERNAME; $pw = $Configuration::DB_PASSWORD; $dump_flag = $Configuration::SCHEMA_DUMP_FLAG; $dump_dir = $Configuration::SCHEMA_DUMP_DIR; return ConnectionManager::connect_to_nightly_db_schema($db,$host, $user,$pw,$dump_flag,$dump_dir); } sub _get_us_desc { #get DIBx::Class::Schema object my $schema = _get_api_schema(); my $us_name="testppcmd/UserScenarioPPsetpriority"; my $test_run_description = _query_to_get_desc($schema, $us_name); } sub _query_to_get_desc { my ($schema, $us_name) = @_; my $test_run_rs = $schema->resultset("UserScenario")->search( { "name" => $us_name }, { select => "description", } ); return $test_run_rs; }

When I run this code I gets value 1. But not the actual description corresponds to passed user scenario name.Where am I making mistake? I think I am getting the count of number of instances from DBIx::Class::ResultSet::count(). So in order to retrieve the database value what changes you will suggest me to make? Thanks in advance !!!!


In reply to Retrieving value from MySQL Database using DBIx::class by siddheshsawant

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.