summaryrefslogtreecommitdiffstats
path: root/core/Command
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-03-26 17:11:57 +0200
committerJoas Schilling <coding@schilljs.com>2017-03-26 17:11:57 +0200
commit2961c735e3f92a150e0139b2af275e33e54377c4 (patch)
treea6ccfd03bcef7c1d9ca9e90656cd53b0218a99ed /core/Command
parentec6853a2a65c284af08f0241699f227516f25464 (diff)
downloadnextcloud-server-2961c735e3f92a150e0139b2af275e33e54377c4.tar.gz
nextcloud-server-2961c735e3f92a150e0139b2af275e33e54377c4.zip
Make sure blob columns are correctly converted as parameters
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/Command')
-rw-r--r--core/Command/Db/ConvertType.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php
index a8969251bab..5bb43400d61 100644
--- a/core/Command/Db/ConvertType.php
+++ b/core/Command/Db/ConvertType.php
@@ -28,6 +28,7 @@
namespace OC\Core\Command\Db;
+use OCP\DB\QueryBuilder\IQueryBuilder;
use \OCP\IConfig;
use OC\DB\Connection;
use OC\DB\ConnectionFactory;
@@ -54,6 +55,9 @@ class ConvertType extends Command implements CompletionAwareInterface {
*/
protected $connectionFactory;
+ /** @var array */
+ protected $columnTypes;
+
/**
* @param \OCP\IConfig $config
* @param \OC\DB\ConnectionFactory $connectionFactory
@@ -304,7 +308,7 @@ class ConvertType extends Command implements CompletionAwareInterface {
}
foreach ($row as $key => $value) {
- $insertQuery->setParameter($key, $value);
+ $insertQuery->setParameter($key, $value, $this->getColumnType($table, $key));
}
$insertQuery->execute();
}
@@ -313,6 +317,25 @@ class ConvertType extends Command implements CompletionAwareInterface {
$progress->finish();
}
+ protected function getColumnType($table, $column) {
+ if (isset($this->columnTypes[$table][$column])) {
+ return $this->columnTypes[$table][$column];
+ }
+
+ $prefix = $this->config->getSystemValue('dbtableprefix', 'oc_');
+ $this->columnTypes[$table][$column] = null;
+ if ($table === $prefix . 'cards' && $column === 'carddata') {
+ $this->columnTypes[$table][$column] = IQueryBuilder::PARAM_LOB;
+ } else if ($column === 'calendardata') {
+ if ($table === $prefix . 'calendarobjects' ||
+ $table === $prefix . 'schedulingobjects') {
+ $this->columnTypes[$table][$column] = IQueryBuilder::PARAM_LOB;
+ }
+ }
+
+ return $this->columnTypes[$table][$column];
+ }
+
protected function convertDB(Connection $fromDB, Connection $toDB, array $tables, InputInterface $input, OutputInterface $output) {
$this->config->setSystemValue('maintenance', true);
try {