Re: [RDBO] RDBO and Storable?

2006-12-05 Thread Peter Leonard
Hi Perrin, Good call. :) Rose::DB::Object::Cached would be a likely choice, except we're looking at a multi-server cache - as Jonathan mentioned above, memcached is our intended target. Thanks, Peter Perrin Harkins wrote: Peter Leonard wrote: I understand the complexity involved, and

[RDBO] How to do locking with RDBO?

2006-12-05 Thread Michael Lackhoff
Hello, I need some pseudo-unique numbers like invoice numbers. They start every year with 1, so autoincrement won't work. My idea was to use a helper table with just just two fields 'year' and 'last_used_number'. Is it enough to create a two column unique key or would it be better to do something

Re: [RDBO] RDBO and Storable?

2006-12-05 Thread Perrin Harkins
Peter Leonard wrote: Rose::DB::Object::Cached would be a likely choice, except we're looking at a multi-server cache - as Jonathan mentioned above, memcached is our intended target. Sure, but it's probably easier to modify the storage part of Rose::DB::Object::Cached to hit memcached than

[RDBO] Suppress (or FOREIGN KEY is NULL) in queries

2006-12-05 Thread Kurt Hansen
Hello, I must be missing something. When Manager creates a JOIN, it adds a OR (tN.FK IS NULL) to the where clause even though FK is defined as not_null = 1 in tN. Adding this clause really extends the query time on some queries. I just tested one with and without the OR clause; with took 9

Re: [RDBO] How to do locking with RDBO?

2006-12-05 Thread Michael Lackhoff
Hello John, many thanks for your help, the only part I don't understand is why I need a new DB object: sub generate_invoice_number { my $class = shift; my $db = My::DB-new; # Rose::DB subclass Why not just use the default here? my $num; eval {

Re: [RDBO] Suppress (or FOREIGN KEY is NULL) in queries

2006-12-05 Thread John Siracusa
On 12/5/06 9:50 AM, Kurt Hansen wrote: I must be missing something. When Manager creates a JOIN, it adds a OR (tN.FK IS NULL) to the where clause even though FK is defined as not_null = 1 in tN. [...] Here are the offending FROM and WHERE clauses: FROM transactions t1 LEFT OUTER

Re: [RDBO] How to do locking with RDBO?

2006-12-05 Thread John Siracusa
On 12/5/06 10:18 AM, Michael Lackhoff wrote: many thanks for your help, the only part I don't understand is why I need a new DB object: Well, you need *a* db object from somewhere, and you need to share that db object among the manager, the row object, and the places where you lock and unlock.

Re: [RDBO] How to do locking with RDBO?

2006-12-05 Thread Perrin Harkins
Michael Lackhoff wrote: I need some pseudo-unique numbers like invoice numbers. They start every year with 1, so autoincrement won't work. My idea was to use a helper table with just just two fields 'year' and 'last_used_number'. Is it enough to create a two column unique key or would it be

Re: [RDBO] How to do locking with RDBO?

2006-12-05 Thread John Siracusa
On 12/5/06 11:08 AM, Michael Lackhoff wrote: On 5 Dec 2006 at 10:32, John Siracusa wrote: sub generate_invoice_number { my $class = shift; my $db = My::DB-new; # Rose::DB subclass Why not just use the default here? What default? The one that is inherited from my

Re: [RDBO] How to do locking with RDBO?

2006-12-05 Thread Michael Lackhoff
On 5 Dec 2006 at 11:02, Perrin Harkins wrote: You can usually do this kind of ++ thing in one INSERT...SELECT statement: INSERT INTO invoice (id) SELECT MAX(id)+1 FROM invoice; That's clever! Though it seems to slightly defeat the point in using RDBO: To have Perl, classes and methods

Re: [RDBO] How to do locking with RDBO?

2006-12-05 Thread Perrin Harkins
Michael Lackhoff wrote: Though it seems to slightly defeat the point in using RDBO: To have Perl, classes and methods instead of SQL, tables and columns. Abstraction is certainly one reason to use an ORM, but I think it's a bad idea to stick strictly with your ORM if it prevents you from

Re: [RDBO] Oracle LIMIT and Paging

2006-12-05 Thread John Siracusa
On 12/4/06 8:09 PM, Kevin McGrath wrote: $qs = q[ select * from (select oquery.*, rownum oracle_rownum from (] . $qs . q[) oquery where rownum = ?) where oracle_rownum ?]; It seems to me that the SQL constructed above is unnecessarily complex. Won't this work just as well? select * from

Re: [RDBO] Oracle LIMIT and Paging

2006-12-05 Thread John Siracusa
On 12/5/06 3:22 PM, John Siracusa wrote: On 12/5/06 3:11 PM, Kevin McGrath wrote: select * from (original query) where rownum = X and rownum = Y Nope. You cannot do a rownum or = that way. A BETWEEN will aslo not work. You an only do a: select * from (original query) where rownum = Y

Re: [RDBO] Suppress (or FOREIGN KEY is NULL) in queries

2006-12-05 Thread Ron Savage
Hi Kurt could be added to the documentation of Manager or QueryBuilder or to an FAQ, e.g. What to look for if your MySQL query is afully slow. :-) Another database vendor? (I tried to resist, truely). -- Ron Savage [EMAIL PROTECTED] http://savage.net.au/index.html

