Hi,
I wonder if there is a shortcut for multi level relationships.
I have three tables in a relationship like 'cities', 'states' and
'countries'. Now I would like to say something like
print $city-country-name;
I know how to to it in two steps (first get the state then the
country from there)
Hello again,
I just started a project with Rose::DB::Object and I must say I am
very impressed. It is really great!
But still, I run into one or the other problem. I hope it is o.k. to
ask these beginner questions.
At the moment something drives me crazy that can be destilled to
these few
Hello again,
I found out about my problem from yesterday. It was all (well almost)
my fault. In the database definition I had forgotten the 'INTEGER'
qualifier but in the class definition everything was all right. Now
these two didn't fit together and I got these mysterious effects.
I say
On 21 Feb 2006, John Siracusa wrote:
SQLite really has no concept of SQL data types. Well, it has a very
simplified concept, anyway. All that detail you put in your CREATE
TABLE statements is pretty much ignored by SQLite. Instead, it stores
everything as strings and integers (and maybe
On 21 Feb 2006, John Siracusa wrote:
Thanks for your answer and sorry for my late reply, I couldn't work
on my project for a few days.
Ah, okay. For the record, I use an object-based approach to this kind of
thing by using Rose::HTML::Objects to manage my forms. Anyway, getting a
hashref
On 14 Mar 2006, John Siracusa wrote:
On 3/14/06 4:17 AM, Michael Lackhoff wrote:
Is it possible to either define a default sort_by clause in the
relationship definition
See Uwe's earlier response for how to do this.
Yes, that works great. Thanks!
or when the relationship method
On 14 Mar 2006, Uwe Voelker wrote:
$meta-relationships
(
changes = {type = 'one to many',
class= 'Changes',
column_map = {ID = 'AUFTRAG'},
manager_args = {sort_by = 'CHANGES.DATUM DESC'},
Say, I have two tables: vendors and products.
Now I want a list of all the vendors that have no products yet.
This can be seen from the products table if there are no records with
the vendor_id of the vendor in question.
Is this possible with a 'normal' manager method or with a
relationship or
Hello John,
I did some more testing, got it working but still don't understand
everything.
This should work:
$vendors =
Vendor::Manager-get_vendors(
with_objects = [ 'products' ],
query= [ 'products.vendor_id' = undef ]);
Yes, this works fine.
That
Just for the record, I found it.
'NOT EXISTS (SELECT * FROM products p WHERE p.vendor_id = id)';
$vendors = Vendor::Manager-get_vendors(clauses = [ $subselect ]);
This doesn't work for me (result list is empty but should have two
entries). If I change the $subselect to
On 4 Apr 2006, John Siracusa wrote:
Rose::DateTime:
0.52 (04.04.2006) - John Siracusa [EMAIL PROTECTED]
* Allow negative and fractional epoch values in parse_date().
* Fixed a bug in the -mm-dd date parsing that caused it to
incorrectly match 10-digit
Hello,
I am trying to write an authorization handler in mod_perl and got a
very strange behaviour.
What I want to achieve is use the group memberships stored in a
database that is handled by RDBO to restrict access to some parts of
my application.
This script works perfectly well when run
On 30 Apr 2006, John Siracusa wrote:
I can't think of any reason this would behave any differently under
mod_perl.
You are right. Sorry, it was another one of these silly mistakes. I
have two perl installations, one as a normal installation and
another one that came with apache, this is the
Hello John,
thanks for your help on my negative groups question. I used the
manager method as you suggested and it is working fine now!
But as you might have guessed by now I ran into a new problem. (By
the way, if I am asking too many questions just stop me. Then I will
only ask again when I
On 5 May 2006, John Siracusa wrote:
There's no way around copying every field when making a copy! :) That's
just what RDBO's (undocumented) clone() method does. It's not documented
because I'm not sure if it does everything that a clone method should do.
You can be the first to try it and
On 29 May 2006 at 13:21, Svilen Ivanov wrote:
I would like to extend RDBO to support versioning of properties for each
instance. To explain it better I will use analogy with CVS:
* calling -save will make new revision of the object (cvs commit)
* -load(id=1) will get by default
Hello,
in my application I have a hierarchy of company, organisational unit
and sub-unit. Some data should be configurable on every level but not
compulsory on every level. If it is not defined for the sub-unit it
should be taken from the unit and if it is not there from the
company.
An
On 5 Sep 2006, John Siracusa wrote:
As for the uniqueness issue, if the combination really is
unique, then why not add a unique key to the database and the class?
Then you can load() speculatively instead of doing a Manager query.
That's what I was looking for. Thanks for the hint, I didn't
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
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
{
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
On 30 Jan 2007 at 17:00, John Siracusa wrote:
id is in $session, which the form knows nothing about. But in most
web app frameworks, there's usually some way to get at globally
applicable data like the session, in which case it's reasonable for
customer_from_form() to return you an object
On 31 Jan 2007 at 8:52, John Siracusa wrote:
I don't use CGI::Application, so maybe I'm misunderstanding how it works,
but how about a class method that returns the current CGI::Application
object? e.g., MyWebSite-current_app(). You'd set it at the beginning of
each request. Then, in your
Hello,
I had to change a relationship from a simple ID to ID relationship to
one that also includes a second ID.
Worse still the second ID is not a column in one of the relationship
partners but has to be taken from a record two steps up the hierarchy.
Perhaps I will change the table to
I am using Apache2::AuthCookie for my authentification and authorisation. For
both I have to get
the user record from the database.
For authorisation I have to do an additional lookup for an ordinary item that
is requested by the
user. I need this record to check e.g. if the requested item
On 22 Jun 2007 at 10:03, Perrin Harkins wrote:
On 6/22/07, Michael Lackhoff [EMAIL PROTECTED] wrote:
Thanks for the hint! This almost did it. Some tests showed that I had
to use the connection-variant of pnotes in my setup:
use Apache2::ConnectionUtil;
# grab the connection object
Hello,
I read quite a lot recently about Apache::DBI, transactions and the problems
that might occur but I
must say that I am more confused than before as to what this all means for my
RDBO project.
It is a web app with lots of database activity (read and write). So performance
and data
Hello,
I just stumbled upon a changed behaviour that causes my app to crash
with RDBO 0.764 (works with 0.758).
The problem occurs in a method that should give me all the groups a
user (therapeut in my case) is not in:
sub notingroups {
my $self = shift;
my $nr = $self-nr; # user id
John Siracusa wrote:
Okay, I've made the change in SVN. RDBO 0.765 will have tN table
aliasing on by default, even for queries that only involve a single
table. The new table_aliases Manager parameter can be used to force
the old behavior.
Thanks!
-Michael
Hello,
I would like to have the possibility to link from one record to other records
in many other tables,
something like this:
in table dates:
id = 1
when = 2007-07-04 14:00
... some more fields
a mapping table would look like this:
date_id = 1
link_id = 5
link_table = customers
date_id = 1
Hello,
I am trying to use Rose::DB for a new project that uses an Oracle
database but the connection is done with DBI::Proxy (then I don't have
to install DBD::Oracle on every machine that accesses the database)
After reading the docs the best I could manage was this:
My::DB-register_db(
Hello,
I thought I understood how to organize several write operations within a
transaction but it still doesn't work the way I do it.
Here is what I have so far:
In my base class:
sub init_db {
my $self = shift;
my $db;
if (not $self-my_db) {
$self-my_db( MyApp::DB-new() );
On 14.08.2007 16:54 Perrin Harkins wrote:
$db-begin_work; # Start transaction
die Does it roll back?;
$db-commit;
I don't see any rollback there. It's a common practice to put an
Well, my understandig was that if perl dies within a transaction it (or
DBI) would do a rollback, from your
On 14.08.2007 17:50 Perrin Harkins wrote:
do you have any pointer on how this is done (correctly)?
$r-push_handlers(PerlCleanupHandler = sub {
MyApp::DB-rollback();
});
Thanks! That's exactly what I needed. I found already that there is a
PerlCleanupHandler directive in
On 14.08.2007 18:54 Perrin Harkins wrote:
On 8/14/07, John Siracusa [EMAIL PROTECTED] wrote:
The simplest way to do this is to leave everything as per the
defaults, and just use Apache::DBI.
Note that Apache::DBI also does the automatic rollback for you, but
only if you have AutoCommit off
On 14.08.2007 20:20 Bill Moseley wrote:
On Tue, Aug 14, 2007 at 11:57:27AM +0200, Michael Lackhoff wrote:
my $db = MyApp::DB-new;
$self-my_db($db); # a new db for a new transaction
$db-begin_work; # Start transaction
... create two objects and save them ...
die Does it roll back?;
$db
On 14.08.2007 20:34 John Siracusa wrote:
On 8/14/07, Michael Lackhoff [EMAIL PROTECTED] wrote:
$db-begin_work;
my $obj = Products-new(db = $db);
...
$obj-save;
some_helper_that_uses_db(); # rollback here
my $obj2 = Customers-new(db = $db);
...
$obj2-save;
$db-commit;
When I ran
On 09.08.2007 13:42 John Siracusa wrote:
On 8/9/07 6:13 AM, Michael Lackhoff wrote:
I get this error message:
Attempt to change driver from 'oracle' to 'proxy' detected. The driver
cannot be changed after object creation. at test02.pl line 8
Is it possible to persuade Rose::DB
Hello,
Shame on me, I had forgotten to add a mapping of the driver to the
Oracle::Proxy class, now it is working.
After I got the connection I first tried to use the loader to create all
the classes for me but that didn't work. I don't know if the reason is
the proxy or RDBO because I couldn't
Hello,
I did some more tests and it looks as if everything works as it should
but RDBO still gives an error.
This is from a DBI-trace:
- fetch= [ '[EMAIL PROTECTED]' 'ZBMED' 'K002054024' 'mysecret' ]
row1 at Object.pm line 385
- rows= '0E0' at Object.pm line 387
- finish= 1 at
Hello,
perhaps this is related to the new undef_sets_null but I am not sure.
The problem:
I have some fields where it is important if they are empty or not. Now
emptyness is not so easy in SQL as we all know, it could be '' or 0 or
NULL. When I create a record with such a field, it is usually
On 13.12.2007 14:03 John Siracusa wrote:
On Dec 13, 2007 4:24 AM, Michael Lackhoff [EMAIL PROTECTED] wrote:
When I create a record with such a field, it is usually NULL but
after some editing with the help of RHTMLO the empty field value could
become '' when saved.
I believe the latest
On 14.12.2007 09:21 Darren Duncan wrote:
If you have a place that holds a value, it should always hold a
value. If you don't know a value for a place or a value isn't
applicable there, then the place shouldn't exist at all.
The more correct way to do this which SQL supports is through
On 16.12.2007 02:05 John Siracusa wrote:
On Dec 15, 2007 10:43 AM, Michael Lackhoff [EMAIL PROTECTED] wrote:
I guess, what you are talking about is done here:
$form-init_fields_with_cgi($self-query).
What is $self in that line?
My (CGI::)Application object. The whole thing ($self-query
On 04.02.2008 21:41 John Siracusa wrote:
More bug fixes that I didn't want to wait until the next major release.
I get this test failure with 0.7663:
Test Summary Report
---
t/db-object-loader-8.t (Wstat: 65280 Tests: 19 Failed: 16)
Failed test number(s): 4-19
45 matches
Mail list logo