Re: [RDBO] rose-db-object

2007-12-27 Thread John Siracusa
Sorry about that, guys.  I mis-clicked in the admin interface when trying to
discard this list spam.

-John



-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object - load() should not depend upon sth-rows()

2007-08-10 Thread John Siracusa
On 8/10/07 11:38 AM, news wrote:
 I believe it is impossible to use rows() after a single fetch() to
 determine whether no not the fetch() returned a row.
 
 The return value from fetch() when defined does:

Yeah, that's much better, thanks.  Changed in SVN.

-John



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object - load() should not depend upon sth-rows()

2007-08-10 Thread news
Unfortunately, yes, rows() certainly can and will be greater than zero 
for the last fetch() when one or more rows are returned since it is 
reporting how many rows where fetched overall by the database query, not 
the last DBI call.


I believe it is impossible to use rows() after a single fetch() to 
determine whether no not the fetch() returned a row.


The return value from fetch() when defined does:

   *fetchrow_arrayref http://search.cpan.org/%7Etimb/DBI/DBI.pm#___top*

 $ary_ref = $sth-fetchrow_arrayref;
 $ary_ref = $sth-fetch;# alias

   Fetches the next row of data and returns a reference to an array
   holding the field values. Null fields are returned as |undef| values
   in the array. This is the fastest way to fetch data, particularly if
   used with |$sth-bind_columns|.

   If there are no more rows or if an error occurs, then
   |fetchrow_arrayref| returns an |undef|. You should check |$sth-err|
   afterwards (or use the |RaiseError| attribute) to discover if the
   |undef| returned was due to an error.

   Note that the same array reference is returned for each fetch, so
   don't store the reference and then use it after a later fetch. Also,
   the elements of the array are also reused for each row, so take care
   if you want to take a reference to an element. See also
   bind_columns http://search.cpan.org/%7Etimb/DBI/DBI.pm#bind_columns.

- philip

John Siracusa wrote:

On 8/8/07 10:55 AM, Philip Dye wrote:
  

$rv = $sth-rows;

Returns the number of rows affected by the last row affecting
command, or -1 if the number of rows is not known or not available.



In SVN, I changed in from:

if($rows  0)

to

if($rows  0 || $rows == -1)

which should cover all bases...unless some DBD returns -1 when zero rows are
found?  Hrm...

-John



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object
  


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object - load() should not depend upon sth-rows()

2007-08-08 Thread John Siracusa

On 8/8/07 10:55 AM, Philip Dye wrote:
 $rv = $sth-rows;
 
 Returns the number of rows affected by the last row affecting
 command, or -1 if the number of rows is not known or not available.

In SVN, I changed in from:

if($rows  0)

to

if($rows  0 || $rows == -1)

which should cover all bases...unless some DBD returns -1 when zero rows are
found?  Hrm...

-John



-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object::Column::Serialize?

2007-06-22 Thread Svilen Ivanov
This serialized columns seem common practice (at least 2-3 devs asked
up till now) but inclusion in RDBO package may be overkill, how about
posting the samples in documentation or in the wiki (I faintly recall
RDBO wiki somewhere)?



