Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Bug Reports » Losing $where when fixed selection is not present
Re: Losing $where when fixed selection is not present [message #2273 is a reply to message #2272] Mon, 17 August 2009 13:15 Go to previous messageGo to previous message
AJM is currently offline  AJM
Messages: 2350
Registered: April 2006
Location: Surrey, UK
Senior Member
You like being awkward, don't you! Very Happy

Attached is a new version of std.list2.inc in which I have cut out the overwriting of $where with $selection. Both of these values will be passed to initialise() and therefore _cm_initalise(). I have changed the logic inside initialise() as follows:
$where2 = $this->_cm_initialise($where, $selection, $search);
if ($where2 != $where) {
    // this was changed in _cm_initialise(), so use the new version
    $where = $where2;
} else {
    if (!empty($selection)) {
        // $selection takes precedence over $where
        $where     = $selection;
        $selection = null;
    } // if
} // if

If _cm_initialise() changes the contents of $where then $selection will be ignored.
If $where is not changed and $selection is not empty then $where will be overwritten by $selection.
Note that the agument list for _cm_initialise() has been changed to the following:
    function _cm_initialise ($where, &$selection, $search)
    // perform any initialisation for the current task.
    // NOTE: $selection is passed by reference as it may be amended.
    // NOTE: $search    is only available for OUTPUT tasks.
    {
        // customisable code goes here

        return $where;

    } // _cm_initialise 

$selection is passed by reference so that you can change its contents. If you erase it then it cannot be used to overwrite the contents of $where.

Try the attached file to see if it works OK.
  • Attachment: std.list2.zip
    (Size: 3.47KB, Downloaded 1806 times)


 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: isnull clause being filtered out of $where with scriptNext()
Next Topic: Recover Password is encrypted
Goto Forum:
  


Current Time: Mon Jun 17 02:05:17 EDT 2024

Total time taken to generate the page: 0.01327 seconds