[Solar-talk] some thoughts about models
stefan bogdan
stefan_bogdan_daniel at yahoo.com
Tue Aug 14 11:12:47 CDT 2007
hi solars,
i was looking in the new model implementtion and i felt like doing some comments.
As far as i understand Models are an Active Record + Table Getway implementation in Solar.
Table design can be different, but for most application in a table we should have :
- date created
- date last update
- table_id ( could be autoincrement like in mysql, informix or mssql or sequence like in postgres or oracle).
- other fileds
First i would like to start with INSERT method, describing my opinion. :
- table_id should not be a part of inserted fields; if the table_id (not necesary primary key) is a sequence
we should use default value (in postgres) or triggers (in oracle) to insert that value.
so the insert statement should look like :
insert into TABLE (date_created,field1,field2) values (now,value1,value2);
- date values should be from the database server, not from the apache + php server
- if a field is missing we should automatically assign the default value or exclude them from insert.
First possibility is my choice.
The UPDATE method :
- don't update a field if the value is not changed
- select the record first and if the 'last update' field's value is different from updated record do not make the insert,
or make it if we force the operation ; introducing a new parameter force update.
what do you think?
bogdan
____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online.
http://smallbusiness.yahoo.com/webhosting
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman-mail3.webfaction.com/pipermail/solar-talk/attachments/20070814/353ad509/attachment.html
More information about the Solar-talk
mailing list