2007/6/22, [EMAIL PROTECTED] [EMAIL PROTECTED]:
  thanks again for this, svilen.
 
  i took what you posted, plus the followups from jsiracusa, and got
  something going.  your code was very helpful.
 
  i made some slight adjustments, notably calling $class-freeze/thaw
  in the methodmaker, and implementing those as class methods there.
 
  that allowed me to do something like:
 
 package My::MethodMaker::Serialized::JSON;
 use base 'My::MethodMaker::Serialized';
 use JSON;
 sub freeze { JSON-new-objToJson($_[1]) }
 sub thaw   { JSON-new(skipinvalid = 1)-jsonToObj($_[1]) }
 1;
 
 package My::MethodMaker::Serialized::YAML;
 use base 'My::MethodMaker::Serialized';
 use YAML::Syck();
 sub freeze { YAML::Syck::Dump($_[1]) }
 sub thaw   { YAML::Syck::Load($_[1]) }
 1;
 
 package My::MethodMaker::Serialized::Storable;
 use base 'My::MethodMaker::Serialized';
 use Storable();
 sub freeze { Storable::freeze($_[1]) }
 sub thaw   { Storable::thaw($_[1]) }
 1;
 
  add some little My::Column::Serialized::* wrappers to do the
  method_maker_class/type bits, plus this in My::MetaData
 
 __PACKAGE__-column_type_class(serialized_storable =
  'Plex::RDBO::_serialized_storable_column');
 __PACKAGE__-column_type_class(serialized_yaml =
  'Plex::RDBO::_serialized_yaml_column');
 __PACKAGE__-column_type_class(serialized_json =
  'Plex::RDBO::_serialized_json_column');

 er,

 __PACKAGE__-column_type_class(serialized_storable =
  'My::Column::Serialized::Storable');
 __PACKAGE__-column_type_class(serialized_yaml =
  'My::Column::Serialized::YAML');
 __PACKAGE__-column_type_class(serialized_json =
 'My::Column::Serialized::JSON');

 do not fear my crazy actual package names i exposed up there :)


 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Rose-db-object mailing list
 Rose-db-object@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/rose-db-object


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object::Column::Serialize?

2007-06-22 Thread John Siracusa
On 6/22/07, Svilen Ivanov [EMAIL PROTECTED] wrote:
 This serialized columns seem common practice (at least 2-3 devs asked
 up till now) but inclusion in RDBO package may be overkill, how about
 posting the samples in documentation or in the wiki (I faintly recall
 RDBO wiki somewhere)?

There's a wiki, but it's unreliable.  I'll gladly fold this code into
RDBO if it's got docs and tests, yada.  Or it could be released to
CPAN as a separate Rose::DBx:: module.

-John

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object::Column::Serialize?

2007-06-19 Thread Svilen Ivanov
Michael,

Check this thread:
http://www.mail-archive.com/rose-db-object@lists.sourceforge.net/msg00260.html

I hope that helps

2007/6/20, Michael Reece [EMAIL PROTECTED]:

 i am looking to freeze/thaw (or yaml, doesn't really matter..)
 unblessed data structures into a mysql column.

 has anyone already written a Column class that handles this
 transparently?

 ---
 michael reece :: software engineer :: [EMAIL PROTECTED]



 -
 This SF.net email is sponsored by DB2 Express
 Download DB2 Express C - the FREE version of DB2 express and take
 control of your XML. No limits. Just data. Click to get it now.
 http://sourceforge.net/powerbar/db2/
 ___
 Rose-db-object mailing list
 Rose-db-object@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/rose-db-object


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object::Loader question

2007-06-04 Thread Iļja Ketris

On 6/4/07, John Siracusa [EMAIL PROTECTED] wrote:


On 6/3/07 5:20 PM, I?ja Ketris wrote:
 I wonder how the module decides about foreign keys over relationships.

If it's there's a real foreign key constraint in the database, the Loader
make a foreign key in the RDBO class.




How is this possible?
SQLite doesn't support foreign keys, and there is no mention of them in my
schema, which is roughly not more than

Create Table user (user Integer Primary Key Autoincrement Not Null, realname
text);
Create Table collection (user Integer References user(user), collection
text, Primary Key (user, collection));

Maybe Convention methods are trying to guess by column names?




-John




--
Iļja Ketris | iPro SIA  | +371 800 IPRO
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object::Loader question

2007-06-04 Thread John Siracusa
On 6/4/07, Iļja Ketris [EMAIL PROTECTED] wrote:
 On 6/4/07, John Siracusa [EMAIL PROTECTED] wrote:
 If it's there's a real foreign key constraint in the database, the Loader
 make a foreign key in the RDBO class.

 How is this possible? SQLite doesn't support foreign keys

It does, sort of.  There are many examples in the RDBO test suite.
Look at t/db-object-loader.t and search for SQLite:

http://search.cpan.org/src/JSIRACUSA/Rose-DB-Object-0.764/t/db-object-loader.t

CREATE TABLE products
(
  ...
  vendor_id  INT REFERENCES vendors (id),
  ...
);

 and there is no mention of them in my schema, which is roughly not more than

 Create Table user (user Integer Primary Key Autoincrement Not Null, realname
 text);
  Create Table collection (user Integer References user(user), collection
 text, Primary Key (user, collection));

That ... Integer References user(user) part creates a foreign key in
SQLite.  That's what the Loader is picking up.

-John
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object::Loader question

2007-06-03 Thread John Siracusa
On 6/3/07 5:20 PM, I?ja Ketris wrote:
 I wonder how the module decides about foreign keys over relationships.

If it's there's a real foreign key constraint in the database, the Loader
make a foreign key in the RDBO class.

-John



-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object::Manager logic for FKs and with_objects

2007-04-25 Thread Ethan Rowe
John Siracusa wrote:
 Okay, this should be fixed now in SVN.  Eligible (according to the
 metadata) outer joins are still transformed, but now they're changed
 into nested inner joins, which preserves the meaning of the query.  If
 nested joins are unavailable or disabled, it falls back to a bunch of
 un-transformed outer joins.

   
Sorry for the delay.  This did indeed fix the problem I was seeing.  
Thanks very much for jumping on this.  :)

 See the new nested_joins parameter and default_nested_joins class
 method in the Manager class for ways to control this behavior.  And
 let me know if it actually works for you guys :)

   
