Ferreteria/v0.5/@cls/data/card/k1i/cStor/DoUpdate: Difference between revisions

From Woozle Writes Code
< Ferreteria‎ | v0.5‎ | @cls
Jump to navigation Jump to search
No edit summary
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:
* '''Code''': {{l/ferreteria/code|data/fields/card/k1i/base.php}}
{{page/ferret/method}}
* '''Code''': {{l/ferreteria/code|data/fields/card/k1i/stor.php}}
* '''Purpose''': write modified values to disk storage (with any format-conversion handled automatically)
* '''Input''':
** <code>array $arVals</code>: native-format values to be updated in storage
** <code>array $arLits</code>: additional SQL terms to apply (e.g. <code>NOW()</code>)
==About==
It turns out to be important to understand the nuances of this method. The "values" are in unquoted SQL-compatible format, and need to be quote-checked before saving. The literals, however, can be passed through directly.
==History==
==History==
* '''2023-03-23''' At first I thought this would need separate arguments for values and literals, but actually it should only be used to update data values because it will update memory if locked. Not sure this is good design. Maybe it should do both and then reload. What's the intent, here?
{| class="wikitable sortable"
* '''2023-02-26''' changing from public to protected
! when || what
* '''2023-02-20''' modified so if record is locked, this just updates the local data
|-
* '''2022-01-03''' moved from cRecordKeyed to tStorageK1I
| '''2023-03-24''' || Realized that this function (or at least this code) does ''not'' belong in the base (cK1I), so moved it to cStor.
* '''2019-11-26''' creating DoUpdate() (and DoInsert()) as a way of transitioning to usage of status-object returns
|-
* '''2019-07-26''' moved from fcRecord_keyed_single to fcRecord_keyed, because it should work as long as GetSelfFilter() is defined.
| '''2023-03-23''' || At first I thought this would need separate arguments for values and literals, but actually it should only be used to update data values because it will update memory if locked. Not sure this is good design. Maybe it should do both and then reload. What's the intent, here?
* '''2019-06-11''' removed 2nd parameter; massage data with $db->SanitizeValueArray() instead
|-
| '''2023-02-26''' || changing from public to protected
|-
| '''2023-02-20''' || modified so if record is locked, this just updates the local data
|-
| '''2022-01-03''' || moved from cRecordKeyed to tStorageK1I
|-
| '''2019-11-26''' || creating DoUpdate() (and DoInsert()) as a way of transitioning to usage of status-object returns
|-
| '''2019-07-26''' || moved from fcRecord_keyed_single to fcRecord_keyed, because it should work as long as GetSelfFilter() is defined.
|-
| '''2019-06-11''' || removed 2nd parameter; massage data with $db->SanitizeValueArray() instead
|}

Latest revision as of 13:13, 3 April 2023

Ferreteria: ferret\data\card\k1i\cStor::DoUpdate()
  • Code: data/fields/card/k1i/stor.php
  • Purpose: write modified values to disk storage (with any format-conversion handled automatically)
  • Input:
    • array $arVals: native-format values to be updated in storage
    • array $arLits: additional SQL terms to apply (e.g. NOW())

About

It turns out to be important to understand the nuances of this method. The "values" are in unquoted SQL-compatible format, and need to be quote-checked before saving. The literals, however, can be passed through directly.

History

when what
2023-03-24 Realized that this function (or at least this code) does not belong in the base (cK1I), so moved it to cStor.
2023-03-23 At first I thought this would need separate arguments for values and literals, but actually it should only be used to update data values because it will update memory if locked. Not sure this is good design. Maybe it should do both and then reload. What's the intent, here?
2023-02-26 changing from public to protected
2023-02-20 modified so if record is locked, this just updates the local data
2022-01-03 moved from cRecordKeyed to tStorageK1I
2019-11-26 creating DoUpdate() (and DoInsert()) as a way of transitioning to usage of status-object returns
2019-07-26 moved from fcRecord_keyed_single to fcRecord_keyed, because it should work as long as GetSelfFilter() is defined.
2019-06-11 removed 2nd parameter; massage data with $db->SanitizeValueArray() instead