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

How do I create a GiST index on a PostGIS geometry column using DBIx::Class?

I have a Postgres + PostGIS database with geometry columns. I would like to add indices to them, e.g. create index plot_idx_location on plot using gist (location); I know how to create indices in DBIx::Class using the sqlt_deploy_hook method, but I…
Rob
  • 781
  • 5
  • 19
0
votes
2 answers

perl waring : "Use of unintitialized value in string ne" for condition check for column with the null value

I am trying to fetch certain column from a table , some of the column might have the null value.Hence before filling my main data, I am checking the hash for null value.As some of the key is having null value and giving warning. Is there any way to…
made_in_india
  • 2,109
  • 5
  • 40
  • 63
0
votes
1 answer

Is there any way to filter a column using SQL functions in Perl's DBIx::Class?

I am using a PostgreSQL database with PostGIS geometry columns. I would like to configure the Result classes so that geometry columns are inflated using the ST_AsEWKT function and deflated using the ST_GeomFromEWKT function. Is there a way to do…
Rob
  • 781
  • 5
  • 19
0
votes
1 answer

Construct DBIx::Class object and related objects but save later

I would like to construct a DBIx::Class object and its related objects but defer saving the object, calling the insert method on the object later and at that time have everything saved all at once. Here is example code based on the examples from the…
rlandster
  • 7,294
  • 14
  • 58
  • 96
0
votes
1 answer

Converting SQL query

I have an SQL query which is fetching me the data correcting from sqlplus. When I try to convert the query such that I can implement in the catalyst controller, I am getting an error message saying there is no relation between the tables Feature and…
0
votes
3 answers

dbix::class generate schema for a non-catalyst app

I've been building Catalyst apps lately and one thing I love is using Catalyst's create script to easily generate the table schemas for DBIx::Class. I'd like to be able to use DBIX::Class without having to write the schemas for my tables manually.…
srchulo
  • 5,143
  • 4
  • 43
  • 72
0
votes
1 answer

How would I write this query with DBIX::Class?

I've seen a few other questions on Stackoverflow that discuss sub-selects, but they usually relate to the use of multiple tables. In most cases, a proper join could serve the same purpose. However my query below refers to a single table. How would…
jbobbylopez
  • 257
  • 2
  • 6
  • 15
0
votes
2 answers

Perl DBI - transfer data between two sql servers - fetchall_arrayref

I have 2 servers: dbh1 and dbh2 where I query dbh1 and pull data via fetchall_arrayref method. Once I execute the query, I want to insert the output from dbh1 into a temp table on server dbh2. I am able to establish access to both servers at the…
zad0xlik
  • 183
  • 1
  • 4
  • 14
0
votes
1 answer

dbix::class modify column data before update or insert

I am using dbix::class along with catalyst to interact with my database. However, some of the data that I am storing is sensitive so I would like to encrypt in before it goes into the database (is inserted or updated) and decrypt it when it comes…
srchulo
  • 5,143
  • 4
  • 43
  • 72
-1
votes
1 answer

how to generate schema without column info (I just want the column names) using DBIx::Class::Schema::Loader

I want to use DBIx::Class::Schema::Loader to generate the schema from Oracle database. My code is below. My question is how to generate the schema without column info . I just want the column names. #============== generate code…
-1
votes
2 answers

Can't call method "model" on an undefined value at

I have been building catalyst apps of a number of years now. This is the first time I am getting an error trying to open a view. When I call the view (there is only one view), I get the following error: Can't call method "model" on an undefined…
Phil
  • 1
  • 1
-1
votes
1 answer

How to use Catalyst to search, select and display entries from my database

I have to use Catalyst in order to create a database and access it through a browser. I have created a very simple database using DBIx-class and sqlite, just one table and filled it with some records. I have managed to display the whole table and…
-2
votes
1 answer

SQL Transformation

I have a properly working query select A.*, B.* from A left join B on A.id = B.id and B.country = 'USA' Now with left join I can put only 1 condition ( A.id = B.id). So I have to put B.country = 'USA' part somewhere else. Is there any workaround?…
aartist
  • 3,145
  • 3
  • 33
  • 31
-2
votes
2 answers

Sorting a table according to another table

I have a table A. |----+----| | P | S | |----+----| | p1 | 1 | | p2 | 7 | | p3 | 14 | | p4 | 23 | | p5 | 1 | |----+----| and table B |----+----| | S | C | |----+----| | 1 | 21 | | 5 | 21 | | 23 | 21 | | 1 | 30 | | 7 | 90…
aartist
  • 3,145
  • 3
  • 33
  • 31
-2
votes
1 answer

Connect to a DBIx::Class database without repeating the connection details?

DBIx::Class::Manual::Intro suggests connecting to the database as follows my $schema = MyApp::Schema->connect(...) explicitly providing connection details such as the password. I want to connect to the same database from multiple different scripts,…
porton
  • 5,214
  • 11
  • 47
  • 95
1 2 3
25
26