MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: Function update_data



mikeh@minivend.com writes:

> Quoting Stefan Hornburg (racke@linuxia.de):
> > 
> > 
> > Hello, MiniVend hackers !
> > 
> > I'm looking at the MiniVend source code, especially the function
> > update_data in minivend. On updating or inserting an row, every field is
> > updated separately by Vend::Data::set_field. This seems 
> > 1) quite inefficient to me
> 
> I don't worry much about this one -- I never spend much time looking for
> efficiency in rare operations. The time is better spent optimizing the
> repetitive ones.

This is right, I just wondered why you choose this solution in the
first place. 

> 
> > 2) conflicts with constraints like "NOT NULL" on SQL databases.
> > 
> 
> This is much more important. The original version of update_data did
> aggregate the values and do an UPDATE .... SET ...., which caused
> problems of its own. I took it out to make the database interface more
> uniform.
> 
> There are many SQL issues anyway, such as limiting length. I really wish 
> Oracle would allow autotruncation, for example!
> 
> Probably the best way to do this is to create a "row_settor" subroutine in
> Vend::Table::DBI, similar to field_settor. These routines yield a closure
> which allows a one-call row update. (The only example of its use in the
> current stuff is the journal update routine in MiniMate.) The advantage
> of this compared to putting SQL special-cases is that the row_settor
> routine can be done for both DBM and DBI.
> 
> Even if you don't like DBM, there are memory databases and the new
> session-oriented databases to think about.

This is exactly why I asked.

[example code removed]

O.K., I will look into it.

Thanks very much

        Racke

-- 
LinuXia - Solutions of Cool Competence - Internetprogramming and more
D-30163 Hannover, Waldstraße 4, 0511-3941290 (http://www.linuxia.de/)
Wir realisieren Onlineshops mit Minivend (http://www.minivend.com)
und MiniMate (http://www.linuxia.de/minimate/).


Search for: Match: Format: Sort by: