::Doc::Design
Dami> ), do some experiments, and find out by yourself.
Or you can ask someone on the list or in the support channel for help
and they'll point you to ways of achieving similar speeds to the ones
posted in the benchmark code,
n the first place, so what's the point? If that is
the only use case in your software, then by all means do *not* use
DBIC. Most useful applications, however, require much more structure
than what a simple join offers.
--
Eden Cardim
+55 11 9644 8225
Shadowcat Systems Ltd.
pproach is generally not recommended because it adds several
maintainance complexities which make it inviable for use in industrial
scale applications (which generally evolve spontaneously from "simple"
applications). It might be worth mentioning that DBIC also suppo
had> database. This will also help avoid tests failing
Fahad> intermittently.
See Test::DBIx::Class for an automated way to do this.
--
Eden Cardim
Code Monkeyhttp://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deploym
Neil's suggestions? I don't argue. Just give me the
Roman> 2 lines of code clue about resultset processors.
You've been pointed to kiokudb twice, and I've detailed Neil's other
suggestion in this message and the previous one. To summarize, your
model is botched and
g
classes magically behind the scenes. You can of course, abstract the
objects and not make any assumptions about the specific classes of the
objects you're working with, but then what's the benefit of reblessing?
You're better off by creating three tables, a person table, and
w
en now but a warning is issued by
Roman> Class::Inspector)
Roman> I appreciate any comment
https://metacpan.org/module/DBIx::Class::KiokuDB does exactly what
you're trying to implement.
--
Eden Cardim
Code Monkeyhttp://www.shadowcat.co.uk/catalyst/
Shadowc
isn't really the best you can get in performance.
--
Eden Cardim Need help with your Catalyst or DBIx::Class project?
Code Monkeyhttp://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://blog.edencard
ment $_[0] is
| updated, the corresponding argument is updated
`
This means that assigning to $_[0] modifies the scalar within the caller
scope. It's done that way so you get a new object in the Data::Dumper
scope without stomping your original object.
--
Eden Cardim Need help
8190_01/lib/DBIx/Class/Relationship/Base.pm
Although I'm not sure what the current state of that feature is.
Also, why don't you just normalize your emails field into a table so you
can benefit from the vanilla joins available in DBIC?
--
Eden Cardim Need help wit
7;s bad idea).
What's a "complex order by"? Can you provide code examples using both
DBIC, and the equivalent SQL you're expecting to obtain?
--
Eden Cardim Need help with your Catalyst or DBIx::Class project?
Code Monkeyhttp://www.shadowcat.co.uk/ca
>>>>> "Alex" == Alex Povolotsky writes:
Alex> Good; how can I set default cache_time for all searches
Alex> without explicit cache_time?
Have a look at the resultset_attributes method in
DBIx::Class::ResultSource.
--
Eden Cardim Need help wi
dorian> multiples
"uses multiples"? what do you mean?
dorian> unless I do something like set the offset to $x and collect
dorian> as many pages as $x*$y >= $z, but that is dumb.
Huh?
dorian> Did I miss something?
Yes, the actual requirement with a use-case and sampl
a lot of other
languages) for
Kaare> functions.
No-brainer here I think. Yes, I'd very much like all of the software
components I'm using to do as much work as possible for me, that way I
can deliver early.
--
Eden Cardim Need help with your Catalyst or DBIx::Class projec
e mysql warns you of absolutely
nothing is when an integer overflow occurs, I've lost one too many hours
of my life and sanity debugging those cases.
--
Eden Cardim Need help with your Catalyst or DBIx::Class project?
Code Monkeyhttp://www.shadowcat.co.uk/cat
to the
$schema object, it'll be connected, you don't have to connect once for
every query.
--
Eden Cardim
Software Engineer
Shadowcat Systems Ltd.
http://www.shadowcat.co.uk
http://blog.edencardim.com
___
List: http://lists.scsys.co
n example.
Does
--8<---cut here---start->8---
$rs->search(\[ 'YEAR(date_of_birth) < ?', $year ]);
--8<---cut here---end--->8---
work for you?
Chris> The SQL::Abstract documen
]
my $schema = My::Schema->autoconnect;
--8<---cut here---end--->8---
solve the problem for you? I'd still recommend the former aproach.
--
Eden Cardim
Software Engineer
Shadowcat Systems Ltd.
http://www.shadowcat.co.uk
http://blog.edencardim.com
mst-signed advertisement). There are plenty of ways to optimize the raw
DBIC methods/accessors.
--
Eden Cardim
Software Engineer
Shadowcat Systems Ltd.
http://www.shadowcat.co.uk
http://blog.edencardim.com
___
List: http://lists.scsys.co.uk/cgi-bin/mai
thought-provoking impulse advise is much appreciated.
$rs->search({ 'LOWER(me.my_col)' => 'my search string' })
--
Eden Cardim
Software Engineer
Shadowcat Systems Ltd.
http://www.shadowcat.co.uk
http://blog.edencardim.com
ue of the column via get_column.
Relying on get_column impoverishes your API, with a specific per-column
accessor it's much easier to install hooks/extensions.
--
Eden Cardim
Software Engineer
Shadowcat Systems Ltd.
http://www.shadowcat.co.uk
http://blog.edencardim.com
_
I
Seth> calls.
Don't use different API calls then, use a single API, validate there and
make all the other components talk to it. Depending on what you need,
even a simple method modifier like override/around applied to the
accessor can do the trick.
--
Eden Cardim
Software Engin
7;m also looking for a good way to validate the incoming data for
Seth> certain columns. Again, I was hoping using MooseColumns would allow
me
Seth> to use Moose's type system, but since the accessors don't get called
for
Seth> some common DBIx::Class methods the
;check" logic in each resultset class
appropriately.
Of course, this doesn't work for multiple joins, and I'd suggest a view
for that anyway.
--
Eden CardimNeed help with your perl Catalyst or DBIx::Class
project?
Software Engineer
gt;related_resultset('label')->check_deleted;
->resultset('CD')->related_resultset('tracks')->check_deleted;
and you'd implement check_deleted() on RS::Label and RS::Track without
having to know whether 'CD' is joined or not.
--
t;search({ "$alias.id" => $id } );
Bill> }
Yes, there's a method for that though, $rs->current_source_alias
--
Eden CardimNeed help with your perl Catalyst or DBIx::Class
project?
Software Engineer http://www.shadowcat.co.uk/cataly
n> folder. However I recently came across this Tutorial
Gurunandan> that advises:
This will not make the method be available in both classes, and the
requirement of a custom method being magically available in both classes
makes no sense without more detail. Can you explain what you'
ltSet::Books
Oleg> \My::Schema::ResultSet::Authors
Result/ResultSet are just default namespaces, you can customize the
namespace you want and even provide multiple namespaces, which will
fulfil the requirements of the OP. See the doc for load_namespaces() in
DBIx::Class::Schema.
--
Eden
> $r->id,
Tiziano> group_desc => $r->group_desc, group_name => $r->group_name,
Tiziano> cansee => defined $r->{role_id} ? JSON::XS::true :
Tiziano> JSON::XS::false }; Thanks guys!
try:
$rs->search({},{ '+select' => [qw(role
> "Octavian" == Octavian Rasnita writes:
Octavian> What do you think it is the preferable way of passing the
Octavian> parameters to the custom methods defined in the ResultSet
Octavian> class for other more complex methods like ->search(),
Octavian> update(), create(), update
> "John" == John Napiorkowski writes:
John> I generally try to do this as well, however I find that doing
John> this for simple finds on primary keys gets a bit tedious, and
John> frankly I wonder if I'm not wasting time and adding to
John> complexity. Would be interested in
> "Drew" == Drew Taylor writes:
Drew> I had thought in the past about where to separate the business
Drew> logic. Do I do it in MyApp::Hotel or
Drew> MyApp::Schema::Result::Hotel? Obviously canned queries go in
Drew> MyApp::Schema::ResultSet::Hotel, but where's the dividing l
> "BUCHMULLER" == BUCHMULLER Norbert writes:
BUCHMULLER> So I came up with a more minimalistic approach that only
BUCHMULLER> solves the above two problems and nothing else:
BUCHMULLER> 1. it installs Moose accessors on the Result (Row)
BUCHMULLER> objects that perform get_col
> "Chris" == Chris Cole writes:
Chris> Oh, right. This is a locked down server that is only
Chris> accessible from within the building. The database is being
Chris> used for research purposes with no sensitive data, so hacking
Chris> is not a real problem.
Chris> Plus, th
en designing new
applications it's recommendable that you stay away from methods that
imply knowledge of your store architecture (such as create, update,
search and insert).
--
Eden Cardim Need help with your Catalyst or DBIx::Class project?
Code Monkey
ails
[ snip ]
> with ParamValues: 0='HASH(0xb57f080)', 1='66'] at
You're attempting to insert a hashref into the database, fix your
->create() call
--
Eden Cardim Need help with your Catalyst or DBIx::Class project?
Code Monkeyhttp://www.shadow
On 18/03/2010, at 08:47, Андрей Костенко
wrote:
No, because I make query one time and use accessors for many
operations. A lot of NYTProf cals tell me, that
Class::Accessor::Grouped::get_inherited is the slowest part in my
applications.
In that case, you need to inflate to a faster data str
>>>>> "Dermot" == Dermot writes:
Dermot> Oh! Should I be using the name of the accessor_name from the
Dermot> belongs_to?
Precisely, if it's a "belongs_to" you want to pass it a hashref, if it's
a "has_many" you want to pa
change this to
__PACKAGE__->belongs_to( "contributor", "MyAPP::Schema::Contributors",
{ contributor_id => "contributor_id" },
);
To avoid confusion between the contributor relationship and the
contributor_id column.
--
Eden Cardim Need help with
y cascade into related tables?
No, you're just doing it wrong, try:
my $row = $schema->resultset('Products')->find_or_create(
{
distribution => 1,
caption => 'Earth',
contributor => { code => $var, name => $name }
}
);
TICREATE_DEBUG environment variable set to
a true value then show us the result along with the table class declarations
(verbatim, all of it).
--
Eden Cardim Need help with your Catalyst or DBIx::Class project?
Code Monkeyhttp://www.shadowcat.co.uk/catalyst/
ead.
Phillip> Do I need to force a query of every possible column for
Phillip> each row, to ensure that lazy population doesn't result in
Phillip> missing data in my SQLite copy of the data?
If you don't mess with 'select' in evil ways, you're good.
> "Alan" == Alan Humphrey writes:
Alan> Hi - If I try to sort by a column in a joined table in a MSSQL
Alan> database AND limit the number of rows, the generated SQL is
Alan> bad. Here's the code:
Alan> my $result =
Alan> $schema->resultset('SurveyorsSurveySites')->searc
In raw SQL it needs name condition to be placed in LEFT JOIN:
>
> SELECT *
> FROM users AS u
> LEFT JOIN attributes AS a
> ON u.id=a.users_id
> AND a.name="car"
> WHERE a.users_id IS NULL
>
> How to force DBIx::Class to add this
>
> AND a.
On Tue, Sep 15, 2009 at 1:05 AM, Eden Cardim wrote:
> while(my $year = $year->next) { do_something($year) }
erm, actually:
while(my $year = $year_cols->next) { do_something($year) }
--
Eden Cardim Need help with your Catalyst or DBIx::Class project?
Co
> [ { YEAR => 'date' }], as =>
['year'], distinct => 1 });
my $year_cols = $years->get_column('year'); # returns a
DBIx::Class::ResultSetColumn
while(my $year = $year->next) { do_something($year) }
--
Eden Cardim Need help with your Catalyst
od with a different name in the target class,
then declare a proxy to that?
--
Eden Cardim Need help with your Catalyst or DBIx::Class project?
Code Monkeyhttp://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platf
bar' ]". Look at how Moose does this.
Once DBIC migrates to Moose we should get all of this relatively transparently.
> 3) Different DBMSes have different types. So, maybe producer-specific
> validations would be helpful (q.v. #1).
For Moose I'd make the storage class loa
tures, do your development, then load the fixtures on the
remote server and run the tests to fix any incompatibilities.
--
Eden Cardim Need help with your Catalyst or DBIx::Class project?
Code Monkeyhttp://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Wan
app's search
conditions.
> Also, where is the hash describing a column documented besides the Intro?
DBIx::Class::ResultSource
--
Eden Cardim Need help with your Catalyst or DBIx::Class project?
Code Monkeyhttp://www.shadowcat.co.uk/catalyst/
Shadowcat Sys
hink you need DBIx::Class::Schema::RestrictWithObject
--
Eden Cardim Need help with your Catalyst or DBIx::Class project?
Code Monkeyhttp://www.shadowcat.co.uk/catalyst/
Shadowcat Systems Ltd. Want a managed development or deployment platform?
http://edenc
On Mon, Jul 21, 2008 at 4:59 AM, Moritz Onken <[EMAIL PROTECTED]> wrote:
> But how can I rewrite my query to the other format without writing the raw
> sql where clause?
> Why is it not possible to write my query with as scalar ref:
>
> $rs->search({
> -and =>
>[
> {\"extract(year from age
On Tue, Jul 15, 2008 at 9:59 AM, Andreas Pronakis <[EMAIL PROTECTED]> wrote:
> Is this possible/worth exploring?
>
> Does anyone know which parts of DBIC would/potentially need to be sub-classed
> to achieve this?
>
> Has anyone attempted something like this before? If so how did they go about
>
On Mon, Apr 7, 2008 at 2:33 PM, Emily Heureux <[EMAIL PROTECTED]> wrote:
> Hi, I have a resultset call like this in my Catalyst application:
> $rs = [$c->model('DB::Table1)->search(
>
> { …
>
> },
>
> { join => [ …]
>
> }
>
> )];
> The reason
54 matches
Mail list logo