DB_mysql.php (mrbs-1.9.4) | : | DB_mysql.php (mrbs-1.10.0) | ||
---|---|---|---|---|
<?php | <?php | |||
namespace MRBS; | namespace MRBS; | |||
use PDO; | ||||
use PDOException; | use PDOException; | |||
// | // | |||
class DB_mysql extends DB | class DB_mysql extends DB | |||
{ | { | |||
const DB_DEFAULT_PORT = 3306; | const DB_DEFAULT_PORT = 3306; | |||
const DB_DBO_DRIVER = "mysql"; | const DB_DBO_DRIVER = "mysql"; | |||
const DB_CHARSET = "utf8mb4"; | const DB_CHARSET = "utf8mb4"; | |||
// For a full list of error codes see https://mariadb.com/kb/en/mariadb-error- codes/ | // For a full list of error codes see https://mariadb.com/kb/en/mariadb-error- codes/ | |||
skipping to change at line 469 | skipping to change at line 468 | |||
$count = -1; | $count = -1; | |||
break; | break; | |||
default: | default: | |||
throw new Exception("Invalid value ($part) given for " . '$part.'); | throw new Exception("Invalid value ($part) given for " . '$part.'); | |||
break; | break; | |||
} | } | |||
$params[] = $delimiter; | $params[] = $delimiter; | |||
return "SUBSTRING_INDEX($fieldname, ?, $count)"; | return "SUBSTRING_INDEX($fieldname, ?, $count)"; | |||
} | } | |||
// Returns the syntax for aggregating a number of rows as a delimited string | ||||
public function syntax_group_array_as_string($fieldname, $delimiter=',') | ||||
{ | ||||
// Use DISTINCT to eliminate duplicates which can arise when the query | ||||
// has joins on two or more junction tables. Maybe a different query | ||||
// would eliminate the duplicates and the need for DISTINCT, and it may | ||||
// or may not be more efficient. | ||||
return "GROUP_CONCAT(DISTINCT $fieldname SEPARATOR '$delimiter')"; | ||||
} | ||||
} | } | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 11 lines changed or added |