Hopefully I'll get to play around with this soon.

Thanks again.
- Ethan

-- 
Ethan Rowe
End Point Corporation
[EMAIL PROTECTED]


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object::Manager logic for FKs and with_objects

2007-04-23 Thread John Siracusa
On 4/23/07, Ethan Rowe [EMAIL PROTECTED] wrote:
 Table b has an FK to table a. Table b also has an FK to table c.  These FK
 columns are all NOT NULL constrained.

If that is the case, and if referential integrity is turned on for the
foreign key that links b to c, then you are telling RDBO that no row
in b can ever exist without a corresponding row in c.  Thus, the
behavior you observe is valid:

 Where I to use get_objects for table a, it would be reasonable to use a
 with_objects setting of: [ qw( b b.c ) ]

 However, this will fail to return any records for which table c cannot
 be found, despite the fact that table c is requested as a member of
 with_objects rather than require_objects.

If you do not want this behavior (say, because you're using a database
that does not enforce referential integrity on its foreign keys, even
when the columns involved are NOT NULL), then turn off the
refferential_integrity attribute for the foreign key that links b to
c:

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata/ForeignKey.pm#referential_integrity

 I believe the assumption is being misapplied in this particular
 case, due to the fact that we're using table b in a with_objects list
 rather than a require_objects list;  this is basically the same as
 saying give me table a stuff, and give me tables b and c if you got
 'em.  In such a case, my table a records should come through whether or
 not they have relations all the way out to table c via table b.

The conversion of certain with_objects args from left outer joins to
inner joins is a (useful! :) optimization that is made only when the
metadata supports it.  That is, only if it is a valid transformation
according to the information available.  Change the metadata to change
this behavior.

-John

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object::Manager logic for FKs and with_objects

2007-04-23 Thread Ethan Rowe
Thanks for the timely response.

 Table b has an FK to table a. Table b also has an FK to table c.  These FK
 columns are all NOT NULL constrained.
 

 If that is the case, and if referential integrity is turned on for the
 foreign key that links b to c, then you are telling RDBO that no row
 in b can ever exist without a corresponding row in c.  Thus, the
 behavior you observe is valid:

   
