Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
datetime default value error
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Uriel  
View profile  
 More options Jul 13 2012, 3:59 pm
From: Uriel <uriel.liz...@gmail.com>
Date: Fri, 13 Jul 2012 12:59:16 -0700 (PDT)
Local: Fri, Jul 13 2012 3:59 pm
Subject: datetime default value error

Hello,

I have the following object:

__PACKAGE__->meta->setup
(
    table => 'coupon',

    columns =>
    [
        id                            => { type => 'bigint', primary_key =>
1 },
        store                         => { type => 'bigint' },
        name                          => { type => 'varchar', length => 45

},

        excerpt                       => { type => 'varchar', length => 150
},

        description                   => { type => 'text' },
        quantity                      => { type => 'int', default => 1 },
        quantity_available            => { type => 'int', default => 0 },
        quantity_claimed_subscriber   => { type => 'int', default => 0 },
        quantity_claimed_free         => { type => 'int', default => 0 },
        limitation                    => { type => 'int', default => 0 },
        limitation_int                => { type => 'int' },
        offer_creation                => { type => 'datetime', default =>
'now', time_zone => 'UTC' },
        offer_start                   => { type => 'datetime', time_zone =>
'UTC' },
        offer_end                     => { type => 'datetime', time_zone =>
'UTC' },
        expiration_int                => { type => 'int', default => 0 },
        expiration_mult               => { type => 'char', length => 1,
default => 'D' },
        delivery_type                 => { type => 'char', length => 1,
default => 1 },
        random_codes                  => { type => 'boolean', default => 1
},

        status                        => { type => 'tinyint', default => 0
},

        purchase_price                => { type => 'decimal' },
    ],

);

Whenever I create a new object and save it, it saves the object correctly
on the database but then it dies with the following error:

"Could not parse datetime 'now' - Invalid date format: now"

This is really strange, since it does save the object with the correct date
on the database.

Any pointers on what might be the problem?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Siracusa  
View profile  
 More options Jul 13 2012, 6:34 pm
From: John Siracusa <sirac...@gmail.com>
Date: Fri, 13 Jul 2012 18:34:19 -0400
Local: Fri, Jul 13 2012 6:34 pm
Subject: Re: datetime default value error

On Fri, Jul 13, 2012 at 3:59 PM, Uriel <uriel.liz...@gmail.com> wrote:
> Whenever I create a new object and save it, it saves the object correctly on
> the database but then it dies with the following error:

> "Could not parse datetime 'now' - Invalid date format: now"

> This is really strange, since it does save the object with the correct date
> on the database.

> Any pointers on what might be the problem?

Nothing comes to mind.  It looks like "now" is making it past the
first level of parsing by Rose::DateTime::Util's parse_date() method
(which does understand "now") and to the per-database date parsing
code, which probably doesn't.  But I don't see why that would happen.
I suggest stepping through the problematic code in the debugger to see
what's going on.  Failing that, make a self-contained test case that
anyone can run and post it to the list.

-John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Richard Jones  
View profile  
 More options Jul 14 2012, 4:28 am
From: Richard Jones <ra.jo...@dpw.clara.co.uk>
Date: Sat, 14 Jul 2012 09:28:00 +0100
Subject: Re: datetime default value error
On 13/07/2012 20:59, Uriel wrote:
[..]

> Whenever I create a new object and save it, it saves the object
> correctly on the database but then it dies with the following error:

> "Could not parse datetime 'now' - Invalid date format: now"

> This is really strange, since it does save the object with the correct
> date on the database.

> Any pointers on what might be the problem?

You're not being bitten by a misuse of the $db->error 'feature'?

$db->do_transaction( sub { ... } );
return $db->error if $db->error; # THIS IS WRONG

That bites in a persistent environment. I'm sure John will fill in the
details, but it's returning a silent warning stored during an earlier
date-handling instance.

<https://groups.google.com/forum/#!search/rdbo$20jones/rose-db-object/...>

In my case the error msg was exactly as yours, and the transaction
worked fine, and I should have (and now do):

my $ok = $db->do_transaction( sub { ... } );
return $ok ? 0 : 'my_method() error - ' . $db->error;

Just a thought.
--
Richard Jones


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
John Siracusa  
View profile  
 More options Jul 14 2012, 10:13 am
From: John Siracusa <sirac...@gmail.com>
Date: Sat, 14 Jul 2012 10:13:45 -0400
Local: Sat, Jul 14 2012 10:13 am
Subject: Re: datetime default value error

Ah, yes, this sounds like it could very well be what's happening.  Good catch.

-John


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Uriel  
View profile  
 More options Jul 18 2012, 11:14 am
From: Uriel <uriel.liz...@gmail.com>
Date: Wed, 18 Jul 2012 08:14:28 -0700 (PDT)
Local: Wed, Jul 18 2012 11:14 am
Subject: Re: datetime default value error

Thanks for your comments, I don't think this is the problem in particular
since the error comes when I do:

$coupon->save

And what is strange, is that it does the save in the database with the
correct date and then after that it throws the error.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »