note 97128 added to sqlite3.createaggregate

From: Date: Fri, 02 Apr 2010 16:43:55 +0000
Subject: note 97128 added to sqlite3.createaggregate
Groups: php.notes 
Request: Send a blank email to php-notes+get-167658@lists.php.net to get a copy of this message
The documentation doesn't tell you what the format for the callbacks is. The functions should look like this: <?php function step_function($context, $rowcount, $arg1, $arg2,...) { // process the arguments and change the context // to store your current state; context can include // any PHP type return $context; // this is how you store the context } function final_function($context, $rowcount) { // optionally, do final processing on the context return $result_of_function; // note: OFTEN, the result of your function was // computed by the step function and is already in // context, so you would say return $context; // but other times, say, in calculating the median, // you have to process the context and produce // an answer. Whatever you return from the final // function becomes the result of the SQLite // Aggregate. } ?> Note that the context is NOT a reference variable, as far as I can tell. ---- Server IP: 64.71.164.2 Probable Submitter: 75.160.73.210 ---- Manual Page -- http://www.php.net/manual/en/sqlite3.createaggregate.php Edit -- https://master.php.net/note/edit/97128 Del: integrated -- https://master.php.net/note/delete/97128/integrated Del: useless -- https://master.php.net/note/delete/97128/useless Del: bad code -- https://master.php.net/note/delete/97128/bad+code Del: spam -- https://master.php.net/note/delete/97128/spam Del: non-english -- https://master.php.net/note/delete/97128/non-english Del: in docs -- https://master.php.net/note/delete/97128/in+docs Del: other reasons-- https://master.php.net/note/delete/97128 Reject -- https://master.php.net/note/reject/97128 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#167658) next »