[RDBO] Rose Loader and relationships

2006-09-16 Thread James Masters
For the record, I am just forwarding a reply to an email that JohnS kindly sent to me in reply to a question about the Rose Loader. > Also, once I've auto-initialised a package/table using Loader, presumably it won't know > the relationships (under MySQL). Can I add the relationships afterwards

[RDBO] Rose Loader

2006-09-16 Thread James Masters
For the record, I am just forwarding a reply to an email that JohnS kindly sent to me in reply to a question about the Rose Loader. > Also, once I've auto-initialised a package/table using Loader, presumably it won't know > the relationships (under MySQL). Can I add the relationships afterwards

[RDBO] Relationships under MySQL

2006-09-18 Thread James Masters
might just be the way the documentation is written to avoid too much clutter, though - not sure. Is it feasible to replace all those table .pm files or the Extra.pm files with a single .pm file? thanks for your help, James Masters. -

[RDBO] Relationships - can't locate object method

2006-09-19 Thread James Masters
Hello, I'm hoping some kind person will be able to help me progress to get relationships working as I've tussled with this problem for quite some time. I've set up 2 tables to test with. I've tried to keep it simple and renamed everything to adhere to default conventions as given in the docs. So

Re: [RDBO] Relationships - can't locate object method

2006-09-19 Thread James Masters
Or maybe someone can help me to help myself by letting me know how I can list all the methods for a Class? This ought to be easy too but I can't see it in my Perl Cookbook or anywhere else either. > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] >

Re: [RDBO] Relationships - can't locate object method

2006-09-19 Thread James Masters
> Why do you need to add the "booktype" releationship in your ::Extra > class if it's already there immediately after the make_classes() call? The post_init_hook that grabs the "Extra" relationship info seems to be creating the booktype relationship (I thought correctly) in metainfo. The make_cla

Re: [RDBO] Relationships - can't locate object method

2006-09-19 Thread James Masters
OK, thank you very much. In starting to do this, I've just done something similar to you - I put all the pertinent code in a single file (but not all the package info (mainly because I'm not sure how one can put all the package info in a single file)) and it works(!). I guess I've made some dumba

[RDBO] package confusion - Base class package is empty.

2006-09-21 Thread James Masters
I've now written a script that generates the table class .pm files for my database using the Loader. (This works around the problems I was having just using Loader by itself and is also a better way of doing things, I gather). After doing this I struggled for some time to get the packages working

Re: [RDBO] package confusion - Base class package is empty.

2006-09-22 Thread James Masters
> That's because your editor hasn't picked up where your modules are > living. Yes, you are right of course. This has made me wonder if I'm putting them in the right place. My db is called GARD so I simply created a dir under cgi-bin called GARD and put the DB.pm and the table modules in there.

Re: [RDBO] package confusion - Base class package is empty.

2006-09-28 Thread James Masters
bottom of each table class module? Or is this inadvisable for some reason? If the answers are no and no, then I guess I can write a few lines to add it in myself. Or I can just use the Managers, no big deal. Just trying to ascertain what's best. thanks, James Masters. > -Original

[RDBO] Elegant way to generically query a table?

