anewt-developers team mailing list archive
-
anewt-developers team
-
Mailing list archive
-
Message #00196
[Branch ~sander-sinaasappel/anewt/anewt.new.cxs] Rev 1490: [autorecord] Remove AutoRecord::_db_skip_on_insert()
------------------------------------------------------------
revno: 1490
committer: Sander van Schouwenburg <sander@xxxxxxxxxxxxx>
branch nick: anewt.new.cxs
timestamp: Tue 2010-01-26 16:36:37 +0100
message:
[autorecord] Remove AutoRecord::_db_skip_on_insert()
All values will now be skipped if they are not set. The only situation this will break if the database default is not NULL, but you do expect it to be set NULL by not supplying the value.
(from anewt.new.svn:101)
modified:
autorecord/autorecord.lib.php
--
lp:~sander-sinaasappel/anewt/anewt.new.cxs
https://code.launchpad.net/~sander-sinaasappel/anewt/anewt.new.cxs
Your team Anewt developers is subscribed to branch lp:~sander-sinaasappel/anewt/anewt.new.cxs.
To unsubscribe from this branch go to https://code.launchpad.net/~sander-sinaasappel/anewt/anewt.new.cxs/+edit-subscription.
=== modified file 'autorecord/autorecord.lib.php'
--- autorecord/autorecord.lib.php 2010-01-04 13:11:30 +0000
+++ autorecord/autorecord.lib.php 2010-01-26 15:36:37 +0000
@@ -112,6 +112,10 @@
}
/**
+ * \deprecated This is no longer used. All fields are skipped on insert
+ * if their values are not set. No use inserting explicit \c NULL values
+ * if they're not set.
+ *
* Return an array of column names which should be skipped on insert queries
* when no values are given. The database is expected to fill a default
* value for these columns.
@@ -1180,9 +1184,6 @@
{
$table = $this->_db_table();
$columns = $this->_db_columns();
- $skip_on_insert = $this->_db_skip_on_insert();
- $skip_on_save = $this->_db_skip_on_save();
- $skip_on_insert = array_merge($skip_on_insert, $skip_on_save);
$db = $this->_db();
$primary_key = $this->_db_primary_key();
@@ -1202,8 +1203,8 @@
if ($name === $primary_key && $skip_primary_key)
continue;
- /* Skip columns which should be filled by the database */
- if (in_array($name, $skip_on_insert) && !$this->is_set($name))
+ /* Skip columns which are not set, they will be set by the database defaults */
+ if (!$this->is_set($name))
continue;
$number_of_columns++;