If I was using table b as the foundation of the query (i.e. 
MyApp::Model::B::Manager-get_objects()), then I would agree with you.  
But I'm not; I'm using table *a* as the foundation (i.e. 
MyApp::Model::A::Manager-get_objects()), which does not have an FK to 
table b -- it only has a one-to-many relationship to table b.  Thus, by 
putting b and b.c in 'with_objects', I'm saying that I definitely want 
my 'a' records, and whatever 'b' and 'b.c' records there might be 
(excluding any additional limits I choose to put in the where clause).

Doesn't putting 'b' in the 'with_objects' set make 'b' records desired 
-- but, critically, optional  -- for the query result?  In which case, 
while the behaviors regarding foreign keys with full referential 
integrity enabled are appropriate in determining what 'b' records (and 
'c' records) show up in  the result, it should not influence whether an 
'a' record can or cannot be returned?  That's the point of my email; 
this relationship between b and c and its surrounding rules are 
preventing the 'a' records from showing up, when I've asked for 'b' 
records in a give 'em if you've got 'em fashion (as opposed to the 
only give 'em if its got 'em approach of 'require_objects').

Does that make more sense?
 Where I to use get_objects for table a, it would be reasonable to use a
 with_objects setting of: [ qw( b b.c ) ]

 However, this will fail to return any records for which table c cannot
 be found, despite the fact that table c is requested as a member of
 with_objects rather than require_objects.
 

 If you do not want this behavior (say, because you're using a database
 that does not enforce referential integrity on its foreign keys, even
 when the columns involved are NOT NULL), then turn off the
 refferential_integrity attribute for the foreign key that links b to
 c:

 http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/Metadata/ForeignKey.pm#referential_integrity
   
Yes, I noted this in my initial email. :)

Thanks again for your response.
- Ethan

-- 
Ethan Rowe
End Point Corporation
[EMAIL PROTECTED]


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object::Manager logic for FKs and with_objects

2007-04-23 Thread John Siracusa
On 4/23/07, Ethan Rowe [EMAIL PROTECTED] wrote:
 Table b has an FK to table a. Table b also has an FK to table c.  These FK
 columns are all NOT NULL constrained.

 If that is the case, and if referential integrity is turned on for the
 foreign key that links b to c, then you are telling RDBO that no
row in b can
 ever exist without a corresponding row in c.  Thus, the behavior you observe
 is valid:

 If I was using table b as the foundation of the query (i.e.
 MyApp::Model::B::Manager-get_objects()), then I would agree with you. But I'm
 not; I'm using table *a* as the foundation (i.e.
 MyApp::Model::A::Manager-get_objects()), which does not have an FK to table b
 -- it only has a one-to-many relationship to table b.  Thus, by putting b and
 b.c in 'with_objects', I'm saying that I definitely want my 'a' records, and
 whatever 'b' and 'b.c' records there might be (excluding any additional limits
 I choose to put in the where clause).

As an aside, having both b and b.c in a (with|require)_objects
parameter value is redundant.  Mentioning b.c is sufficient to get
both.

 Doesn't putting 'b' in the 'with_objects' set make 'b' records desired
 -- but, critically, optional  -- for the query result?  In which case,
 while the behaviors regarding foreign keys with full referential
 integrity enabled are appropriate in determining what 'b' records (and
 'c' records) show up in  the result, it should not influence whether an
 'a' record can or cannot be returned?  That's the point of my email;
 this relationship between b and c and its surrounding rules are
 preventing the 'a' records from showing up, when I've asked for 'b'
 records in a give 'em if you've got 'em fashion (as opposed to the
 only give 'em if its got 'em approach of 'require_objects').

 Does that make more sense?

Yes, thanks.  It's supposed to be doing what you expect it to do, but
it's not doing it due to a bug.  I'll think about the best way to fix
it.  I could of course just remove the optimization, but I have a few
other ideas.  Thanks for the report.

-John

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object::Manager logic for FKs and with_objects

