Higher level constructs (was: [DB-SIG] Experiences with DB-API2.0 )

Dustin Sallings dustin+pydbsig@spy.net
Mon, 24 Jun 2002 12:42:53 -0700


Around 12:37 on Jun 24, 2002, Dittmar, Daniel said:

#     - writing complex checks for stuff that
#       won't do any harm (example from JDBC:
#       parsing SQL commands so that no SELECT
#       gets through an executeUpdate)

	I agree with most of this here, however on this point, I think
it's somewhat important to not think of selects in executeUpdate as
harmless.  Conversely, as well, if a result set is expected and an update
makes its way in, that should be an error.

	executeUpdate returns an integer telling you how many rows were
affected on a delete, insert, or update.  executeQuery returns a
ResultSet.  If the query you issue is not going to provide the correct
type of results for the expected call, it should raise an exception.

	Now, it doesn't necessarily need to parse the query to do this,
but some drivers may need to do it that way.

--
SPY                      My girlfriend asked me which one I like better.
pub  1024/3CAE01D5 1994/11/03 Dustin Sallings <dustin@spy.net>
|    Key fingerprint =  87 02 57 08 02 D0 DA D6  C8 0F 3E 65 51 98 D8 BE
L_______________________ I hope the answer won't upset her. ____________