Yes, that is correct. For update_or_create() to work, it needs a way to
find the original row, if it exists.
Ronald
On Thu, Sep 27, 2012 at 1:40 PM, Rajeev Prasad wrote:
> so far, I do not, but I want one filed to be uniq, lets call it field1. so
> should i set a uniq constraint on it, and the
On Thu, Sep 27, 2012 at 12:55 PM, Rajeev Prasad wrote:
> friends,
>
> I have a Table to update (empty right now), and the regularly 'update'
> existing info with changes AND add any new record which come up.
>
> source data is coming from file. one record per line.
>
> my @my_arr; #has 5
On Fri, May 4, 2012 at 12:12 PM, Kenneth S Mclane wrote:
adds the case statement to the sql, but I get an error that "sunset_date"
> is ambiguous. If I specify it as "account.sunset_date" I get
> "account.sunset_date is invalid in the context it is being used in."
>
Try me.sunset_date. See the d
On Thu, Sep 1, 2011 at 5:52 PM, Rajeev Prasad wrote:
> thx.
>
> but when i put search item as 'test12' I get error:
>
>
> $ get-data-from-db.pl
> Use of uninitialized value in concatenation (.) or string at ./
> get-data-from-db.pl line 23.
> user is:
> here is the code again, i think i have defi
On Mon, Jan 24, 2011 at 8:40 AM, Winfried Neessen wrote:
> sub list :Path :Args( 0 )
> {
>
> ## Get object and context
> my ( $self, $c ) = @_;
>
> ## Get ResultSet
> my $rs = $c->model( 'DB::Vorgaenge' );
>
> ## Sort the ResultSet by ID
> my $search
On Tue, Nov 9, 2010 at 8:36 AM, Mike Raynham wrote:
>
> I have created a query which determines if a given date range exists within
> date ranges stored in the database:
>
> ###
>
> # SELECT * FROM my_table WHERE
> # (start_date <= $start_date AND end_date >= $start_date) OR
> # (start_date <= $en
On Wed, Oct 27, 2010 at 10:26 AM, Dave Howorth
wrote:
>
> $ ./create-schema.pl
> Dumping manual schema for QD1x::Schema to directory . ...
> Schema dump completed.
> Failed to reload class QD1x::Schema::Result::EntryAttribute: Can't use
> string ("QD1x::Schema::Result::EntryAttri") as a HASH ref w
On Sat, Oct 2, 2010 at 8:16 PM, Bill Moseley wrote:
> Seems like ->single (and thus find_or_create) should throw an exception if
> more than one row is returned, columns passed to find_or_create must satisfy
> a defined unique constraint, and if a single row is found any non-constraint
> columns
On Fri, Aug 13, 2010 at 10:39 AM, Marc Perez wrote:
> I'm doing the next query:
> my $files = $catVar->model('cmsDB::Files')->search(
> {
> 'me.cmsobj_id' => $this->cmsobj_id,
> -or => [mime_type => 'image/jpeg',mime
On Wed, Aug 11, 2010 at 6:09 PM, Ian Docherty (icydee)
wrote:
> Ignoring for the moment the artists, cds, tracks etc. I could see it
> something like the following. (top of my head, first impressions, probably
> totally borked)
>
> In your application code.
>
>
> my $factory = MyApp::Busines
On Tue, Jun 8, 2010 at 9:09 AM, Chris Cole wrote:
>
> # make SQL search both technical replicates at the same time
> $dataset =~ s/t\d/t%/;
> my $rs = $self->resultset('NgsMappings')->search(
> {
> 'me_sample' => {'like', $dataset},
> },
> {
> columns => [qw/mp
On Mon, Jun 7, 2010 at 6:04 PM, fREW Schmidt wrote:
> On Mon, Jun 7, 2010 at 12:04 AM, Toby Corkindale <
> toby.corkind...@strategicdata.com.au> wrote:
>
>> Only speaking on behalf of myself, but I see:
>>
>> 1) You shouldn't be making db tables or columns based on reserved words
>> anyway, as s
I'm passing a reference to a named hash to update_or_create(). The
resultset has two inflated columns. If the row already exists in the
table, then the keys for the inflated columns are deleted from the hash.
Is this expected behavior? This happens with DBIC 0.08111 and 0.08121.
For exampl
James Marca wrote:
From reading the docs, starting with
http://search.cpan.org/~frew/DBIx-Class-0.08115/lib/DBIx/Class/Storage/DBI.pm#DBIx::Class_specific_connection_attributes
and then linking to http://search.cpan.org/perldoc?DBI#prepare_cached,
I see this for 'prepare_cached':
Like "prepare
Wes Cravens wrote:
In an effort to create strictly sequential (Incrementing Integer no
gaps) primary keys my method has traditionally been:
BEGIN;
LOCK table;
SELECT MAX(id) FROM table;
INSERT INTO table...;
COMMIT;
I'm relatively new to DBIC and have not really seen a way to do this
unless I
Thomas L. Shinnick wrote:
I'm having some of the same questions regarding +select and +as . It
seems that using '+select' and '+as' does not stop other columns from
being returned. I'm using DBIC 0.08115.
What do you expect +select and +as to do??
+select
Indicates additional columns t
Dermot wrote:
2009/12/9 Eden Cardim :
"Dermot" == Dermot writes:
Dermot> Hi, I am getting the following error when I attempt to
Dermot> create a record.
Dermot> DBD::mysql::st execute failed: Duplicate entry '0' for key 3
Dermot> [for Statement "INSERT INTO products ( distributio
I'm currently using the following code in one of my schema modules,
based on the message
http://www.mail-archive.com/dbix-class@lists.scsys.co.uk/msg02613.html
my $new_month = '200905';
my $user_session_source = __PACKAGE__->source('UserSession');
my $new_source = $user_session_source->ne
Morgon Hed wrote:
You can set '+select' and '+as', and stick that in a
resultset method, so
the code just becomes
$stream_rs->with_xml_field->...
Thanks for the reply but I don't quite understand what you are saying.
I can easily do the follwing:
my $s1 = $schema->resultset('Stream')->search
Dermot wrote:
2009/3/18 Ronald J Kimball :
Dermot wrote:
is_nullable => 0 and NOT NULL mean the same thing, don't they?
I think it's one of them there double negatives :)
is_nullable
Set this to a true value for a columns that is allowed to contain
NULL values. This is c
Dermot wrote:
Hi,
I notice that when I use DBIx::Class::Schema::Loader it always creates
the columns as is_nullable => 0.
Is this by design or is there an option I can pass it so that my
ResultSources will maintain their 'NOT NULL'.
is_nullable => 0 and NOT NULL mean the same thing, don't the
on...@houseofdesign.de wrote:
$hashref->{'users_reference'} does nox exist. I had problems with undef
variables in a hash. I generally put a "scalar" in front of my variables,
this fixes the "undef value in hash"-problem
e.g.
->find_or_create({
...
users_reference => scalar $hashref->{'users_
With search(), you can specify a set of columns to return, e.g.:
select => [qw/ item_id name /],
However, unlike get_columns(), get_inflated_columns() doesn't limit
itself to those columns. Instead, it returns values for all the columns
in the table. Of course, the value will beundef for an
Florian Ragwitz wrote:
diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm
index d0f5b1e..255b961 100644
--- a/lib/DBIx/Class/Storage/DBI.pm
+++ b/lib/DBIx/Class/Storage/DBI.pm
@@ -452,16 +452,16 @@ whether any options are specified in the new
C.
Another Important Note:
To use DateTime for inflating your date columns, all you need to do is
add InflateColumn::DateTime to the list of components. So, change:
__PACKAGE__->load_components("Core");
to:
__PACKAGE__->load_components("InflateColumn::DateTime", "Core");
You don't need to re-add the line of code to a
time_zone=> 'UTC' ));
$row->update;
or
$row->update(mydate => DateTime->now(time_zone=> 'UTC' ));
What should GREATEST do in your case?
-Alex
-Original Message-
From: Ronald J Kimball [mailto:[EMAIL PROTECTED]
Sent: Monday, March 31, 2008 5:03 PM
To: [
Yes, it's another question about using SQL functions in an update. I
know I can pass a reference to a string containing literal SQL, as in:
$row->update({ mydate => \ 'NOW()' });
However, in this case I need to pass arguments to the function, one of
which needs to be quoted. Here's what I'm
Ash Berlin wrote:
Why exactly do you need to have that as part of the join condition
rather than just in the WHERE clause? If you put as part of the search
term then you use bind params much easier and let the *database* handle
the quoting.
Because I need to /exclude/ those rows. I select f
I'm getting an error with the following query, which finds all users who
have not yet been sent a message from the specified user with the
specified subject(s).
Due to SQL::Abstract limitations, I'm providing some literal SQL for the
join clause, which happens to contain an escaped apostrophe.
The call to $rs->first returns undef, so you're trying to call
undef->id. That's why you get the error. Is that enough of a hint? :)
Try this:
myErrorFunc() unless $rs->first;
If id is a primary or unique key, you could do this instead:
myErrorFunc() unless $c->model('AppModelDB::Clients
Paul Makepeace wrote:
I had a look in various places (cookbook, faq, ::resultset) and
couldn't find whether there's a way to see if any SQL would be
generated due to a call to update().
my $rv = $obj->update(\%stuff);
$messages->($rv->XXX ? "updated" : "unchanged");
The docs* contain an eni
31 matches
Mail list logo