2007-04-23 Thread Ethan Rowe
John Siracusa wrote:
 Doesn't putting 'b' in the 'with_objects' set make 'b' records desired
 -- but, critically, optional  -- for the query result?  In which case,
 while the behaviors regarding foreign keys with full referential
 integrity enabled are appropriate in determining what 'b' records (and
 'c' records) show up in  the result, it should not influence whether an
 'a' record can or cannot be returned?  That's the point of my email;
 this relationship between b and c and its surrounding rules are
 preventing the 'a' records from showing up, when I've asked for 'b'
 records in a give 'em if you've got 'em fashion (as opposed to the
 only give 'em if its got 'em approach of 'require_objects').

 Does that make more sense?
 

 Yes, thanks.  It's supposed to be doing what you expect it to do, but
 it's not doing it due to a bug.  I'll think about the best way to fix
 it.  I could of course just remove the optimization, but I have a few
 other ideas.  Thanks for the report.

   

Thanks for validating my sanity. :)

For what it's worth, based on my code read of this stuff, it looks like 
this foreign key logic optimization wouldn't be invoked at all if I 
pulled in just table b without pulling c along with it, meaning I 
could arguably get invalid b records (if any existed) if I simply 
didn't bother with table c in this case.  Given that limitation, it does 
beg the question of whether the optimization is worth the trouble.  But 
I'm accustomed to database schemas that will not permit garbage, so of 
course this is my opinion.  :)

Thanks again.  Rose::DB::Object is terrific.
- Ethan

-- 
Ethan Rowe
End Point Corporation
[EMAIL PROTECTED]


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object::Manager logic for FKs and with_objects

2007-04-23 Thread John Siracusa
On 4/23/07, Ethan Rowe [EMAIL PROTECTED] wrote:
 John Siracusa wrote:
 Yes, thanks.  It's supposed to be doing what you expect it to do, but it's
 not doing it due to a bug.  I'll think about the best way to fix
it.  I could
 of course just remove the optimization, but I have a few other
ideas.  Thanks
 for the report.

 Thanks for validating my sanity. :)

Okay, this should be fixed now in SVN.  Eligible (according to the
metadata) outer joins are still transformed, but now they're changed
into nested inner joins, which preserves the meaning of the query.  If
nested joins are unavailable or disabled, it falls back to a bunch of
un-transformed outer joins.

See the new nested_joins parameter and default_nested_joins class
method in the Manager class for ways to control this behavior.  And
let me know if it actually works for you guys :)

(all tests  pass on my end...)
-John

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object and table inheritance

2007-02-13 Thread Randal L. Schwartz
 Jonathan == Jonathan Vanasco [EMAIL PROTECTED] writes:

Jonathan FWIW, i dropped using table inheritance in postgres.  the way it was  
Jonathan internally handled wasn't fast enough - no matter how i keyed and  
Jonathan indexed the tables or tried to influence the optimizer, the internal  
Jonathan system always used a slow join

I'll second that.  I ran arond this block about a half year ago, and have
successfully lobbied $client to change his inherited tables into a traditional
main plus variant info model.

Now I just have to do the work. :)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
merlyn@stonehenge.com URL:http://www.stonehenge.com/merlyn/
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object thingy like class::dbi's set_sql?

2006-11-29 Thread John Siracusa
On 11/28/06, George Hartzell [EMAIL PROTECTED] wrote:
 John Siracusa writes:
 [...]
 All of that said, adding iterator options to get_objects_from_sql()
 and make_manager_method_from_sql() is pretty simple.  If you really
 want it, I'll throw it in the next release :)

 It'd help a bunch.  I may take a stab at it, but if you get it going,
 I'd love to try it.

Too late!  It's in SVN now :)

-John

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object thingy like class::dbi's set_sql?

2006-11-29 Thread George Hartzell
John Siracusa writes:
  On 11/28/06, George Hartzell [EMAIL PROTECTED] wrote:
   John Siracusa writes:
   [...]
   All of that said, adding iterator options to get_objects_from_sql()
   and make_manager_method_from_sql() is pretty simple.  If you really
   want it, I'll throw it in the next release :)
  
   It'd help a bunch.  I may take a stab at it, but if you get it going,
   I'd love to try it.
  
  Too late!  It's in SVN now :)

