Ooops; most of the mailing lists I work with redirect responses to the
list.  I forget this one doesn't.

---------- Forwarded message ----------
From: Jonathan Leffler <[EMAIL PROTECTED]>
Date: May 1, 2007 6:32 AM
Subject: Re: Proposal for new $h->{ReadOnly} attribute
To: "H.Merijn Brand" <[EMAIL PROTECTED]>



On 5/1/07, H.Merijn Brand <[EMAIL PROTECTED]> wrote:

On Mon, 30 Apr 2007 14:56:37 +0100, Tim Bunce <[EMAIL PROTECTED]> wrote:

> I've just added this to the DBI docs:
>
> =item C<ReadOnly> (boolean, inherited)
> [...]
> =cut

I'd like to see that extended to be able to allow dirty reads or no-lock
reads, whatever the database allows.


It seems to me that the set of permitted statements will be somewhat
specific to the DBMS.  I'd expect 'session attributes' to be OK; things like
isolation level and even locking tables should be allowed - as long as the
session doesn't alter the database.


A complex question - probably one to which there isn't an answer - relates
to 'when is an operation read-only'?

Clearly, an INSERT statement is not allowed; ditto UPDATE or DELETE.  Also,
DDL statements like CREATE TABLE are not allowed.

But what about a statement that creates a temporary table - only accessible
to the session, only for the duration of the session?
SELECT * FROM SomeTable INTO TEMP NewTable;
Is that supposed to be allowed in a read-only transaction/session?  The code
would not allow the corresponding DROP TABLE (or DELETE), so you could only
create the table once and reuse it.

Even more complex - what about executing procedures.  Can you trust the
procedure to make no modifications?  Unless the system can tell you that the
procedure is 'safe',

I have a program, SQLCMD, for which I recently added (at user request) a new
SQLREAD program (a minor subset of the main program).  It had to deal with
these issues: which statements to really allow, stored procedures, and
SELECT INTO TEMP.  And I ended up allowing non-modifying statements, the
implicit temporary tables created by SELECT INTO TEMP, and rejecting direct
execution of stored procedures.



--
Jonathan Leffler <[EMAIL PROTECTED]>  #include <disclaimer.h>
Guardian of DBD::Informix - v2007.0226 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."

--
Jonathan Leffler <[EMAIL PROTECTED]>  #include <disclaimer.h>
Guardian of DBD::Informix - v2007.0226 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."

Reply via email to