perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Spoerri <j...@yucs.org>
Subject TabRelation and inserts
Date Tue, 18 Feb 2003 20:48:28 GMT
What does everyone think about allowing special handling of !Table and
!TabRelation for inserts? For example, ignoring all but the first table?
Or maybe even performing a separate insert for each table?

I'm implementing permissions with a bridge table (between users and
resources), and would like to use a _single dbix object_ for each
resource, for both reading and writing.

The later 4.0 releases of mysql allow multi-table updates, but not
multi-table inserts. Would it be more appropriate for multi-table inserts
to be implemented in the database? To be at all useful, it would probably
be too nontraditional (imagine "insert into x, y (x.a, y.b) values (1, 2)
where x.id = y.x_id;" where x.id is an auto incremented key).
And besides, in dbix::recordset, the feature could be configured to work
for both inserts and updates, for databases that don't even support
multi-tables updates.

Here's an example of what I'm talking about:
$resource = DBIx::Recordset(
	'!Table'=>'resource, permission',
	'!TabRelation'=>'resource.id = perm.resource_id'
);
$resource->Search({resource_field=>$whatever,permission_field=>$mypermission});
#but also:
$resource->Insert(\%new_resource);
#and it would be nice if the following could be done by the preceding:
$permission->Insert({%new_permission,resource_id=>$resource->LastSerial});

Thanks in advance,
Joshua Spoerri


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message