No fair.  You cheated  :)

Thanks,

g.

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object thingy like class::dbi's set_sql?

2006-11-28 Thread George Hartzell
George Hartzell writes:
  
  Hi All [and John],
  
  [...]
  It looks like I might be able to figure out how to get RDO::Manager to
  express the query, but it would be quicker (at least as a first cut to
  be able to do something like
  
Foo::DB::Moose::Manager-get_iterator_from_sql(blahblahblah);
  
  I haven't seen anything in my dives into the docs.  Is it possible?
  Can you give me a pointer?

It turns out that I'm blind as a bat.

Looks like get_objects_from_sql will do exactly what I want.

Sorry for the wasted bandwidth

g.

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object thingy like class::dbi's set_sql?

2006-11-28 Thread Michael Reece

All of that said, adding iterator options to get_objects_from_sql()
and make_manager_method_from_sql() is pretty simple.  If you really
want it, I'll throw it in the next release :)


yes, please!

On Nov 28, 2006, at 1:33 PM, John Siracusa wrote:


On 11/28/06, George Hartzell [EMAIL PROTECTED] wrote:
It looks like I might be able to figure out how to get  
RDO::Manager to
express the query, but it would be quicker (at least as a first  
cut to

be able to do something like

  Foo::DB::Moose::Manager-get_iterator_from_sql(blahblahblah);

I haven't seen anything in my dives into the docs.  Is it possible?
Can you give me a pointer?


The get_objects_from_sql() Manager method will fetch objects based on
hand-coded SQL:

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/ 
Manager.pm#get_objects_from_sql


but it will return all the objects at once.  Another Manager method,
make_manager_method_from_sql(), will create a method based on your
hand-coded SQL.  This is a bit more like CDBI's set_sql method.

http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/ 
Manager.pm#make_manager_method_from_sql


But again, it returns all the objects at once.  There's currently no
iterator-based variant of those two methods.

(Coming from CDBI, that shouldn't bother you too much, however, since
the last time I checked, CDBI fetches all the rows from the database
before allowing the first iteration anyway.  The iterators used by the
RDBO Manager, OTOH, fetch rows on demand, in response to each
iteration.)

All of that said, adding iterator options to get_objects_from_sql()
and make_manager_method_from_sql() is pretty simple.  If you really
want it, I'll throw it in the next release :)

-John

-- 
---

Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to  
share your

opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php? 
page=join.phpp=sourceforgeCID=DEVDEV

___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


---
michael reece :: software engineer :: [EMAIL PROTECTED]


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object thingy like class::dbi's set_sql?

2006-11-28 Thread George Hartzell
John Siracusa writes:
  [...]
  All of that said, adding iterator options to get_objects_from_sql()
  and make_manager_method_from_sql() is pretty simple.  If you really
  want it, I'll throw it in the next release :)

It'd help a bunch.  I may take a stab at it, but if you get it going,
I'd love to try it.

I'm running 0.756 of Rose::DB::Object, because that's what's currently
in ports.  I could update the port to run current and/or poke the port
maintainer for an update (I think that the ports tree may be
frozen/slushy whilst they get the 6.2 release out the door).

Thanks!

g.

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object subclass instances within Safe compartment

2006-06-06 Thread Ethan Rowe
John Siracusa wrote:

 If related objects are fetched by the Manager due to require_objects
 or with_objects parameters, they should be attached as full-fledged
 objects.  Can you can show me an instance (sample code) where this is
 not the case?

That's good to know; I was making something of an off-the-cuff 
observation that I knew might be wrong.  I'll reproduce the error I got 
and pass it along if it appears somehow inconsistent with what you've 
just described.

Thanks.
- Ethan

-- 
Ethan Rowe
End Point Corporation
[EMAIL PROTECTED]



___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object::Metadata::Auto V 0.66 via Rose::DB::Object V 0.681

2006-03-01 Thread John Siracusa
On 3/1/06 10:44 PM, Ron Savage wrote:
 Pursuant to my attempts to generate Perl code under Oracle, I had to make a
 number of patches to this module.

Ah, I didn't know you were editing Rose::DB::Object modules yet.  I'll add
them to the Oracle branch.

Having just taken a casual look at your changes, I think you just broke some
or all of the other dbs :)  For each Oracle-specific thing that you need to
do in any shared module, you have two choices.

You can create a private Rose::DB method to make each decision (e.g.,
column_info_uses_uc_table_name() or something) and then make sure that only
Rose::DB::Oracle overrides it in such a way that it alters the existing
behavior.

The second choice is to create an Oracle-specific Metadata::Auto subclass:

Rose::DB::Object::Metadata::Auto::Oracle

and put all your Oracle-specific code in there.  That way you can be sure
you aren't altering any existing behavior for other drivers.

-John




---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object::Metadata::Auto V 0.66 via Rose::DB::Object V 0.681

2006-03-01 Thread Ron Savage
On Wed, 01 Mar 2006 23:39:42 -0500, John Siracusa wrote:

Hi John

 Ah, I didn't know you were editing Rose::DB::Object modules yet.
 I'll add them to the Oracle branch.

I wasn't intending to work on it. I just wanted to fiddle it to see what
happened with my source code generator.

 Having just taken a casual look at your changes, I think you just
 broke some or all of the other dbs :)  For each Oracle-specific

