Re: [RDBO] SELECT DISTINCT on a single column

2006-12-04 Thread Mike Schilli
On Sun, 3 Dec 2006, John Siracusa wrote: > This will do what you want: > > $events = > WatchLAN::Activity::Manager->get_some_table( > distinct => 1, > select => [ 'some_val ' ], > query=> [ event_time => { gt => ... } ]); > > but keep in mind that it'll retu

[RDBO] Oracle LIMIT and Paging

2006-12-04 Thread Kevin McGrath
I have been trying to switch from Class::DBI to Rose::DB using Oracle as my database. I discovered that limiting and paging do not work with oracle because oracle does not regonize LIMIT. To fix this I have created my own local Rose::DB::Object::QueryBuilder module that contains these changes:

Re: [RDBO] Oracle LIMIT and Paging

2006-12-04 Thread John Siracusa
On 12/4/06, Kevin McGrath <[EMAIL PROTECTED]> wrote: > I have been trying to switch from Class::DBI to Rose::DB using Oracle as my > database. I discovered that limiting and paging do not work with oracle > because oracle does not regonize LIMIT. Oracle is not fully supported by RDBO, as you've d

[RDBO] Oracle and DateTime

2006-12-04 Thread Kevin McGrath
I've noticed that if you set a column type to 'date' or 'datetime' with oracle a script will error out. This is because oracle's default response is in an un-regonized format. For now I've added the following code to my init_db function in my base module: sub init_db { my $db = My::DB->new;

Re: [RDBO] Oracle and DateTime

2006-12-04 Thread John Siracusa
On 12/4/06, Kevin McGrath <[EMAIL PROTECTED]> wrote: > For now I've added the following code to my init_db function in my base > module: > > sub init_db { > my $db = My::DB->new; > my $dbh = $db->dbh or die $db->error; > $dbh->do(q[alter session set nls_date_format = '-mm-dd > hh24:

[RDBO] Inheritence redux

2006-12-04 Thread Peter Leonard
Hi All, Going through the email archives, I found this thread, which effectively covers the questions I have with respect to inheritance and RDBO (or any OR layer for that matter): http://www.mail-archive.com/rose-db-object@lists.sourceforge.net/msg00102.html Given that this thread was from a

[RDBO] RDBO and Storable?

2006-12-04 Thread Peter Leonard
Hi all, A second RDBO question - Does RDBO play nicely with Storable? Can I freeze/thaw RDBO objects among various processes and get clean results? (In a serial fashion, of course - I would not try to make updates to the same object in several different places at once.) Thank you

Re: [RDBO] RDBO and Storable?

