[RDBO] some db parameter questions

2007-02-08 Thread Jonathan Vanasco

I'm playing around with some application flow ideas,  some likely  
dangerous.

originally i wanted to  do something to the effect of this- create a  
customer helper method to destroy the db on a rose object

ie, this  part:

bless( {
   '__xrdbopriv_in_db' = 1,
   'db' = bless( {

'connect_options_for' = {

   'config' = {

 'config' = 1

   }

 },

'password_closure' = sub { DUMMY },
'_dbh_refcount' 
= 0,
'username' = 
'NULL',
'host' = 
'localhost',
'database' = 
'NULL',
'_origin_class' 
= 'FindMeOn::RoseDB',
'domain' = 
'config',

'connect_options' = undef,
'dsn' = 
'dbi:Pg:dbname=NULL;host=localhost',
'dbh' = bless( 
{}, 'Apache::DBI::db' ),
'id' = 
'configconfig',
'type' = 
'config',
'driver' = 'pg'
  }, 
'FindMeOn::RoseDB::__RoseDBPrivate__::Rose::DB::Pg' ),
'id'= 1,
'name'= 'test',
 }, 'FindMeOn::RoseDB::Object::UseraccountFindmeon' ),

however in posting this message , I realized that the db connect info  
i'm seeing in this is from the null db connection i have as a default  
object configuration.  that makes most sense, as
this was a pull from a manager class-- and when I override the dbh, i  
supply a new RoseDB object via this:

sub make__rose_db_obj {
my  ( $dbh )= @_;
my  $rdb_obj= FindMeOn::RoseDB-new();
$rdb_obj-{'dbh'}= $dbh;
return $rdb_obj;
}

Seeing all those connect and config options makes perfect sense - but  
brought up some questions about rose.

And here they are:

1)  Just to make sure -- are the objects returned by the manager  
inheriting that particular instance of the db (including the dbh  
override) ?  or are they making a new class instance of the dbh ?  i  
know that a set of manager objects share a single db stashed in the  
first item, i'm just wondering if that db object a reference to the  
object the manager was called with, or a new instance of the same  
class.  i think its a reference to the existing object - i just want  
to make sure.

2)  what would be a good way to kill the db connection ?  i was  
thinking of a helper method as simple as this:

sub reset__db_obj {
my  ( $self )= @_;
$self-db( FindMeOn::RoseDB-new() );   # this has no 
valid  
connectivity
}

3)  what about making the get method 'dbh' a get/set?

4)  this is really trivial, but what about renaming the internal  
stash 'db' to __db -- i don't mean to change the accessor name, but  
just where it stashes the info.  all of the rose db 'operational'  
data and metadata seems to be nicely stashed away to 'private'   
styled names, while column names are plaintext.

thanks,

// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
| SyndiClick.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|  FindMeOn.com - The cure for Multiple Web Personality Disorder
|  Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|  RoadSound.com - Tools For Bands, Stuff For Fans
|  Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - 

Re: [RDBO] some db parameter questions

2007-02-08 Thread Jonathan Vanasco

On Feb 8, 2007, at 3:50 PM, John Siracusa wrote:

 Is FindMeOn::RoseDB a Rose::DB subclass?  If so, it has a dbh()  
 method that
 takes an argument:

 http://search.cpan.org/dist/Rose-DB/lib/Rose/DB.pm#dbh

 No need to be evil and reach into its hash :)

Yes!   When I started doing this , dbh was only a get ( ~ Rose::DB v . 
72 ) -- so i had to be evil.

Great update!


 Kill?  Why not just set share_db = 0 in your Manager call to  
 keep any of
 the returned RDBO-derived objects from having a db at all?

I want them to have a DB initially.

begin
fetch
manipulate, save
commit / rollback
kill db

do more stuff that is read only.  error out if i try to save  
anything ( no db )

begin
set db
load?
manipulate
commit rollback

its some evil dev testing stuff.  not production :)

 3) what about making the get method 'dbh' a get/set?
 :)

i'm hoping thats a yes... make it inline with the same awesome new  
functionality in RoseDB

Though I guess now one could just do...
$rose_db_object-db-dbh( $dbh );

though that looks really pythonic :)

 You should never know what those keys are anyway! :)  (Also, column  
 values
 are stored in a few places, not just under the expected unadorned  
 names.)

I know -- thats why its trivial.
I was just looking to muck around with some helper functions and have  
some internal prefix as namespacing , and noticed that all of the  
rose stuff had some sort of prefix -- except db


// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
| SyndiClick.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|  FindMeOn.com - The cure for Multiple Web Personality Disorder
|  Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|  RoadSound.com - Tools For Bands, Stuff For Fans
|  Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -


// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
| SyndiClick.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|  FindMeOn.com - The cure for Multiple Web Personality Disorder
|  Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|  RoadSound.com - Tools For Bands, Stuff For Fans
|  Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -



-
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] some db parameter questions

2007-02-08 Thread John Siracusa
On 2/8/07 5:28 PM, Jonathan Vanasco wrote:
 I want them to have a DB initially.
 
 begin
 fetch
 manipulate, save
 commit / rollback
 kill db
 
 do more stuff that is read only.  error out if i try to save
 anything ( no db )
 
 begin
 set db
 load?
 manipulate
 commit rollback

Ah, then yeah, you need to replace all the dbs with versions that don't
point to anything.  If you just remove the dbs, new ones will be created
on demand (by calling init_db()).

 3) what about making the get method 'dbh' a get/set?
 :)
 
 i'm hoping thats a yes...

Er, that's a it already is a get/set method in the latest version.

-John



-
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] some db parameter questions

2007-02-08 Thread Jonathan Vanasco

On Feb 8, 2007, at 5:35 PM, John Siracusa wrote:

 Ah, then yeah, you need to replace all the dbs with versions that  
 don't
 point to anything.  If you just remove the dbs, new ones will be  
 created
 on demand (by calling init_db()).

perfect.   for my purpose then, i'm just going to make
kill_db
alias
init_db
which is a non-functional rose::db object



 3) what about making the get method 'dbh' a get/set?
 :)

 i'm hoping thats a yes...

 Er, that's a it already is a get/set method in the latest version.

http://search.cpan.org/~jsiracusa/Rose-DB-Object/lib/Rose/DB/ 
Object.pm#dbh

and

sub dbh
{
   my($self) = shift;

   return $self-{'dbh'}  if($self-{'dbh'});

   my $db = $self-db or return 0;

   if(my $dbh = $db-dbh)
   {
 return $self-{'dbh'} = $dbh;
   }
   else
   {
 $self-error($db-error);
 $self-meta-handle_error($self);
 return undef;
   }
}


there's no set there :(

maybe you're speaking of svn?

i'm just going to do

$rose_db_obj-db-dbh( $dbh )

which does the same thing.

what's with
$self-{'dbh'}
anyways?

it doesn't seem to have a set anywhere in the class

aside from the get method, the only thing  setting the var is this:

sub db
...
 $self-{'db'}  = $new_db;
 $self-{'dbh'} = undef;
...





// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
| SyndiClick.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|  FindMeOn.com - The cure for Multiple Web Personality Disorder
|  Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|  RoadSound.com - Tools For Bands, Stuff For Fans
|  Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -



-
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] some db parameter questions

2007-02-08 Thread Jonathan Vanasco

On Feb 8, 2007, at 5:58 PM, John Siracusa wrote:

 Oh, *that* dbh :)

hence the confusion :)

 That's some old, probably now inappropriate code.  I'll
 change it to what the docs say it should be: a proxy for db-dbh()

you should rip out the references to self-{'dbh'} in that class  
too.  they do nothing but consume memory :)

// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
| SyndiClick.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|  FindMeOn.com - The cure for Multiple Web Personality Disorder
|  Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|  RoadSound.com - Tools For Bands, Stuff For Fans
|  Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -



-
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] some db parameter questions

2007-02-08 Thread Jonathan Vanasco

On Feb 8, 2007, at 5:58 PM, John Siracusa wrote:

 On 2/8/07 5:54 PM, Jonathan Vanasco wrote:
 Er, that's a it already is a get/set method in the latest version.

 http://search.cpan.org/~jsiracusa/Rose-DB-Object/lib/Rose/DB/
 Object.pm#dbh

 Oh, *that* dbh :)  That's some old, probably now inappropriate  
 code.  I'll
 change it to what the docs say it should be: a proxy for db-dbh()

actually, how do you feel about this replacement routine?

sub dbh
{
my($self,$new_dbh) = shift;

my $db = $self-db or return 0;

if ( defined $new_dbh )
{
$db-dbh( $new_dbh );
}

if(my $dbh = $db-dbh)
{
  return $dbh;
}
else
{
  $self-error($db-error);
  $self-meta-handle_error($self);
  return undef;
}
}

which makes it get-set -- and in terms of the db object.
plus i killed the internal caching you did, which made no sense to me.

diff-wise, it would be:

sub dbh
{
-   my($self) = shift;
+  my($self,$new_dbh) = shift;

-   return $self-{'dbh'}  if($self-{'dbh'});

my $db = $self-db or return 0;

+   if ( defined $new_dbh )
+   {
+   $db-dbh( $new_dbh );
+   }

if(my $dbh = $db-dbh)
{
- return $self-{'dbh'} = $dbh;
  return $dbh;
}
else
{
  $self-error($db-error);
  $self-meta-handle_error($self);
  return undef;
}
}










// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
| SyndiClick.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|  FindMeOn.com - The cure for Multiple Web Personality Disorder
|  Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|  RoadSound.com - Tools For Bands, Stuff For Fans
|  Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -



-
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


[RDBO] overloading Rose::DB-dbh

2007-02-08 Thread Michael Reece
trying every which way to make Rose::DB::Object(s) always use my  
custom global $dbh,

   package Vinq::RDB::MySQL;
   use base 'Rose::DB';

   use Vinq::Globals qw( $dbh );

   __PACKAGE__-use_private_registry;
   __PACKAGE__-register_db(driver = 'mysql');

   sub dbh { $dbh }
   sub driver { 'mysql' }

   1;


things were working great until i tried to

   $junk-add_stuff({ name = 'stuff 1' });
   $junk-save;


which leads to a '$db-commit or die $db-error;', but commit() says  
(in Rose/DB.pm):


   sub commit
   {
 my($self) = shift;

 return 0  unless(defined $self-{'dbh'}  $self-{'dbh'} 
{'Active'});

 my $dbh = $self-dbh or return undef;
 ...


but while $self-dbh returns my $dbh, $self-{'dbh'} hasn't been set  
so it dies (with no error).


are there any docs/tutorials/testimonials about successfully using  
your own $dbh?


-
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] overloading Rose::DB-dbh

2007-02-08 Thread Jonathan Vanasco

On Feb 8, 2007, at 7:24 PM, Michael Reece wrote:

 trying every which way to make Rose::DB::Object(s) always use my
 custom global $dbh,


i have no idea why your package isn't working (i have a few ideas,  
but no time to test)

i suggest trying this approach, which is essentially what i do:

package Vinq::RDB::Object;
use Vinq:: Globals ();
use Vinq::RDB::MySQL ();
use Rose::DB::Object ();
use base qw(Rose::DB::Object);

sub init_db {
my $db= Vinq::RDB::MySQL-new();
$db-dbh( $Vinq::Globals::dbh );
return $db;
};

Then have objects inherit from Vinq::RDB::Object instead of  
Rose::DB::Object.

My system is different, I keep a 'bad' dbh by default and stuff a  
valid dbh manually after i get a read/write/config dbh from a factory  
class.

// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
| SyndiClick.com
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|  FindMeOn.com - The cure for Multiple Web Personality Disorder
|  Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -
|  RoadSound.com - Tools For Bands, Stuff For Fans
|  Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - - - - -



-
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] some db parameter questions

2007-02-08 Thread John Siracusa
On 2/8/07 6:10 PM, Jonathan Vanasco wrote:
 actually, how do you feel about this replacement routine?

That looks pretty much like what I checked in after my previous reply :)

(still hunting for all the $self-{'dbh'} instances...)
-John



-
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


[RDBO] timezone for magical 'now' value in datetime columns

2007-02-08 Thread Michael Reece
if i do something like

   $obj-my_date('now');
   $obj-save;

i get UTC times.  i see that i can define the column as

   saved_on = { type = 'datetime', time_zone = 'America/New_York' }

and get the right datetime value, but is there an easy way to  
influence the timezone on all DateTime objects created by  
Rose::DB::Object?

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



-
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


[RDBO] idea for new object manager functionality

2007-02-08 Thread Jonathan Vanasco

I've been doing a lot of repetitive operations on the results from  
manager functions lately.

Today I think I realized a functionality that might make sense -- if  
the results returned by a manager call weren't simply an array, but a  
class object.

It would behave just as an array - there would be no real difference  
in current functionality.  perhaps a tied array or blessed reference.

By default, there would be a Rose::DB::Object::ManagerResult class  
that does basically nothing but support common array functions.

Calls to manager functions would then accept a manager_result_class  
parameter , which is the name of the class to return the result as  
( defaults to Rose::DB::Object::ManagerResult )

given a list of manager results, one can then further filter the  
results without hitting the db, or easily loop through the items to  
do a repetitive task

ie: 
my  $past_addresses= manager_get_past_addresses_for_userid( 1 );
my  $ny_addresses= $past_addresses-get_limit_to_ny();
$past_addresses-mark_as_private();

there are a lot of pros and cons to this approach, and it can get  
utterly confusing to some...

but i think it could be pretty neat.

opinions ?

// Jonathan Vanasco

| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| FindMeOn.com - The cure for Multiple Web Personality Disorder
| Web Identity Management and 3D Social Networking
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -
| RoadSound.com - Tools For Bands, Stuff For Fans
| Collaborative Online Management And Syndication Tools
| - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  
- - - - - - - - - - - - - - - -



-
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