2006-10-14 Thread James Masters
I'm trying to write generic code that will work for any table. The following does work but it's ugly. (I'm still just prototyping so please excuse the nofrills output format). I suspect I'm labouring under all sorts of naive misunderstandings. Does anyone know ways to improve this? In particul

Re: [RDBO] Elegant way to generically query a table?

2006-10-17 Thread James Masters
> In other words, all the methods created for you in your > *::Manager classes > are trivial wrappers around Rose::DB::Object::Manager's get_objects() > method, but with an object_class parameter value hard-coded. > So if you want > to generically query a table, and you know the name of the > class

Re: [RDBO] Elegant way to generically query a table?

2006-10-19 Thread James Masters
Hi John et al, This is all working wonderfully. But now I want to do a similar thing with an individual record for which I know the primary key value. I assume it's quickest/best to use Rose::DB::Object rather than Manager in this case. But I can't see in the documentation how to specify the cla

Re: [RDBO] Elegant way to generically query a table?

2006-10-20 Thread James Masters
ay to generically query a table? > > > On 10/20/06 2:37 AM, James Masters wrote: > > This is all working wonderfully. But now I want to do a > similar thing with > > an individual record for which I know the primary key > value. I assume it's > > quickest/b

Re: [RDBO] SET support for MySQL

2006-11-15 Thread James Masters
> SET and ENUM in mysql are super dangerous. > They promote really bad design patterns and lock people > into MySQL > specific schema that is a "Complete Fucking Nightmare" to port to > another DB system. If people did a standard normalized schema, no > issues would occur when porting

[RDBO] Beginner q. on date

2007-03-13 Thread James Masters
I'm converting an old textual database to MySQL with Rose. MySQL has 3 options for a date: a date -00-00 NULL My scripts currently have a date either as "" or a date. So presumably my empty date "" needs to be mapped to either -00-00 or NULL in MySQL. I've searched the documentation wit

Re: [RDBO] Beginner q. on date

2007-03-15 Thread James Masters
Thanks to all who answered. Aagh - now I have 2 opposing answers. But I enjoy a debate. 8o) I don't quite see this point around special checks being required if I make "no date" equal NULL. If I choose the NULL route, then I will likely need to say if (!defined($date)) in my code. But if I cho

[RDBO] Transactions, ACID etc.

2007-03-16 Thread James Masters
Just wondering - does Rose deal with transactions, rollbacks etc. "under the hood" (or "under the bonnet" as we say in England) and is therefore ACID compliant? I realise that this will depend upon the capabilities of the underlying database Unfortunately, all my tables are MyISAM but am wond

[RDBO] Migration from legacy basic DBI to Rose?

2007-03-16 Thread James Masters
I am using Rose for one application and as it's very excellent, I have been working to convert another old application to it. For this, I have a library of large scripts that have been developed over several years and which use basic DBI. They use database fields that end up as hashes because I d

[RDBO] Best way to do multiple calls to database

2007-03-26 Thread James Masters
A fundamental question has occurred to me. In my legacy code, I do a single call to the database and load (for the sake of arg), an entire table into a hash right at the start. e.g. If I have a table of suppliers, I will construct a hash with the first key as the suppliercode and subkeys correspo

Re: [RDBO] Best way to do multiple calls to database