I'm not surprised. I simply rigged it for Oracle :-).

 thing that you need to do in any shared module, you have two
 choices.

 You can create a private Rose::DB method to make each decision
 (e.g., column_info_uses_uc_table_name() or something) and then make
 sure that only Rose::DB::Oracle overrides it in such a way that it
 alters the existing behavior.

 The second choice is to create an Oracle-specific Metadata::Auto
 subclass:

 Rose::DB::Object::Metadata::Auto::Oracle

 and put all your Oracle-specific code in there.  That way you can
 be sure you aren't altering any existing behavior for other drivers.

Since the generated code for Oracle is so wrong, I'd have to say the 2nd option
will be a much cleaner result.

For the record, what I've done is:

o Created a test program which when run generates Perl source

o Converted that program into a HTML::Template-style template, with a couple of
loops over table names
code
$boilerplate as recommended elsewhere

tmpl_loop name=package_loop
package tmpl_var name=module_name;

use base 'Base::Object';

__PACKAGE__ - meta - table('tmpl_var name=table_name');
__PACKAGE__ - meta - auto_initialize;

1;

# ---

/tmpl_loop
package main;

tmpl_loop name=module_loop
print tmpl_var name=module_name - meta - perl_class_definition
(
braces = 'bsd',
);

print \n# ===\n\n;

/tmpl_loop

/code

o Created another program which feeds all table names into the template and
generates yet another program (YAP) which, when run, outputs a Perl module for
each table. This is the code which needs correction

o So I have iterative :-) but not recursive :-( source-code generation

o Now the plan is to fabricate and edit Rose::DB::Object::Metadata::Auto::Oracle
until it creates the correct output

--
Ron Savage
[EMAIL PROTECTED]
http://savage.net.au/index.html




---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object


Re: [RDBO] Rose::DB::Object::Metadata::Auto V 0.66 via Rose::DB::Object V 0.681

2006-03-01 Thread John Siracusa
On 3/2/06 12:41 AM, Ron Savage wrote:
 I wasn't intending to work on it. I just wanted to fiddle it to see what
 happened with my source code generator.

Ah, okay.  I added it to the branch anyway, though.  At the very least,
it'll give me good practice doing merges in SVN :)

 For the record, what I've done is: [snip]

Have you looked at the loader and its make_modules() method?  Maybe it'll
help and maybe it won't (especially if you've already got working code) but
I just thought I'd mention it.

-John




---
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnkkid=110944bid=241720dat=121642
___
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object