first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
@@ -0,0 +1,88 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
declare(strict_types=1);
namespace core_reportbuilder\local\aggregation;
use lang_string;
use core_reportbuilder\local\report\column;
/**
* Column average aggregation type
*
* @package core_reportbuilder
* @copyright 2021 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class avg extends base {
/**
* Return aggregation name
*
* @return lang_string
*/
public static function get_name(): lang_string {
return new lang_string('aggregationavg', 'core_reportbuilder');
}
/**
* This aggregation can be performed on all numeric columns
*
* @param int $columntype
* @return bool
*/
public static function compatible(int $columntype): bool {
return in_array($columntype, [
column::TYPE_INTEGER,
column::TYPE_FLOAT,
column::TYPE_BOOLEAN,
]);
}
/**
* Return the aggregated field SQL
*
* @param string $field
* @param int $columntype
* @return string
*/
public static function get_field_sql(string $field, int $columntype): string {
return "AVG(1.0 * {$field})";
}
/**
* Return formatted value for column when applying aggregation
*
* For boolean columns we return the average of the values (0..1), numeric columns execute original callbacks if present
*
* @param mixed $value
* @param array $values
* @param array $callbacks
* @param int $columntype
* @return mixed
*/
public static function format_value($value, array $values, array $callbacks, int $columntype) {
if (reset($values) === null) {
return null;
}
if ($columntype === column::TYPE_BOOLEAN || empty($callbacks)) {
return format_float((float) reset($values), 1);
}
return parent::format_value($value, $values, $callbacks, $columntype);
}
}
@@ -0,0 +1,141 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
declare(strict_types=1);
namespace core_reportbuilder\local\aggregation;
use lang_string;
use core_reportbuilder\local\report\column;
/**
* Base class for column aggregation types
*
* @package core_reportbuilder
* @copyright 2021 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class base {
/**
* Return the class name of the aggregation type
*
* @return string
*/
final public static function get_class_name(): string {
$namespacedclass = explode('\\', get_called_class());
return end($namespacedclass);
}
/**
* Return the display name of the aggregation
*
* @return lang_string
*/
abstract public static function get_name(): lang_string;
/**
* Whether the aggregation is compatible with the given column type
*
* @param int $columntype The type as defined by the {@see column::set_type} method
* @return bool
*/
abstract public static function compatible(int $columntype): bool;
/**
* Whether the aggregation is sortable, by default return the sortable status of the column itself
*
* @param bool $columnsortable
* @return bool
*/
public static function sortable(bool $columnsortable): bool {
return $columnsortable;
}
/**
* Return SQL suitable for using within {@see get_field_sql} for column fields, by default just the first one
*
* @param string[] $sqlfields
* @return string
*/
public static function get_column_field_sql(array $sqlfields): string {
return reset($sqlfields);
}
/**
* Helper method for concatenating given fields for a column, so they are suitable for aggregation
*
* @param string[] $sqlfields
* @param string $delimeter
* @param string $coalescechar
* @return string
*/
final protected static function get_column_fields_concat(
array $sqlfields,
string $delimeter = ',',
string $coalescechar = ' '
): string {
global $DB;
// We need to ensure all values are char.
$sqlfieldrequirescast = in_array($DB->get_dbfamily(), ['mssql', 'oracle', 'postgres']);
$concatfields = [];
foreach ($sqlfields as $sqlfield) {
if ($sqlfieldrequirescast) {
$sqlfield = $DB->sql_cast_to_char($sqlfield);
}
// Coalesce all the SQL fields. Ensure cross-DB compatibility, and that we always get string data back.
$concatfields[] = "COALESCE({$sqlfield}, '{$coalescechar}')";
$concatfields[] = "'{$delimeter}'";
}
// Slice off the last delimeter.
return $DB->sql_concat(...array_slice($concatfields, 0, -1));
}
/**
* Return the aggregated field SQL
*
* @param string $field
* @param int $columntype
* @return string
*/
abstract public static function get_field_sql(string $field, int $columntype): string;
/**
* Return formatted value for column when applying aggregation, by default executing all callbacks on the value
*
* Should be overridden in child classes that need to format the column value differently (e.g. 'sum' would just show
* a numeric count value)
*
* @param mixed $value
* @param array $values
* @param array $callbacks Array of column callbacks, {@see column::add_callback} for definition
* @param int $columntype The original type of the column, to ensure it is preserved for callbacks
* @return mixed
*/
public static function format_value($value, array $values, array $callbacks, int $columntype) {
foreach ($callbacks as $callback) {
[$callable, $arguments] = $callback;
$value = ($callable)($value, (object) $values, $arguments, static::get_class_name());
}
return $value;
}
}
@@ -0,0 +1,81 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
declare(strict_types=1);
namespace core_reportbuilder\local\aggregation;
use lang_string;
use core_reportbuilder\local\report\column;
/**
* Column count aggregation type
*
* @package core_reportbuilder
* @copyright 2021 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class count extends base {
/**
* Return aggregation name
*
* @return lang_string
*/
public static function get_name(): lang_string {
return new lang_string('aggregationcount', 'core_reportbuilder');
}
/**
* This aggregation can be performed on all column types
*
* @param int $columntype
* @return bool
*/
public static function compatible(int $columntype): bool {
return true;
}
/**
* Return the aggregated field SQL
*
* @param string $field
* @param int $columntype
* @return string
*/
public static function get_field_sql(string $field, int $columntype): string {
global $DB;
if ($columntype === column::TYPE_LONGTEXT && $DB->get_dbfamily() === 'oracle') {
$field = $DB->sql_compare_text($field, 255);
}
return "COUNT({$field})";
}
/**
* Return formatted value for column when applying aggregation
*
* @param mixed $value
* @param array $values
* @param array $callbacks
* @param int $columntype
* @return int
*/
public static function format_value($value, array $values, array $callbacks, int $columntype): int {
return (int) reset($values);
}
}
@@ -0,0 +1,95 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
declare(strict_types=1);
namespace core_reportbuilder\local\aggregation;
use lang_string;
use core_reportbuilder\local\report\column;
/**
* Column count distinct aggregation type
*
* @package core_reportbuilder
* @copyright 2021 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class countdistinct extends base {
/**
* Return aggregation name
*
* @return lang_string
*/
public static function get_name(): lang_string {
return new lang_string('aggregationcountdistinct', 'core_reportbuilder');
}
/**
* This aggregation can be performed on all column types
*
* @param int $columntype
* @return bool
*/
public static function compatible(int $columntype): bool {
return true;
}
/**
* Override base method to ensure all SQL fields are concatenated together if there are multiple
*
* @param array $sqlfields
* @return string
*/
public static function get_column_field_sql(array $sqlfields): string {
if (count($sqlfields) === 1) {
return parent::get_column_field_sql($sqlfields);
}
return self::get_column_fields_concat($sqlfields);
}
/**
* Return the aggregated field SQL
*
* @param string $field
* @param int $columntype
* @return string
*/
public static function get_field_sql(string $field, int $columntype): string {
global $DB;
if ($columntype === column::TYPE_LONGTEXT && $DB->get_dbfamily() === 'oracle') {
$field = $DB->sql_compare_text($field, 255);
}
return "COUNT(DISTINCT {$field})";
}
/**
* Return formatted value for column when applying aggregation
*
* @param mixed $value
* @param array $values
* @param array $callbacks
* @param int $columntype
* @return int
*/
public static function format_value($value, array $values, array $callbacks, int $columntype): int {
return (int) reset($values);
}
}
@@ -0,0 +1,139 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
declare(strict_types=1);
namespace core_reportbuilder\local\aggregation;
use lang_string;
use core_reportbuilder\local\helpers\database;
use core_reportbuilder\local\report\column;
/**
* Column group concatenation aggregation type
*
* @package core_reportbuilder
* @copyright 2021 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class groupconcat extends base {
/** @var string Character to use as a delimeter between column fields */
protected const COLUMN_FIELD_DELIMETER = '<|>';
/** @var string Character to use a null coalesce value */
protected const COLUMN_NULL_COALESCE = '<^>';
/** @var string Character to use as a delimeter between field values */
protected const FIELD_VALUE_DELIMETER = '<,>';
/**
* Return aggregation name
*
* @return lang_string
*/
public static function get_name(): lang_string {
return new lang_string('aggregationgroupconcat', 'core_reportbuilder');
}
/**
* This aggregation can be performed on all non-timestamp columns
*
* @param int $columntype
* @return bool
*/
public static function compatible(int $columntype): bool {
return !in_array($columntype, [
column::TYPE_TIMESTAMP,
]);
}
/**
* Override base method to ensure all SQL fields are concatenated together if there are multiple
*
* @param array $sqlfields
* @return string
*/
public static function get_column_field_sql(array $sqlfields): string {
if (count($sqlfields) === 1) {
return parent::get_column_field_sql($sqlfields);
}
return self::get_column_fields_concat($sqlfields, self::COLUMN_FIELD_DELIMETER, self::COLUMN_NULL_COALESCE);
}
/**
* Return the aggregated field SQL
*
* @param string $field
* @param int $columntype
* @return string
*/
public static function get_field_sql(string $field, int $columntype): string {
global $DB;
$fieldsort = database::sql_group_concat_sort($field);
return $DB->sql_group_concat($field, self::FIELD_VALUE_DELIMETER, $fieldsort);
}
/**
* Return formatted value for column when applying aggregation, note we need to split apart the concatenated string
* and apply callbacks to each concatenated value separately
*
* @param mixed $value
* @param array $values
* @param array $callbacks
* @param int $columntype
* @return mixed
*/
public static function format_value($value, array $values, array $callbacks, int $columntype) {
$firstvalue = reset($values);
if ($firstvalue === null) {
return '';
}
$formattedvalues = [];
// Store original names of all values that would be present without aggregation.
$valuenames = array_keys($values);
$valuenamescount = count($valuenames);
// Loop over each extracted value from the concatenated string.
$values = explode(self::FIELD_VALUE_DELIMETER, (string)$firstvalue);
foreach ($values as $value) {
// Ensure we have equal number of value names/data, account for truncation by DB.
$valuedata = explode(self::COLUMN_FIELD_DELIMETER, $value);
if ($valuenamescount !== count($valuedata)) {
continue;
}
// Re-construct original values, also ensuring any nulls contained within are restored.
$originalvalues = array_map(static function(string $value): ?string {
return $value === self::COLUMN_NULL_COALESCE ? null : $value;
}, array_combine($valuenames, $valuedata));
$originalvalue = column::get_default_value($originalvalues, $columntype);
// Once we've re-constructed each value, we can apply callbacks to it.
$formattedvalues[] = parent::format_value($originalvalue, $originalvalues, $callbacks, $columntype);
}
$listseparator = get_string('listsep', 'langconfig') . ' ';
return implode($listseparator, $formattedvalues);
}
}
@@ -0,0 +1,85 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
declare(strict_types=1);
namespace core_reportbuilder\local\aggregation;
use lang_string;
use core_reportbuilder\local\helpers\database;
/**
* Column group concatenation distinct aggregation type
*
* @package core_reportbuilder
* @copyright 2021 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class groupconcatdistinct extends groupconcat {
/**
* Return aggregation name
*
* @return lang_string
*/
public static function get_name(): lang_string {
return new lang_string('aggregationgroupconcatdistinct', 'core_reportbuilder');
}
/**
* This aggregation can be performed on all non-timestamp columns in MySQL, Postgres and Oracle only
*
* @param int $columntype
* @return bool
*/
public static function compatible(int $columntype): bool {
global $DB;
$dbsupportedtype = in_array($DB->get_dbfamily(), [
'mysql',
'postgres',
'oracle',
]);
return $dbsupportedtype && parent::compatible($columntype);
}
/**
* Return the aggregated field SQL
*
* @param string $field
* @param int $columntype
* @return string
*/
public static function get_field_sql(string $field, int $columntype): string {
global $DB;
$fieldsort = database::sql_group_concat_sort($field);
// Postgres handles group concatenation differently in that it requires the expression to be cast to char, so we can't
// simply pass "DISTINCT {$field}" to the {@see \moodle_database::sql_group_concat} method in all cases.
if ($DB->get_dbfamily() === 'postgres') {
$field = $DB->sql_cast_to_char($field);
if ($fieldsort !== '') {
$fieldsort = "ORDER BY {$fieldsort}";
}
return "STRING_AGG(DISTINCT {$field}, '" . self::FIELD_VALUE_DELIMETER . "' {$fieldsort})";
} else {
return $DB->sql_group_concat("DISTINCT {$field}", self::FIELD_VALUE_DELIMETER, $fieldsort);
}
}
}
@@ -0,0 +1,67 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
declare(strict_types=1);
namespace core_reportbuilder\local\aggregation;
use lang_string;
use core_reportbuilder\local\report\column;
/**
* Column max aggregation type
*
* @package core_reportbuilder
* @copyright 2021 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class max extends base {
/**
* Return aggregation name
*
* @return lang_string
*/
public static function get_name(): lang_string {
return new lang_string('aggregationmax', 'core_reportbuilder');
}
/**
* This aggregation can be performed on all numeric/date/boolean types
*
* @param int $columntype
* @return bool
*/
public static function compatible(int $columntype): bool {
return in_array($columntype, [
column::TYPE_INTEGER,
column::TYPE_FLOAT,
column::TYPE_TIMESTAMP,
column::TYPE_BOOLEAN,
]);
}
/**
* Return the aggregated field SQL
*
* @param string $field
* @param int $columntype
* @return string
*/
public static function get_field_sql(string $field, int $columntype): string {
return "MAX({$field})";
}
}
@@ -0,0 +1,67 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
declare(strict_types=1);
namespace core_reportbuilder\local\aggregation;
use lang_string;
use core_reportbuilder\local\report\column;
/**
* Column min aggregation type
*
* @package core_reportbuilder
* @copyright 2021 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class min extends base {
/**
* Return aggregation name
*
* @return lang_string
*/
public static function get_name(): lang_string {
return new lang_string('aggregationmin', 'core_reportbuilder');
}
/**
* This aggregation can be performed on all numeric/date/boolean types
*
* @param int $columntype
* @return bool
*/
public static function compatible(int $columntype): bool {
return in_array($columntype, [
column::TYPE_INTEGER,
column::TYPE_FLOAT,
column::TYPE_TIMESTAMP,
column::TYPE_BOOLEAN,
]);
}
/**
* Return the aggregated field SQL
*
* @param string $field
* @param int $columntype
* @return string
*/
public static function get_field_sql(string $field, int $columntype): string {
return "MIN({$field})";
}
}
@@ -0,0 +1,81 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
declare(strict_types=1);
namespace core_reportbuilder\local\aggregation;
use lang_string;
use core_reportbuilder\local\helpers\format;
use core_reportbuilder\local\report\column;
/**
* Column percent aggregation type
*
* @package core_reportbuilder
* @copyright 2021 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class percent extends base {
/**
* Return aggregation name
*
* @return lang_string
*/
public static function get_name(): lang_string {
return new lang_string('aggregationpercent', 'core_reportbuilder');
}
/**
* This aggregation can be performed on all boolean columns
*
* @param int $columntype
* @return bool
*/
public static function compatible(int $columntype): bool {
return in_array($columntype, [
column::TYPE_BOOLEAN,
]);
}
/**
* Return the aggregated field SQL
*
* @param string $field
* @param int $columntype
* @return string
*/
public static function get_field_sql(string $field, int $columntype): string {
return "AVG(1.0 * {$field}) * 100.0";
}
/**
* Return formatted value for column when applying aggregation
*
* @param mixed $value
* @param array $values
* @param array $callbacks
* @param int $columntype
* @return string
*/
public static function format_value($value, array $values, array $callbacks, int $columntype): string {
if (reset($values) === null) {
return '';
}
return format::percent((float) reset($values));
}
}
@@ -0,0 +1,90 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
declare(strict_types=1);
namespace core_reportbuilder\local\aggregation;
use lang_string;
use core_reportbuilder\local\report\column;
/**
* Column sum aggregation type
*
* @package core_reportbuilder
* @copyright 2021 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class sum extends base {
/**
* Return aggregation name
*
* @return lang_string
*/
public static function get_name(): lang_string {
return new lang_string('aggregationsum', 'core_reportbuilder');
}
/**
* This aggregation can be performed on all numeric and boolean columns
*
* @param int $columntype
* @return bool
*/
public static function compatible(int $columntype): bool {
return in_array($columntype, [
column::TYPE_INTEGER,
column::TYPE_FLOAT,
column::TYPE_BOOLEAN,
]);
}
/**
* Return the aggregated field SQL
*
* @param string $field
* @param int $columntype
* @return string
*/
public static function get_field_sql(string $field, int $columntype): string {
return "SUM({$field})";
}
/**
* Return formatted value for column when applying aggregation
*
* For boolean columns we return the sum of the true values, numeric columns execute original callbacks if present
*
* @param mixed $value
* @param array $values
* @param array $callbacks
* @param int $columntype
* @return mixed
*/
public static function format_value($value, array $values, array $callbacks, int $columntype) {
$firstvalue = reset($values);
if ($firstvalue === null) {
return null;
}
if ($columntype === column::TYPE_BOOLEAN || empty($callbacks)) {
$decimalpoints = (int) ($columntype === column::TYPE_FLOAT);
return format_float((float) $firstvalue, $decimalpoints);
}
return parent::format_value($value, $values, $callbacks, $columntype);
}
}