Re: where is DBI::DWIM?
From: Tore Aursand (tore_at_aursand.no)
Date: 11/18/03
- Next message: Anno Siegel: "Re: perldoc installation"
- Previous message: BKennedy: "Re: PERL array of arrays"
- In reply to: Eric Wilhelm: "where is DBI::DWIM?"
- Next in thread: Eric Wilhelm: "Re: where is DBI::DWIM?"
- Reply: Eric Wilhelm: "Re: where is DBI::DWIM?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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>
- Next message: Anno Siegel: "Re: perldoc installation"
- Previous message: BKennedy: "Re: PERL array of arrays"
- In reply to: Eric Wilhelm: "where is DBI::DWIM?"
- Next in thread: Eric Wilhelm: "Re: where is DBI::DWIM?"
- Reply: Eric Wilhelm: "Re: where is DBI::DWIM?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|