question about functions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

question about functions

Roger Day-2

I’m using DBIX against a sqlite3 database on Redhat centos.

 

I’m trying a simple select substr(cdd_document, 1,3) from a table called page

 

  my $cdd = $db->resultset('Page')->search (

        {},

        {

            select => [{"substr(cdd_document,1,3)" => 'cdd_document'}],

            distinct => 1

        }

    );

 

Which *seems* to be OK … but I get this result:

 

SELECT SUBSTR(ME.CDD_DOCUMENT,1,3)( cdd_document ) FROM page me GROUP BY cdd_document:

at /usr/local/share/perl5/DBIx/Class/Schema.pm line 1081.

        DBIx::Class::Schema::throw_exception(Dsti::MVN::Index::Type_84::Schema=HASH(0x42354e8), DBIx::Class::Exception=HASH(0x521b798)) called at /usr/local/share/perl5/DBIx/Class/Storage.pm line 113

        DBIx::Class::Storage::throw_exception(DBIx::Class::Storage::DBI::SQLite=HASH(0x42357d0), DBIx::Class::Exception=HASH(0x521b798)) called at /usr/local/share/perl5/DBIx/Class/Storage/BlockRunner.pm line 190

        DBIx::Class::Storage::BlockRunner::__ANON__[/usr/local/share/perl5/DBIx/Class/Storage/BlockRunner.pm:219]() called at /usr/local/share/perl5/Context/Preserve.pm line 37

        Context::Preserve::preserve_context(CODE(0x52a17c0), "replace", CODE(0x5281690)) called at /usr/local/share/perl5/DBIx/Class/Storage/BlockRunner.pm line 219

        DBIx::Class::Storage::BlockRunner::_run(DBIx::Class::Storage::BlockRunner=HASH(0x5194740), CODE(0x3434ed0)) called at /usr/local/share/perl5/DBIx/Class/Storage/BlockRunner.pm line 111

        DBIx::Class::Storage::BlockRunner::run(DBIx::Class::Storage::BlockRunner=HASH(0x5194740), CODE(0x3434ed0)) called at /usr/local/share/perl5/DBIx/Class/Storage/DBI.pm line 850

        DBIx::Class::Storage::DBI::dbh_do(undef, undef, "SELECT SUBSTR(ME.CDD_DOCUMENT,1,3)( cdd_document ) FROM page "..., ARRAY(0x523e650), ARRAY(0x5266bf0)) called at /usr/local/share/perl5/DBIx/Class/Storage/DBI.pm line 1815

        DBIx::Class::Storage::DBI::_execute(DBIx::Class::Storage::DBI::SQLite=HASH(0x42357d0), "select", ARRAY(0x52432b0), ARRAY(0x52afdc0), undef, HASH(0x523e620)) called at /usr/local/share/perl5/DBIx/Class/Storage/DBI.pm line 2376

        DBIx::Class::Storage::DBI::_select(DBIx::Class::Storage::DBI::SQLite=HASH(0x42357d0), ARRAY(0x52432b0), ARRAY(0x52afdc0), undef, HASH(0x5248458)) called at /usr/local/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm line 124

        DBIx::Class::Storage::DBI::Cursor::next(DBIx::Class::Storage::DBI::Cursor=HASH(0x5225640)) called at /usr/local/share/perl5/DBIx/Class/ResultSet.pm line 1346

        DBIx::Class::ResultSet::_construct_results(DBIx::Class::ResultSet=HASH(0x47b6508)) called at /usr/local/share/perl5/DBIx/Class/ResultSet.pm line 1259

        DBIx::Class::ResultSet::next(DBIx::Class::ResultSet=HASH(0x47b6508)) called at t/Dsti-MVN-Index.t line 390

# Looks like your test exited with 2 just after 34.

Debugged program terminated.  Use q to quit or R to restart,

  use o inhibit_exit to avoid stopping after program termination,

  h q, h R or h o to get additional info.

 

Am I missing something?

 

Regards,

 

Roger Day


Notice: This e-mail and any attachments are intended only for the individual or company to which it is addressed and may contain information which is privileged, confidential and prohibited from disclosure or unauthorised use under applicable law. If you are not the intended recipient of this e-mail, you are hereby notified that any use, dissemination or copying of this e-mail or the information contained in this e-mail is strictly prohibited by the sender. If you have received this transmission in error, please return the material received to the sender and delete all copies from your system.

DST Output Limited is a company registered in England and Wales with company number 07262428.
DST Output (Bristol) Limited is a company registered in England and Wales with company number 04220397.
DST Output (Nottingham) Limited is a company registered in England and Wales with company number 04994924.

The registered office for the above mentioned companies is: DST House, St Mark's Hill, Surbiton, Surrey, KT6 4QD.

DST Output (London) Limited is a company registered in England and Wales with company number 02788181.
DSI billing services Limited is a company registered in England and Wales with company number 03823171.

The registered office for the above mentioned companies is: Evolution House, Choats Road, Dagenham, Essex, RM9 6BF.


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: question about functions

Roger Day-2

Please ignore, this is my own stupidity.

 

I needed the magic ‘me.cdd_document’ and other things.

 

Roger Day

Application Developer | DST Output UK

dd +44 844 324 8836  e [hidden email]  w www.dstoutput.co.uk

+ Tweet + Watch

 

From: Roger Day [mailto:[hidden email]]
Sent: 15 August 2014 13:22
To: DBIx::Class user and developer list
Subject: [Dbix-class] question about functions

 

I’m using DBIX against a sqlite3 database on Redhat centos.

 

I’m trying a simple select substr(cdd_document, 1,3) from a table called page

 

  my $cdd = $db->resultset('Page')->search (

        {},

        {

            select => [{"substr(cdd_document,1,3)" => 'cdd_document'}],

            distinct => 1

        }

    );

 

