Questions tagged [dbix-class]

DBIx::Class is a Perl object-relational mapping (ORM) module. It aims to make representing queries in your code as perl-ish as possible while still providing access to as many of the capabilities of the database as possible, including retrieving related records from multiple tables in a single query, JOIN, LEFT JOIN, COUNT, DISTINCT, GROUP BY, ORDER BY and HAVING support.

from the description on CPAN:

This is an SQL to OO mapper with an object API inspired by Class::DBI (with a compatibility layer as a springboard for porting) and a resultset API that allows abstract encapsulation of database operations. It aims to make representing queries in your code as perl-ish as possible while still providing access to as many of the capabilities of the database as possible, including retrieving related records from multiple tables in a single query, JOIN, LEFT JOIN, COUNT, DISTINCT, GROUP BY, ORDER BY and HAVING support.

DBIx::Class can handle multi-column primary and foreign keys, complex queries and database-level paging, and does its best to only query the database in order to return something you've directly asked for. If a resultset is used as an iterator it only fetches rows off the statement handle as requested in order to minimise memory usage. It has auto-increment support for SQLite, MySQL, PostgreSQL, Oracle, SQL Server and DB2 and is known to be used in production on at least the first four, and is fork- and thread-safe out of the box (although your DBD may not be).

377 questions
0
votes
1 answer

DBIC generates an "Invalid precision" error for a primary key

The table stores file names. The primary key is an auto-incrementing integer. A search using the result set works. And calling the delete method generates the following error message: DBIx::Class::Relationship::CascadeActions::delete(): DBI…
Robert Wohlfarth
  • 1,761
  • 11
  • 10
0
votes
1 answer

DBIX class array of rows

How can I convert DBIX::Class resulset returned by a search call, into a plain array of hashes or array of arrays. I mean each row as an array/hash collected into an array.
bvnbhati
  • 382
  • 4
  • 17
0
votes
1 answer

how to find the union of an unknown number of resultsets in DBIC?

Hi I am using the Helper::ResultSet::SetOperations libraries to find the union and intersection of some resultsets. If I know the number of the resultsets then things work fine, however I'm trying to get it to work for an unknown number of…
user1768233
  • 1,409
  • 3
  • 20
  • 28
0
votes
2 answers

DBIX::Class subclassing result class

I am trying to use a common base class for multiple result classes in DBIX::Class. Reason is - I have few tables with same structure but different names. Here is my base class use utf8; package myapp::Schema::tablebase; use strict; use…
bvnbhati
  • 382
  • 4
  • 17
0
votes
1 answer

DBIX Class- same result class for multiple tables

I have many tables in my database which have the same structure. I want to create a common result class (package DBIx::Class) for that set of tables and use the same class for all by somehow changing the table name on the fly. How can I do…
bvnbhati
  • 382
  • 4
  • 17
0
votes
1 answer

Can I join the column names with search_related in DBIx?

I have a DBIx Class schema where I have; A Device that has many Interfaces An Interface has many Rules Applied Each Rule has many Rule Entries. I want to search for all of the Rule Entries for a Particular device name and Rule Name. I am still…
user1768233
  • 1,409
  • 3
  • 20
  • 28
0
votes
2 answers

How can you modify a DBIx::Class::Row in place?

Using DBIx::Class::ResultSet is it possible to make changes to the results in memory as attempted below? my @results = $self->search(...); for my $result (@results) { my $row = {$result->get_columns}; $row->{fieldname} = 'something…
0
votes
2 answers

perl DBIx::Class converting values with umlaut

I'm using DBIx::Class to fetch data from Oracle (11.2). when the data fetched, for example "Alfred Kärcher" its returns the value as "Alfred Karcher". I tried to add the $ENV NLS_LANG and NLS_NCHAR but still no change. I also used the utf8 module…
loudstil
  • 51
  • 5
0
votes
1 answer

How can you use a DBIx helper with Catalyst?

I would like to use a DBIx resultset helper, namely DBIx::Class::Helper::ResultSet::Random, in my Catalyst application. The package documentation shows how it is loaded from a DBIx::Class::ResultSet class, but as far as I can tell, I have none of…
scozy
  • 2,511
  • 17
  • 34
0
votes
1 answer

Auto Generate Objects in DBIx::Class ORM in Perl

I started learning DBIx::class and I reach the point where you have to create the Objects that represents tables. Should this classes be created manually ( hard coding all the fields and relationships.....) or there is a way to generate them…
Sam
  • 47
  • 7
0
votes
1 answer

How can I use SQL::Abstract's special operators inside DBIx::Class?

I am trying to find a way to use SQL::Abstract's special operators inside DBIx::Class. My goal is to be able to use sqlite's MATCH operator for full text search so that I can do $d->search({ textcontent => { -match => "sqlite" }}) to produce a…
simone
  • 4,667
  • 4
  • 25
  • 47
0
votes
1 answer

Data mapping on Ruby on Rails

Is there a way for ActiveRecord to capture all the data base's fields, including the Pks and FKs? Like what the ORM DBIx::Class script does on Catalyst? Here's a brief description of that: Generate the model using the Catalyst "_create.pl"…
xCanox
  • 1
  • 2
0
votes
2 answers

how can I retrieve records that include *all* in a list, as opposed to *any*?

I have a table, "posts" like so: +----+---------+------------+ | id | author | text | +----+---------+------------+ | 1 | bob | hello | | 2 | jim | hi bob | +----+---------+------------+ and also "tags" like…
FoohonPie
  • 11
  • 1
0
votes
1 answer

Is it possible to use multicreate with many-to-many relationships?

I understand in dbic that many-to-many isn't a real relationship and what I've done up until now is used the add_to_$rel function. Is it possible to structure my many-to-many data in such a way that I can insert it using multicreate? Many thanks
user1768233
  • 1,409
  • 3
  • 20
  • 28
0
votes
2 answers

How do I update schema with DBIC make_schema_at?

I am currently using the DBIC Schema Loader function make_schema_at to dump my existing database into its schema. Once the schema is dumped I generally like to go in and clean up the accessor names in the relationships to read better. However from…
user1768233
  • 1,409
  • 3
  • 20
  • 28