This works fine:
PHP Code:
function GroupConcatStep(&$context, $string, $separator = ',') {
$context .= $separator . $string;
}
function GroupConcatFinalize(&$context) {
return $context;
}
$Db = new PDO('sqlite: MyDb.sqlite');
$Db->sqliteCreateAggregate('GROUP_CONCAT', 'GroupConcatStep', 'GroupConcatFinalize', 2);
But I don't know how to do the same from inside a class. I don't get the names of the callback functions (methods) right. So the code below does not work:
PHP Code:
class MyClass {
public function Connect() {
$this->Db = new PDO('sqlite:'.$Path.'/'.$this->DbName);
$this->Db->sqliteCreateAggregate('GROUP_CONCAT', 'MyClass::GroupConcatStep', 'MyClass::GroupConcatFinalize', 2);
}
public function GroupConcatStep(&$context, $string, $separator = ',') {
$context .= $separator . $string;
}
public function GroupConcatFinalize(&$context) {
return $context;
}
}