Which *seems* to be OK … but I get this result:

 

SELECT SUBSTR(ME.CDD_DOCUMENT,1,3)( cdd_document ) FROM page me GROUP BY cdd_document:

at /usr/local/share/perl5/DBIx/Class/Schema.pm line 1081.

        DBIx::Class::Schema::throw_exception(Dsti::MVN::Index::Type_84::Schema=HASH(0x42354e8), DBIx::Class::Exception=HASH(0x521b798)) called at /usr/local/share/perl5/DBIx/Class/Storage.pm line 113

        DBIx::Class::Storage::throw_exception(DBIx::Class::Storage::DBI::SQLite=HASH(0x42357d0), DBIx::Class::Exception=HASH(0x521b798)) called at /usr/local/share/perl5/DBIx/Class/Storage/BlockRunner.pm line 190

        DBIx::Class::Storage::BlockRunner::__ANON__[/usr/local/share/perl5/DBIx/Class/Storage/BlockRunner.pm:219]() called at /usr/local/share/perl5/Context/Preserve.pm line 37

        Context::Preserve::preserve_context(CODE(0x52a17c0), "replace", CODE(0x5281690)) called at /usr/local/share/perl5/DBIx/Class/Storage/BlockRunner.pm line 219

        DBIx::Class::Storage::BlockRunner::_run(DBIx::Class::Storage::BlockRunner=HASH(0x5194740), CODE(0x3434ed0)) called at /usr/local/share/perl5/DBIx/Class/Storage/BlockRunner.pm line 111

        DBIx::Class::Storage::BlockRunner::run(DBIx::Class::Storage::BlockRunner=HASH(0x5194740), CODE(0x3434ed0)) called at /usr/local/share/perl5/DBIx/Class/Storage/DBI.pm line 850

        DBIx::Class::Storage::DBI::dbh_do(undef, undef, "SELECT SUBSTR(ME.CDD_DOCUMENT,1,3)( cdd_document ) FROM page "..., ARRAY(0x523e650), ARRAY(0x5266bf0)) called at /usr/local/share/perl5/DBIx/Class/Storage/DBI.pm line 1815

        DBIx::Class::Storage::DBI::_execute(DBIx::Class::Storage::DBI::SQLite=HASH(0x42357d0), "select", ARRAY(0x52432b0), ARRAY(0x52afdc0), undef, HASH(0x523e620)) called at /usr/local/share/perl5/DBIx/Class/Storage/DBI.pm line 2376

        DBIx::Class::Storage::DBI::_select(DBIx::Class::Storage::DBI::SQLite=HASH(0x42357d0), ARRAY(0x52432b0), ARRAY(0x52afdc0), undef, HASH(0x5248458)) called at /usr/local/share/perl5/DBIx/Class/Storage/DBI/Cursor.pm line 124

        DBIx::Class::Storage::DBI::Cursor::next(DBIx::Class::Storage::DBI::Cursor=HASH(0x5225640)) called at /usr/local/share/perl5/DBIx/Class/ResultSet.pm line 1346

        DBIx::Class::ResultSet::_construct_results(DBIx::Class::ResultSet=HASH(0x47b6508)) called at /usr/local/share/perl5/DBIx/Class/ResultSet.pm line 1259

        DBIx::Class::ResultSet::next(DBIx::Class::ResultSet=HASH(0x47b6508)) called at t/Dsti-MVN-Index.t line 390

# Looks like your test exited with 2 just after 34.

Debugged program terminated.  Use q to quit or R to restart,

  use o inhibit_exit to avoid stopping after program termination,

  h q, h R or h o to get additional info.

 

Am I missing something?

 

Regards,

 

Roger Day


Notice: This e-mail and any attachments are intended only for the individual or company to which it is addressed and may contain information which is privileged, confidential and prohibited from disclosure or unauthorised use under applicable law. If you are not the intended recipient of this e-mail, you are hereby notified that any use, dissemination or copying of this e-mail or the information contained in this e-mail is strictly prohibited by the sender. If you have received this transmission in error, please return the material received to the sender and delete all copies from your system.

DST Output Limited is a company registered in England and Wales with company number 07262428.
DST Output (Bristol) Limited is a company registered in England and Wales with company number 04220397.
DST Output (Nottingham) Limited is a company registered in England and Wales with company number 04994924.

The registered office for the above mentioned companies is: DST House, St Mark's Hill, Surbiton, Surrey, KT6 4QD.

DST Output (London) Limited is a company registered in England and Wales with company number 02788181.
DSI billing services Limited is a company registered in England and Wales with company number 03823171.

The registered office for the above mentioned companies is: Evolution House, Choats Road, Dagenham, Essex, RM9 6BF.


Notice: This e-mail and any attachments are intended only for the individual or company to which it is addressed and may contain information which is privileged, confidential and prohibited from disclosure or unauthorised use under applicable law. If you are not the intended recipient of this e-mail, you are hereby notified that any use, dissemination or copying of this e-mail or the information contained in this e-mail is strictly prohibited by the sender. If you have received this transmission in error, please return the material received to the sender and delete all copies from your system.

DST Output Limited is a company registered in England and Wales with company number 07262428.
DST Output (Bristol) Limited is a company registered in England and Wales with company number 04220397.
DST Output (Nottingham) Limited is a company registered in England and Wales with company number 04994924.

The registered office for the above mentioned companies is: DST House, St Mark's Hill, Surbiton, Surrey, KT6 4QD.

DST Output (London) Limited is a company registered in England and Wales with company number 02788181.
DSI billing services Limited is a company registered in England and Wales with company number 03823171.

The registered office for the above mentioned companies is: Evolution House, Choats Road, Dagenham, Essex, RM9 6BF.


_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@...
Loading...