On Tue, 2 Dec 2003 10:36:32 +0100, Benni Baermann <[EMAIL PROTECTED]> wrote:

Hi!

Is it correct, that it is impossible to store blessed references (Perl
objects) in udat? Same for mdat?

If yes, is there any workaround? Maybe serializing the object first
with Storable or something like this? But if i interpreted the mails
in the archive correct this still will not work with DBI-Connections?

Is there a way to use only one DBI-Connection for the whole
application?

I'll give you some suggestions and maybe others may complement it.


I think tha what you mean with "only one DBI-Connection for the whole application" is in fact one DBI connection for each Apache child.

There are some ways to do these but the most common is to use Apache::DBI. It will do the caching for you. So write a page (component) that starts the connection and put it back in the $req_rec reference so it will be available to all other Executed pages in the same request.
Example:


connect.epr:
[-
$req = shift;
$req->{dbh} = new DBI(...);
-]


In your pages: [- Execute('connect.epr');

$req = shift;
$dbh = $req->{dbh};

# Database stuff...
-]

In other Executed parts:
[-
$req = shift;
$dbh = $req->{dbh};

# More database stuff
-]

This is a simple method and of course there are more elegant approaches you could try.

About storing objects in udat I usually avoid it, its better to store simple variables.
If you need objects you have to make shure the serialized data are not bigger than the capacity of the column in your database (usually 32k).


Good luck,

--
Luiz Fernando B. Ribeiro
Engenho Solu��es para a Internet

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to