Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/core/Db
diff options
context:
space:
mode:
authorThomas Steur <thomas.steur@gmail.com>2016-01-15 03:07:44 +0300
committerThomas Steur <thomas.steur@gmail.com>2016-01-15 03:07:44 +0300
commit54428a657ca81211f0ffdd137b724d8a01398703 (patch)
tree3f7ba2de93104ec451d6c2465fb9925a4be6605f /core/Db
parent6d00a6a60f3d0332fa0b3d6ae5562c9339a6e962 (diff)
add possibility to specify charset when importing in batch
Diffstat (limited to 'core/Db')
-rw-r--r--core/Db/BatchInsert.php7
1 files changed, 2 insertions, 5 deletions
diff --git a/core/Db/BatchInsert.php b/core/Db/BatchInsert.php
index 254e03d2d4..011954cd11 100644
--- a/core/Db/BatchInsert.php
+++ b/core/Db/BatchInsert.php
@@ -54,7 +54,7 @@ class BatchInsert
* @throws Exception
* @return bool True if the bulk LOAD was used, false if we fallback to plain INSERTs
*/
- public static function tableInsertBatch($tableName, $fields, $values, $throwException = false)
+ public static function tableInsertBatch($tableName, $fields, $values, $throwException = false, $charset = 'utf8')
{
$filePath = StaticContainer::get('path.tmp') . '/assets/' . $tableName . '-' . Common::generateUniqId() . '.csv';
@@ -72,12 +72,9 @@ class BatchInsert
},
'eol' => "\r\n",
'null' => 'NULL',
+ 'charset' => $charset
);
- // see https://github.com/piwik/piwik/issues/9419#issuecomment-170851440
- // if charset is utf8 we get this error: Invalid utf8 character string: '"x':
- $fileSpec['charset'] = 'latin1';
-
self::createCSVFile($filePath, $fileSpec, $values);
if (!is_readable($filePath)) {