Re: [Dbix-class] Search and Delete with Single Query

2014-08-29 Thread Sheeju Alex
I tried -delete and -delete_all both operation was deleting one by one. The version of DBIx::Class is 0.08250 You guessed right :) I had changed the table name but the code is no different, here is the code and schema definition of $rs $schema-resultset('AlertParameterValue')-search({ProfileId =

Re: [Dbix-class] Search and Delete with Single Query

2014-08-29 Thread William Cox
Read the documentation for PgLog: https://metacpan.org/pod/DBIx::Class::ResultSet::PgLog#delete - it forces -delete_all behavior On Fri, Aug 29, 2014 at 2:41 PM, Sheeju Alex sheeju...@gmail.com wrote: I tried -delete and -delete_all both operation was deleting one by one. The version of

Re: [Dbix-class] Search and Delete with Single Query

2014-08-29 Thread Sheeju Alex
Thanks William.. I checked everywhere else completely forgot about PgLog :) I will debug and try to fix at PgLog module, my expectation of PgLog was to use it only if the query is wrapped around with txn_do. Best Regards, Sheeju Alex On Sat, Aug 30, 2014 at 6:02 AM, William Cox

[Dbix-class] Search and Delete with Single Query

2014-08-28 Thread Sheeju Alex
Hi All, Is there any way in DBIx to delete all rows from resultset in a single query, it looks like delete and delete_all will delete the resultset row by row. my $rs = $schema-resultset('User')-search({GroupId = 712}); $rs-delete_all; If there are 100 Users in User table then the above

Re: [Dbix-class] Search and Delete with Single Query

2014-08-28 Thread Will Crawford
$schema-resultset('User')-search({GroupId = 712})-delete; On 28 August 2014 13:01, Sheeju Alex sheeju...@gmail.com wrote: Hi All, Is there any way in DBIx to delete all rows from resultset in a single query, it looks like delete and delete_all will delete the resultset row by row. my

Re: [Dbix-class] Search and Delete with Single Query

2014-08-28 Thread Sheeju Alex
No This doesn't work since DBIx converts this into below quries SELECT * FROM User WHERE GroupId = 712; SELECT * FROM User WHERE Id = 1; DELETE FROM User WHERE Id = 1; SELECT * FROM User WHERE Id = 2; DELETE FROM User WHERE Id = 2; SELECT * FROM User WHERE Id = 3; DELETE FROM User WHERE Id = 3;

Re: [Dbix-class] Search and Delete with Single Query

2014-08-28 Thread Spevak, Martin (HPES Network Management Solutions)
You must have something wrong in DBIx relationship, many be in part: { is_deferrable = 1, on_delete = CASCADE, on_update = CASCADE }, try this: my $sql = $schema-resultset('User')-search({GroupId = 712}); $schema-resultset('User')-search({ Id = { IN = $sql-get_column('Id')-as_query },

Re: [Dbix-class] search on row-has_many fails if row has prefetch join after 0.08196 - 0.08206 upgrade

2013-02-23 Thread Peter Rabbitson
On Sat, Feb 23, 2013 at 03:58:20AM +1100, Peter Rabbitson wrote: On Fri, Feb 22, 2013 at 04:46:46PM +, Chisel wrote: At work we had to freeze our DBIC at 0.08196 until the prefetch/namespace bug was fixed ... which it was recently. Internally we've built the new perl+cpandeps RPM

[Dbix-class] search on row-has_many fails if row has prefetch join after 0.08196 - 0.08206 upgrade

2013-02-22 Thread Chisel
At work we had to freeze our DBIC at 0.08196 until the prefetch/namespace bug was fixed ... which it was recently. Internally we've built the new perl+cpandeps RPM including DBIx::Class 0.08206. Things are looking great for the prefetch/namespace fix but something has come to light this week that

Re: [Dbix-class] search on row-has_many fails if row has prefetch join after 0.08196 - 0.08206 upgrade

2013-02-22 Thread Peter Rabbitson
On Fri, Feb 22, 2013 at 04:46:46PM +, Chisel wrote: At work we had to freeze our DBIC at 0.08196 until the prefetch/namespace bug was fixed ... which it was recently. Internally we've built the new perl+cpandeps RPM including DBIx::Class 0.08206. Things are looking great for the

Re: [Dbix-class] search on row-has_many fails if row has prefetch join after 0.08196 - 0.08206 upgrade

2013-02-22 Thread Chisel
On Fri, Feb 22, 2013 at 4:58 PM, Peter Rabbitson rabbit+d...@rabbit.us wrote: The test is comprehensive enough, no further questions. It would be great if you could convert it to a DBIC-internal test, for example based off of:

[Dbix-class] Search::Query::Dialect::DBIxClass

2012-10-29 Thread Alexander Hartmaier
I've just released Search::Query::Dialect::DBIxClass to CPAN [1]. It uses Search::Query to parse a query string and transforms it into a hashref than can be passed to $rs-search(_rs). The Search::Query::Parser synopsis shows the valid operators and prefixes. You can use it to enable users to

[Dbix-class] search any matching word in given string in table column which has only one word

2012-08-11 Thread Rajeev Prasad
here is given string of type:...   as23,rt54,yh79 and i have to lookup in a table which has column id which has only one four letter word. i have to select that row in which the colum 'id' value matches any of the word in given string... table column: id contents like: | id| |sd32| |wa32|

Re: [Dbix-class] search any matching word in given string in table column which has only one word

2012-08-11 Thread Rodrigo
Maybe something like this will do: my $str = 'as23,rt54,yh79'; $schema-resultset('MyTable') -search({ id=[ split /,/ = $str ] }); regards, rodrigo On Sat, Aug 11, 2012 at 6:05 PM, Rajeev Prasad rp.ne...@yahoo.com wrote: here is given string of type:... as23,rt54,yh79 and i have to

Re: [Dbix-class] search any matching word in given string in table column which has only one word

2012-08-11 Thread Rajeev Prasad
: [Dbix-class] search any matching word in given string in table column which has only one word Maybe something like this will do: my $str = 'as23,rt54,yh79'; $schema-resultset('MyTable')    -search({ id=[ split /,/ = $str ] }); regards, rodrigo On Sat, Aug 11, 2012 at 6:05 PM, Rajeev Prasad

RE: [Dbix-class] Search with complex joins generating bad SQL

2010-04-06 Thread Byron Young
-Original Message- From: Peter Rabbitson [mailto:rabbit+d...@rabbit.us] Sent: Monday, April 05, 2010 8:41 PM To: DBIx::Class user and developer list Subject: Re: [Dbix-class] Search with complex joins generating bad SQL On Mon, Apr 05, 2010 at 10:55:08AM -0700, Byron Young wrote

Re: [Dbix-class] Search with complex joins generating bad SQL

2010-03-30 Thread Peter Rabbitson
Byron Young wrote: Hello, I have a search that's generating SQL that causes MySQL to barf. I'm using DBIC v0.08120. Here is the search call: $schema-resultset(Results)-search({ 'hostname_2.name' = { '=' = 'gen-cs167' } }, { join = [

[Dbix-class] Search with complex joins generating bad SQL

2010-03-29 Thread Byron Young
Hello, I have a search that's generating SQL that causes MySQL to barf. I'm using DBIC v0.08120. Here is the search call: $schema-resultset(Results)-search({ 'hostname_2.name' = { '=' = 'gen-cs167' } }, { join = [ {

Re: [Dbix-class] Search condition on integer data-type column

2010-03-23 Thread Rob Kinyon
2010/3/23 Hetényi Csaba csabiw...@tata.hu:   my $rs = $c-model('DB::Users')-search(       {           nem = $nem,           megye = $megye,       },   ); BUT, if the user wants to see all of the rows (but the 'nem' clause still applied) what have to put in $megye? (i tried LIKE, %

[Dbix-class] Search condition on integer data-type column

2010-03-23 Thread Hetényi Csaba
Dear Members I look for info about in subject. I have a table, which has an integer data-type column (in the example: megye). I'd like to search for specific value (for ex.: nem = 1, megye = 5) and it works perfectly with the following code : my $rs = $c-model('DB::Users')-search(

Re: [Dbix-class] Search condition on integer data-type column

2010-03-23 Thread Hetényi Csaba
Thank You Rob, it is exactly what i want! Works perfectly :) Now it is clear, that i'm an absolute beginner :) Rob Kinyon írta: 2010/3/23 Hetényi Csaba csabiw...@tata.hu: my $search_clause = { nem = $nem }; if ( $megye ) { $search_clause-{megye} = $megye; } my $rs =

Re: [Dbix-class] Search condition on integer data-type column

2010-03-23 Thread Alexander Hartmaier
I'd chain resultsets, that's exactly what the feature it was built for: my $rs = $c-model('Users')-search({ nem = $nem }); if ( $megye ) { $rs = $rs-search({ megye = $megye }); } -- Best regards, Alex Am Dienstag, den 23.03.2010, 15:31 +0100 schrieb Hetényi Csaba: Thank You Rob, it is

[Dbix-class] search NOT IN

2009-07-06 Thread Stuart Dodds
Is it possible to do a search on a field where it is not equal to a list of values. For example, the sql I would like to produce is as follows: WHERE id NOT IN (?,?,?) however doing: -search({ id = { '!=', \...@id_list } }); doesn't do the right thing as you get: WHERE id != ? OR id != ?

Re: [Dbix-class] search NOT IN

2009-07-06 Thread Ash Berlin
Stuart Dodds stu...@doddsweb.co.uk wrote: Is it possible to do a search on a field where it is not equal to a list of values. For example, the sql I would like to produce is as follows: WHERE id NOT IN (?,?,?) however doing: -search({ id = { '!=', \...@id_list } }); doesn't do the right

Re: [Dbix-class] -search oddity with superfluous parameters

2008-05-29 Thread Matt S Trout
On Thu, May 15, 2008 at 09:54:45PM +0100, Aaron Crane wrote: This works: my $rs = $schema-resultset('CD')-search( { artist = 1 }, { order_by = 'id' }, ); Oddly, so does this: my $rs = $schema-resultset('CD')-search( { artist = 1 }, undef,

[Dbix-class] -search oddity with superfluous parameters

2008-05-15 Thread Aaron Crane
This works: my $rs = $schema-resultset('CD')-search( { artist = 1 }, { order_by = 'id' }, ); Oddly, so does this: my $rs = $schema-resultset('CD')-search( { artist = 1 }, undef, { order_by = 'id' }, ); I'm finding it hard to imagine

[Dbix-class] search() returning REFs

2008-02-18 Thread Paul Makepeace
It seems that a search() is returning an array of \bless'ed instead of bless'ed objects. I'm putting in a die to dump out am example: Caught exception in IDL::Web::Controller::SP::Companies-edit SPC: REF(0xa9328f4) = REF at

Re: [Dbix-class] search() returning REFs

2008-02-18 Thread Matthias Zeichmann
On Feb 18, 2008 4:12 PM, Paul Makepeace [EMAIL PROTECTED] wrote: It seems that a search() is returning an array of \bless'ed instead of bless'ed objects. I'm putting in a die to dump out am example: Caught exception in IDL::Web::Controller::SP::Companies-edit SPC: REF(0xa9328f4) = REF at

Re: [Dbix-class] search() returning REFs

2008-02-18 Thread Robert Sedlacek
On Monday 18 February 2008 16:12:24 Paul Makepeace wrote: It seems that a search() is returning an array of \bless'ed instead of bless'ed objects. I'm putting in a die to dump out am example: Caught exception in IDL::Web::Controller::SP::Companies-edit SPC: REF(0xa9328f4) = REF at

Re: [Dbix-class] search() returning REFs

2008-02-18 Thread Paul Makepeace
On 2/18/08, Matthias Zeichmann [EMAIL PROTECTED] wrote: On Feb 18, 2008 4:12 PM, Paul Makepeace [EMAIL PROTECTED] wrote: It seems that a search() is returning an array of \bless'ed instead of bless'ed objects. I'm putting in a die to dump out am example: Caught exception in

[Dbix-class] Search like + autocomplete

2008-02-01 Thread Ashley
I asked a long time back about engine specific escape sequences to sanitize LIKE queries. I got pointed to a neat snippet from the DBI docs but mostly heard don't use search (or search_like). $esc = $dbh-get_info( 14 ); # SQL_SEARCH_PATTERN_ESCAPE $search_pattern =~