Re: [RDBO] How to do locking with RDBO?

2006-12-05 Thread Randal L. Schwartz
Michael == Michael Lackhoff [EMAIL PROTECTED] writes: Michael Is there an idiom for this kind of task? And how can I do it with Michael RDBO? You will never have perfectly sequenced numbers, unless you're willing to accept a fairly serious slowdown in assigning those numbers. The biggest

Re: [RDBO] How to do locking with RDBO?

2006-12-05 Thread Ask Bjørn Hansen
On Dec 5, 2006, at 9:00, George Hartzell wrote: On the other hand the hoops that they jump through to try to automagically generate queries and hide the relational database mystifies me, I find that I end up double checking the sql that they generate to make sure that I haven't shot myself

[RDBO] Three way map table?

2006-12-05 Thread Clayton Scott
Here are the tables involved: CREATE TABLE club (id serial PRIMARY KEY, name text); CREATE TABLE person (id serial PRIMARY KEY, name text); CREATE TABLE position (id serial PRIMARY KEY, name text); CREATE TABLE company_person_map ( clubinteger not null REFERENCES club (id),

Re: [RDBO] Three way map table?

2006-12-05 Thread John Siracusa
On 12/5/06 6:49 PM, Clayton Scott wrote: CREATE TABLE club (id serial PRIMARY KEY, name text); CREATE TABLE person (id serial PRIMARY KEY, name text); CREATE TABLE position (id serial PRIMARY KEY, name text); CREATE TABLE company_person_map ( clubinteger not null

Re: [RDBO] Three way map table?

2006-12-05 Thread Clayton Scott
On 12/5/06, John Siracusa [EMAIL PROTECTED] wrote: On 12/5/06 6:49 PM, Clayton Scott wrote: CREATE TABLE club (id serial PRIMARY KEY, name text); CREATE TABLE person (id serial PRIMARY KEY, name text); CREATE TABLE position (id serial PRIMARY KEY, name text); CREATE TABLE

Re: [RDBO] How to do locking with RDBO?

2006-12-05 Thread Jonathan Vanasco
On Dec 5, 2006, at 5:42 PM, Perrin Harkins wrote: This can also be done in a one-shot, without needing to explicitly lock anything: UPDATE foo SET id = id+1 WHERE nice catch. i wasn't even thinking of sql. i was just trying to consolidate the original example. // Jonathan

Re: [RDBO] How to do locking with RDBO?

2006-12-05 Thread George Hartzell
Ask Bjørn Hansen writes: On Dec 5, 2006, at 9:00, George Hartzell wrote: On the other hand the hoops that they jump through to try to automagically generate queries and hide the relational database mystifies me, I find that I end up double checking the sql that they generate to

Re: [RDBO] Three way map table?

2006-12-05 Thread John Siracusa
On 12/5/06 6:49 PM, Clayton Scott wrote: CREATE TABLE club (id serial PRIMARY KEY, name text); CREATE TABLE person (id serial PRIMARY KEY, name text); CREATE TABLE position (id serial PRIMARY KEY, name text); CREATE TABLE company_person_map ( clubinteger not null

Re: [RDBO] ORA-00918

2006-12-05 Thread Clayton Scott
On 12/5/06, John Siracusa [EMAIL PROTECTED] wrote: On 12/5/06 11:17 PM, Clayton Scott wrote: Do you have some code I can run on an Oracle 9 database to test this? The table definitions and the query are below. No data for the table? I will run this on an uptodate 9i installation at work

Re: [RDBO] ORA-00918

2006-12-05 Thread Clayton Scott
On 12/5/06, John Siracusa [EMAIL PROTECTED] wrote: DBD::Oracle::db prepare failed: ORA-00918: column ambiguously defined. DBD ERROR: error possibly near * indicator at char 24 in: SELECT * FROM ( SELECT a.**, ROWNUM oracle_rownum FROM ( SELECT t1.b1, t1.b2,

Re: [RDBO] ORA-00918

2006-12-05 Thread John Siracusa
On 12/5/06 11:34 PM, Kevin McGrath wrote: It looks like you have to have uniquely named column names: http://asktom.oracle.com/pls/ask/f?p=4950:8:F4950_P8_DISPLAYID:768123480 57 (search for 918 on the page and you'll get to the right spot) So the work-around is actually the solution, I

Re: [RDBO] Oracle error: ORA-00600

2006-12-05 Thread Ron Savage
Hi John Heh, thanks guys, but I'm already planning to buy a Mac Pro in early 2007. Oracle support looks like it's going to take a long time. I won't take any money because that implies a reasonable timeframe and a successful endeavor, neither of which is assured :) I have a full-time job,

Re: [RDBO] ORA-00918

2006-12-05 Thread John Siracusa
On 12/5/06 11:37 PM, Clayton Scott wrote: On 12/5/06, John Siracusa [EMAIL PROTECTED] wrote: On 12/5/06 11:17 PM, Clayton Scott wrote: Do you have some code I can run on an Oracle 9 database to test this? The table definitions and the query are below. No data for the table? Shouldn't

Re: [RDBO] Oracle error: ORA-00600

2006-12-05 Thread John Siracusa
On 12/5/06 11:42 PM, Kevin McGrath wrote: I'm on a cable connection myself, it's the only service I can get in my neighboorhood until FiOS is turned on. I can see about putting a oracle instance on my x86 GenToo server, dunno how great the connection speed will be but it's worth a shot.

[RDBO] Oracle progress

2006-12-05 Thread John Siracusa
Through judicious commenting-out, I've got RDBO passing 479 of the roughly 800 possible Oracle tests in t/db-object-manager.t. Basically, limit/offset works as requested by Kevin earlier. To do this, I did the minimum work needed to get t/db-object-manager.t to run at all, which included some

Re: [RDBO] Three way map table?

2006-12-05 Thread Clayton Scott
On 12/5/06, Clayton Scott [EMAIL PROTECTED] wrote: On 12/5/06, John Siracusa [EMAIL PROTECTED] wrote: It's a bug. The table name position is a keyword in Postgres and ends up coming back in the DBI foreign key info as qq(position). I handle quoted values in the internal

Re: [RDBO] Three way map table?

2006-12-05 Thread John Siracusa
On 12/6/06 12:25 AM, Clayton Scott wrote: Hmm, guess I spoke a little too quickly. When position looks like this: CREATE TABLE position ( id serial PRIMARY KEY, name text NOT NULL, stratum_id INTEGER NOT NULL ); ALTER TABLE position ADD CONSTRAINT

Re: [RDBO] Oracle progress

2006-12-05 Thread Clayton Scott
On 12/6/06, John Siracusa [EMAIL PROTECTED] wrote: Through judicious commenting-out, I've got RDBO passing 479 of the roughly 800 possible Oracle tests in t/db-object-manager.t. Basically, limit/offset works as requested by Kevin earlier. To do this, I did the minimum work needed to get

Re: [RDBO] Oracle progress

2006-12-05 Thread John Siracusa
On 12/6/06 12:44 AM, Clayton Scott wrote: 2. create a sequence called tablename_seq That's the crux of it. It looks like I'll have to just pick a naming scheme and say, If you deviate from this, don't try to use RDBO's 'serial' column type with oracle. Postgres does the exact same thing for

Re: [RDBO] Oracle progress

2006-12-05 Thread Clayton Scott
On 12/6/06, John Siracusa [EMAIL PROTECTED] wrote: On 12/6/06 12:44 AM, Clayton Scott wrote: 2. create a sequence called tablename_seq That's the crux of it. It looks like I'll have to just pick a naming scheme and say, If you deviate from this, don't try to use RDBO's 'serial' column type