Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #5991

Should onInsert call onUpdate?

From Victor Porton <porton@narod.ru>
Newsgroups comp.programming
Subject Should onInsert call onUpdate?
Date 2015-11-27 19:41 +0200
Organization Aioe.org NNTP Server
Message-ID <n3a4l3$fp7$1@speranza.aioe.org> (permalink)

Show all headers | View raw


I am writing a lightweight ORM for SQL.

I create virtual methods onBeforeInsert, onBeforeUpdate and onAfterInsert, 
onAfterUpdate which are called respectively before or after INSERT or UPDATE 
SQL statements (done by my ORM when I ask it to save an object to the DB).

Should on{Before,After}Update also be called for INSERT queries?

My logical construction is the following: INSERT can be logically equivalent 
to creating a "default" object and then UPDATE it.

Accordingly this thought, when inserting all four virtual method should be 
called.

What do you think on this?

-- 
Victor Porton - http://portonvictor.org

Back to comp.programming | Previous | Next | Find similar | Unroll thread


Thread

Should onInsert call onUpdate? Victor Porton <porton@narod.ru> - 2015-11-27 19:41 +0200

csiph-web