Questions tagged [class-dbi]
15 questions
7
votes
3 answers
What is the future of Class::DBI?
Does anyone know what is the status of Class::DBI? I see that it was last updated on 4 October 2007, is anyone still working on this project or is it just left to die? Thank you.

marghi
- 233
- 1
- 9
5
votes
2 answers
How can I do an update in Class::DBI without selecting a record first?
To do an insert with Class::DBI, you can simply do:
my $object = Object::DB->insert({ a => 1, b => 2, c => 3, ...});
But there is no such thing for update. The best I could come up with is selecting the record first then updating it:
my $object =…

Julien
- 5,729
- 4
- 37
- 60
3
votes
3 answers
Is there a way to caching mechanism for Class::DBI?
I have a set of rather complex ORM modules that inherit from Class::DBI. Since the data changes quite infrequently, I am considering using a Caching/Memoization layer on top of this to speed things up. I found a module: Class::DBI::Cacheable but no…

Gurunandan Bhat
- 3,544
- 3
- 31
- 43
3
votes
3 answers
How do I use add_to in Class::DBI?
I'm trying to use Class::DBI with a simple one parent -> may chidren relationships:
Data::Company->table('Companies');
Data::Company->columns(All => qw/CompanyId Name Url/);
Data::Company->has_many(offers => 'Data::Offer'=>'CompanyId'); #…

Julien
- 5,729
- 4
- 37
- 60
3
votes
1 answer
Perl class::dbi - multiple connections
I have a class library I have developed over the last few years that uses Perl's Class::DBI to wrap a relational database (the DB scheme for Prestashop, not that that matters)
Is anyone aware of anyway in a single perl script to create multiple…

James Hobson
- 193
- 2
- 8
3
votes
1 answer
Moving from Class::DBI to DBIx::Class
I'm currently doing some research on DBIx::Class in order to migrate my current application from Class::DBI. Honestly I'm a bit disappointed about the DBIx::Class when it comes to configuring the result classes, with Class::DBI I could setup…

marghi
- 233
- 1
- 9
2
votes
1 answer
How do you insert binary data into a BLOB column with Class::DBI?
I want to create a new object using Class::DBI. One of the fields of this object is a BLOB type. I have a filehandle I want to use for this data, but apparently, just doing this doesn't work:
my $item = My::Class::DBI::Class->insert({
foo …

pkaeding
- 36,513
- 30
- 103
- 141
2
votes
4 answers
How can I clear Class::DBI's internal cache?
I'm currently working on a large implementation of Class::DBI for an existing database structure, and am running into a problem with clearing the cache from Class::DBI. This is a mod_perl implementation, so an instance of a class can be quite old…

Jack M.
- 30,350
- 7
- 55
- 67
2
votes
2 answers
Is it possible to obtain the SQL statements generated by Class::DBI?
I want to find the exact SQL statements that are generated by a Perl ORM package such as Class::DBI. I am not looking for SQL generated for simple inserts and deletes, but for row modifications that result from slightly complicated object…

Gurunandan Bhat
- 3,544
- 3
- 31
- 43
2
votes
2 answers
How do I access a specific return value from the CDBI::Search function?
I am using a DB::CDBI class for accessing the database in our application. Our project is in object-oriented Perl.
package LT::LanguageImport;
use strict;
use warnings;
use base 'Misk5::CDBI';
__PACKAGE__->table( 'english_text_translation'…

Ash_and_Perl
- 356
- 5
- 21
1
vote
0 answers
How to use Class:DBI with own constructors or OO-systems like Moo(se)?
When using Class::DBI in Perl, the insert() method from Class::DBI acts as a constructor returning an object. How can I use Class::DBI in combination with object attributes that are not part of any database tables?
For example: I would like to have…

ilonw
- 19
- 1
1
vote
1 answer
Class::DBI - does it load all tables?
We have a MySQL database with very big number of tables. Unfortunately in 2018 we still use Perl CGI. So loading time of a script is essential.
DBIx::Class was ruled out by me because it loads about 1.6 sec (so long because it loads Perl definitions…

porton
- 5,214
- 11
- 47
- 95
1
vote
2 answers
How do I override autogenerated accessors in Perl's Class::DBI?
I followed the example at http://wiki.class-dbi.com/wiki/Overriding_autogenerated_accessors
I want to modify the URL before it is inserted to the database:
package Hosting::Company;
use base 'Class::DBI';
my $class =…

Julien
- 5,729
- 4
- 37
- 60
0
votes
1 answer
How to identify whether record was found or created: class::dbi find_or_create
I'm still learning Perl and CLASS::DBI. I have a script that does a bunch of lookups and I only want to insert the new items that are found by the lookups. I created a composite key for username,created_at and I'm using the following code to insert…

McLuvin
- 125
- 2
- 10
-4
votes
1 answer
Sorting Perl with Class::DBI
You have the following table called Pets:
name age pet
------------------------
Carol 25 null
Stean 23 cat
Mel 24 dog
Rich 24 rabbit
In a MySQL database on the server mydbserver with the user of 'user'…

user_falafel
- 27
- 3