2007-03-28 Thread James Masters
Thanks for your very helpful reply, Jonathan. It answered my general question but I'm left with a couple of more specific ones. Pl. see in line. > I do that with ~20 tables that hold data I consider 'constants'. If > this data is unchanging, there's no need to continually hit the db. > ( note,

Re: [RDBO] Best way to do multiple calls to database

2007-03-29 Thread James Masters
Sorry let me rewrite my q. again more accurately: Here is a real example. Having already loaded all products with Rose, I now want to see how many of a product are at a particular location which comes from a one_to_many relationship with another table "locations". With my old hash method of doin

Re: [RDBO] Best way to do multiple calls to database

2007-03-29 Thread James Masters
> > do a Rose call and then iterate through all the objects creating a > > hash? I've now written something to do this. > > Pretty much, yes. > Some of it is done via rose + a loop, but much is done via generic > sql queries too. > my applications are only ~50% rose > fwiw, i also do this: ( c

[RDBO] Bizarre. New PC. Everything faster except Rose which is 5X slower!

2007-04-20 Thread James Masters
s the new MySQL is much faster for a straightforward DBI/DBD query. Also, I know that I'm not on the latest version of Rose but I wanted to keep both machines on the same version to avoid suspicion that different versions of Rose are having some

Re: [RDBO] Bizarre. New PC. Everything faster except Rose which is5X slower!

2007-04-20 Thread James Masters
16:30 > To: Rose::DB::Object list > Subject: Re: [RDBO] Bizarre. New PC. Everything faster except > Rose which > is5X slower! > > > On 4/20/07, James Masters <[EMAIL PROTECTED]> wrote: > > I just can't imagine what's going on here. Thanks for any pointers, >

Re: [RDBO] Bizarre. New PC. Everything faster except Rose which is5X slower!

2007-04-20 Thread James Masters
That was a good idea, thanks. But the indexes seem to match on both machines (in fact, the table in question only has the one). I'm not familiar with these concepts but have started to look into it. I see that in order to do 'explain', I must run it against the select statement in question. I k

Re: [RDBO] Bizarre. New PC. Everything faster except Rose which is5X slower!

2007-04-21 Thread James Masters
> Sorry, I'm late to the party. What OS/Perl version/dist on > Old/New again? Both are on Win XP with latest patches. Perl is v5.8.7 built for MSWin32-x86-multi-thread (with 14 registered patches...). Activestate. Installed via CamelPerl. Most additional modules incl. Rose ones come from the Wi

Re: [RDBO] Bizarre. New PC. Everything faster except Rose whichis5X slower!

2007-04-21 Thread James Masters
; Subject: Re: [RDBO] Bizarre. New PC. Everything faster except Rose > whichis5X slower! > > > On 4/20/07, James Masters <[EMAIL PROTECTED]> wrote: > > how can I see exactly what select statement Rose is doing? > > Either turn on DBI->trace(...) or set these varia

Re: [RDBO] Bizarre. New PC. Everything faster except Rose whichis5Xslower!

2007-04-21 Thread James Masters
After tinkering for some hours, I've finally made some progress using Dprof. I now have a test program on my new fast server that does only the single ultra-simple Rose Manager call: get_products. If I run dprofpp -r to show actual time, then the following is revealed: C:\Information\mgroot\cgi-bi

Re: [RDBO] Bizarre. New PC. Everything faster except Rosewhichis5Xslower!

2007-04-21 Thread James Masters
reverse lookup timeouts were much longer than 2 secs but apparently not in my case. Ah, well. Maybe the solution to my nightmare will turn out to be useful for someone else in the future. > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > Behalf Of James

[RDBO] make methods error

2007-05-21 Thread James Masters
ut "address" is a valid relationship for another class so it possible that Rose defines inerited classes in a way that I don't understand somehow? thanks, James Masters. - This SF.net email is sponsored by DB2 Ex

Re: [RDBO] make methods error

2007-05-21 Thread James Masters
n calls and their arguments.? thanks, James. > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of John > Siracusa > Sent: 21 May 2007 19:59 > To: Rose::DB::Object list > Subject: Re: [RDBO] make methods error > > > On 5/21/07, Jame

Re: [RDBO] make methods error

2007-05-22 Thread James Masters
MAIL PROTECTED] > Behalf Of James > Masters > Sent: 21 May 2007 21:20 > To: 'Rose::DB::Object list' > Subject: Re: [RDBO] make methods error > > > Thanks, John. Well it does point to it being my error but I > just can't see > it:- perhaps I have a syntax err

[RDBO] Unable to query using sub-tablename

2007-05-24 Thread James Masters
t2, and "code_names" # is t3. You can read more about automatic table aliasing in # the documentation for the get_objects() method below. # # "category.name" and "categories.name" would work too, since # table and relationship names are also valid pre

[RDBO] html and DB and Rose

2007-05-24 Thread James Masters
7;. Questions for general discussion as well as for my own selfish purposes! thanks, James. Masters Traditional Games +44 (0)1727 855058 http://www.mastersgames.com - This SF.net email is sponsored by DB2 Express Dow

Re: [RDBO] Unable to query using sub-tablename

2007-05-25 Thread James Masters
> Table or relationship names can be used in the value of the "query" > parameter, but the with_objects and require_objects parameters only > accept foreign key and relationship names. I think the error you got > is because you put productlocs in your with_objects arg. Please test > and let me kn

