Re: where is DBI::DWIM?

From: Tore Aursand (tore_at_aursand.no)
Date: 11/18/03


Date: Tue, 18 Nov 2003 12:12:33 +0100

On Mon, 17 Nov 2003 20:05:07 +0000, Eric Wilhelm wrote:
> This is partly an SQL question [...]

Let me first of all say that - without not knowing anything about what
you're trying to solve - you might be asking about too much for the SQL
standard.

However; Your existing solution - or what you're thinking about - seems
to have a general flaw already. Let's think about "doing something with
something" OO-wise:

  1. You establish an instance of a typed something
  2. You work with, and relate to, that instance
  3. You get rid of that instance

Everywhere on this way you know for sure what/who the instance is, so why
do you need to re-create your relationship with the instance for each of
the parts above?

More code-related, these three would look like this:

  1. Read data from a database
  2. Do something with the data
  3. Get rid of the data (ie. save and dispose, or just dispose)

Where do _you_, in _your_ application, loose control over what you're
working with?

> I am new to SQL, but I'm shocked by the fact that there is no "set the
> value of this column in this row" command.

Despite your arguments, there is:

  UPDATE user SET username = 'john_doe' WHERE user_id = 34

This one sets a column's value for a specific row in the database. No
hassle.

> I can INSERT or UPDATE, but first I must SELECT to see if the row
> already exists [...]

Exactly _why_ do you have to do that? This seems like a design flaw to
me.

> It seems like an UPDATE statement could easily enough be translated into
> the required INSERT statement (but maybe I haven't thought forward far
> enough in this idea.)

You could - of course - subclass the DBI module and get what you want.

> Otherwise, tell me why this is crazy before I go write DBI::DWIM

AFAIK, there's a module on CPAN with that name already...?

-- 
Tore Aursand <tore@aursand.no>


Relevant Pages

  • Getting deadlocks error in content database.
    ... I am getting deadlock errors in content database during the performace test ... An SPRequest object was not disposed before the end of this thread. ... dispose of this object ...
    (microsoft.public.sharepoint.portalserver)
  • Re: Cryptographie =?ISO-8859-1?Q?asym=E9trique?=
    ... but will Agha rise that? ... Will you rid till the ... sunshine, if Abdel freely learns the limb? ... She'd rather dispose e.g. than ...
    (sci.crypt)
  • Re: Access Lock Remains after Connection Closed - OLE DB / Jet
    ... If I open an Access 2000 version database and read data from it and at ... close and dispose, the lock still remains. ... possibility that is is your connection object that is the source of the ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Error 3709
    ... Compact the database to get rid of this junk: ... > with a seperate .mdb for storing data. ...
    (microsoft.public.access.modulesdaovba)
  • Help required with DBI
    ... with DBI module and am pretty new to perl too. ... a database to execute some queries. ... below (It is actually a partial code for just connecting to database). ... Perhaps the DBD::DriverName perl module hasn't been fully installed, ...
    (perl.beginners)