2006-12-04 Thread John Siracusa
On 12/4/06, Peter Leonard <[EMAIL PROTECTED]> wrote: > A second RDBO question - Does RDBO play nicely with Storable? Can I > freeze/thaw RDBO objects among various processes and get clean results? > (In a serial fashion, of course - I would not try to make updates to > the same object in sever

Re: [RDBO] Oracle and DateTime

2006-12-04 Thread Clayton Scott
On 12/4/06, John Siracusa <[EMAIL PROTECTED]> wrote: > Perhaps Rose::DB::Oracle could have a hard-coded default bit of > post_connect_sql to set nls_date_format, but I'd prefer it if I could > handle whatever Oracle produces if you do not set nls_date_format > explicitly. Or is there no default a

Re: [RDBO] RDBO and Storable?

2006-12-04 Thread Peter Leonard
John, Thank you for the quick reply. I understand the complexity involved, and what we're looking for is the quick storage & retrieval of the underlying data - I'll look at the json/yaml serialization implementations. Best, Peter John Siracusa wrote: > On 12/4/06, Peter Leon

Re: [RDBO] Oracle and DateTime

2006-12-04 Thread John Siracusa
On 12/4/06, Clayton Scott <[EMAIL PROTECTED]> wrote: > On 12/4/06, John Siracusa <[EMAIL PROTECTED]> wrote: >> Perhaps Rose::DB::Oracle could have a hard-coded default bit of >> post_connect_sql to set nls_date_format, but I'd prefer it if I could >> handle whatever Oracle produces if you do not se

Re: [RDBO] Oracle and DateTime

2006-12-04 Thread Kevin McGrath
John, thanks for the advice. Settting post_connect_sql in register_db is a lot cleaner than what I was doing. As for the default dates Clayton is 100% correct, and "Ick!" is also a correct feeling. Oracle defaults to DD-MON-YY, YY being the last two digits of the year. So for this query: selec

Re: [RDBO] Oracle and DateTime

2006-12-04 Thread Clayton Scott
On 12/4/06, John Siracusa <[EMAIL PROTECTED]> wrote: > On 12/4/06, Clayton Scott <[EMAIL PROTECTED]> wrote: > > On 12/4/06, John Siracusa <[EMAIL PROTECTED]> wrote: > >> Perhaps Rose::DB::Oracle could have a hard-coded default bit of > >> post_connect_sql to set nls_date_format, but I'd prefer it i

Re: [RDBO] Oracle and DateTime

2006-12-04 Thread John Siracusa
On 12/4/06, Clayton Scott <[EMAIL PROTECTED]> wrote: > On 12/4/06, John Siracusa <[EMAIL PROTECTED]> wrote: >> On 12/4/06, Clayton Scott <[EMAIL PROTECTED]> wrote: >>> There is a default (in the english world) of DD-MON-YY (23-JAN-00) >> >> Ick! A two-digit year? What are the rules for parsing th

Re: [RDBO] RDBO and Storable?

2006-12-04 Thread Peter Karman
Peter Leonard scribbled on 12/4/06 1:57 PM: > > I understand the complexity involved, and what we're looking for is the > quick storage & retrieval of the underlying data - I'll look at the > json/yaml serialization implementations. > fwiw, I'm using Swish-e to store my serialized RDBO obj

Re: [RDBO] RDBO and Storable?

2006-12-04 Thread George Hartzell
Peter Karman writes: > > > Peter Leonard scribbled on 12/4/06 1:57 PM: > > > > > I understand the complexity involved, and what we're looking for is the > > quick storage & retrieval of the underlying data - I'll look at the > > json/yaml serialization implementations. > > > >

Re: [RDBO] RDBO and Storable?

2006-12-04 Thread Jonathan
On Dec 4, 2006, at 3:53 PM, Peter Karman wrote: > fwiw, I'm using Swish-e to store my serialized RDBO objects, with > the added > benefit of being able to do full-text search and sorting on them as > well. I'm > using http://search.cpan.org/~karman/SWISH-API-Object-0.05/lib/ > SWISH/API/Obje

Re: [RDBO] RDBO and Storable?

2006-12-04 Thread Perrin Harkins
Peter Leonard wrote: > I understand the complexity involved, and what we're looking for is the > quick storage & retrieval of the underlying data It sounds like you want to cache the data. Did you consider expanding Rose::DB::Object::Cached to use your data storage of choice instead of memory?

Re: [RDBO] Oracle and DateTime

2006-12-04 Thread Clayton Scott
On 12/4/06, John Siracusa <[EMAIL PROTECTED]> wrote: > Well what does Oracle do? Is a YY value of 50 the year 1950 or 2050 > or something else? And so on for 00-99. And what about the 1800s and > 2100s? Basically, to parse YY, we have to know exactly what Oracle > does so we can follow the sam

Re: [RDBO] Oracle LIMIT and Paging

2006-12-04 Thread Kevin McGrath
Thanks for taking a look at this. The addition will be most appreciated. And to correct my earlier code, I had copied missed copied the code block from a previous version I had. The correct block is: if (defined $limit && !$use_prefix_limit) { if ($dbh->{'Driver'}{'Name'} eq 'Oracle') {

Re: [RDBO] Oracle and DateTime

2006-12-04 Thread John Siracusa
On 12/4/06 8:02 PM, Clayton Scott wrote: > On 12/4/06, John Siracusa <[EMAIL PROTECTED]> wrote: >> Well what does Oracle do? Is a YY value of 50 the year 1950 or 2050 >> or something else? And so on for 00-99. And what about the 1800s and >> 2100s? Basically, to parse YY, we have to know exactl

Re: [RDBO] Oracle and DateTime

2006-12-04 Thread Clayton Scott
On 12/4/06, John Siracusa <[EMAIL PROTECTED]> wrote: > In that case, it seems like we can't support the default format since > there's no way to know how to inflate that into a DateTime object. So I > guess we're back to a default nls_date_format setting in post_connect_sql > for Oracle. Blah. B