Re: [RDBO] html and DB and Rose

2007-05-25 Thread James Masters
Thanks for the answers. I'm not quite clear on RHTMLO usage, though. When I asked can I put the metadata of a DB column into an HTML Object somehow and it would automatically create the appropriate html form element, you said: > RHTMLO divorces the concept of a "field" from a single HTML element

[RDBO] relationships -> foreign keys

2007-05-29 Thread James Masters
I'm think I'm going to have to change my MyISAM to InnoDB for foreign keys (if I can pluck up the courage...) Rose clearly cleverly deals with cascading deletes etc. regardless of whether foreign keys are used or not. But where foreign keys are in use, if I delete a parent table, does Rose know n

Re: [RDBO] relationships -> foreign keys

2007-05-29 Thread James Masters
Really helpful, thanks very much. The answers are all better than I hoped for! > When auto_initialize()ing, RDBO will create most "reverse" one-to-many > relationships. Read the docs for the "with_relationships" option > here: > > http://search.cpan.org/dist/Rose-DB-Object/lib/Rose/DB/Object/ Me

[RDBO] require class

2007-06-04 Thread James Masters
If I do: require My::Class then it works. But it does not work if I do: my $classname = 'My::Class' require $classname Most of my code uses $classname for all my Rose functions but I'd like to only "require" if required (if you see what I mean). Is it not possible? Sorry if this is a PERL q.

[RDBO] on the fly fields

2007-06-22 Thread James Masters
Basic question. As with all database work, when I write a report, sometimes I need to show a column which is not a field but is calculated on the fly from fields in the database. Does Rose facilitate such "display-only" fields in some way? Thought it was worth asking if there was a "correct" way

Re: [RDBO] on the fly fields

2007-06-24 Thread James Masters
> > Does Rose facilitate such "display-only" fields in some way? > > write a function in the rose class Thanks. I've got this working but have hit 2 probs. The first is that my classes are automatically generated and adding the functions to the Extra.pm doesn't work. However, this is not a

Re: [RDBO] on the fly fields

2007-06-25 Thread James Masters
> > classes are automatically generated and adding the > functions to the Extra.pm > > doesn't work. > > Why not? Well I don't really understand properly how this Extra.pm file works so am probably doing something wrong then, but I just added the functions in the file viz: package GARD::Book::Extr

Re: [RDBO] on the fly fields

2007-06-26 Thread James Masters
> There's some experimental support for stuff like that, but it > will require you to define a new column class: > > http://www.mail-archive.com/rose-db-object@lists.sourceforge.net/msg00710.ht ml Thanks for the suggestion. I can see it's a clever workaround. I'm having a try but am really pushi

Re: [RDBO] on the fly fields

2007-06-26 Thread James Masters
> The post_init_hook specifies code that will run after each class is > initialize()d. It won't cause any code to be written to the actual > .pm files produced by make_modules(), however. For that, look into > the module_postamble parameter: > > http://search.cpan.org/dist/Rose-DB-Object/lib/Rose

Re: [RDBO] on the fly fields

2007-06-26 Thread James Masters
> > 1. I have to create a custom column class. After much tinkering, have managed to get this working, thank you, although it is a bit of a hack. The difference from the prev. example in the forums is that 'code' seems to be a real field in the table. I need to use a derived SQL function which

Re: [RDBO] on the fly fields

2007-06-27 Thread James Masters
Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of John > Siracusa > Sent: 27 June 2007 00:10 > To: Rose::DB::Object list > Subject: Re: [RDBO] on the fly fields > > > On 6/26/07, James Masters <[EMAIL PROTECTED]> wrote: > > I dec

Re: [RDBO] on the fly fields

2007-06-27 Thread James Masters
t's my ignorance as usual or just something to live with. > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of John > Siracusa > Sent: 27 June 2007 14:29 > To: Rose::DB::Object list > Subject: Re: [RDBO] on the fly fields > &

Re: [RDBO] on the fly fields - report

2007-07-03 Thread James Masters
After playing some more with on-the-fly fields, I thought I should report back. There have been 2 suggested methods. 1. I have successfully created fields as functions in the rose class as suggested by JonathanV. These work nicely. Also, I have managed to enable these to be generated automatica

Re: [RDBO] on the fly fields

2007-07-03 Thread James Masters
Using a column class to define an on-the-fly field is working fine for one table but I think it has a bugette when you use a join. Simplified example for the query: object_class - GARD::Book sort_by - C_sourceyear query - [bookowners.ownercode => {like => '%JB%'}] with_objects - [bookowners] pro

Re: [RDBO] on the fly fields

2007-07-03 Thread James Masters
> In SVN, scalar refs are now passed through unmodified when they appear > as sort_by args. So this should work for you in 0.765: > sort_by => [ \q(C_sourceyear) ] John, That is really excellent, thank you. I have written a temporary sort in PERL for now using a function display column but i

[RDBO] Manager queries with secondary table and "or"

2008-01-10 Thread James Masters
staddress.primecontact' => {like => '%smith%'}]); it fails with: Invalid query parameter: destaddress.primecontact at oprosemgord.pl line 991 at C:/Perl/site/lib/Rose/DB/Object/QueryBuilder.pm line 132 Am I doing something stupid or can one not do relationships within an "

Re: [RDBO] Manager queries with secondary table and "or"

2008-01-10 Thread James Masters
ilto:[EMAIL PROTECTED] Behalf Of John Siracusa Sent: 10 January 2008 13:40 To: Rose-DB-Object Subject: Re: [RDBO] Manager queries with secondary table and "or" On 1/10/08 8:19 AM, James Masters wrote: > Have a bit of trouble with a Manager query. Trying to keep it short and > sweet

[RDBO] Too Many connections

2008-01-10 Thread James Masters
Another new odd thing happened today. Have a program that has worked fine for sometime but today it had to suck in more data than ever before and produced: Too many connections at C:/Perl/site/lib/Rose/DB.pm line 828 This seems to be a common error and simply means I've broken the default restric

Re: [RDBO] Manager queries with secondary table and "or"

2008-01-10 Thread James Masters
I don't think I'm going mad (but am usually proved wrong). Here is a test routine: sub gdb_get_orders_test { my $testspec1 = {require_objects => 'destaddress', query => ['destaddress.primecontact' => {like => '%smith%'}]}; my ($mysqlorders1, $mysqlerr1) = rose_get_orders($testspec1); print "Foun

Re: [RDBO] Too Many connections

2008-01-11 Thread James Masters
John Siracusa Sent: 11 January 2008 01:25 To: Rose-DB-Object Subject: Re: [RDBO] Too Many connections On 1/10/08 5:30 PM, James Masters wrote: > Looking into this, I seem to simply be doing the following in a "for" loop > more than 100 times: > > my $shipobj = MGORD::Shipment-&g

Re: [RDBO] Manager queries with secondary table and "or"

2008-01-11 Thread James Masters
Beautiful, thanks. That has fixed it. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of John Siracusa Sent: 11 January 2008 01:11 To: Rose-DB-Object Subject: Re: [RDBO] Manager queries with secondary table and "or" On 1/10/08 8:09 PM, John Siracusa wrote: >

[RDBO] redundant rows from queries with multiple one to many relationships

2008-01-31 Thread James Masters
Dear Rosers, I have never fully understood the implications of this message: WARNING: Fetching sub-objects via more than one "one to many" relationship in a single query may produce many redundant rows, and the query may be slow I have avoided doing such queries until now but now I have reached

Re: [RDBO] redundant rows from queries with multiple one tomanyrelationships

2008-02-01 Thread James Masters
; ;-) Justin > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On > Behalf Of James Masters > Sent: Thursday, January 31, 2008 6:39 AM > To: Rose::DB::Object list (E-mail) > Subject: [RDBO] redundant rows from queries with multiple one > to