From 9d4d399aa3296c40daed863a7ed31601c1c724c3 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Tue, 12 Mar 2013 15:32:28 +0100 Subject: [PATCH 1/2] write error message to log file in case insert to file cache failed - took hours to find that the insert failed :-( --- lib/files/cache/cache.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php index f288919df7..1ff66f11f1 100644 --- a/lib/files/cache/cache.php +++ b/lib/files/cache/cache.php @@ -203,7 +203,10 @@ class Cache { $query = \OC_DB::prepare('INSERT INTO `*PREFIX*filecache`(' . implode(', ', $queryParts) . ')' . ' VALUES(' . implode(', ', $valuesPlaceholder) . ')'); - $query->execute($params); + $result = $query->execute($params); + if (\MDB2::isError($result)) { + \OCP\Util::writeLog('cache', 'Insert to cache failed: '.$result, \OCP\Util::ERROR); + } return (int)\OC_DB::insertid('*PREFIX*filecache'); } From ec1685311258935548512be3698b59512b084de5 Mon Sep 17 00:00:00 2001 From: Thomas Mueller Date: Tue, 12 Mar 2013 15:33:37 +0100 Subject: [PATCH 2/2] enable UTF-8 charset on mssql disable MDB2_PORTABILITY_EMPTY_TO_NULL for mssql to allow insert of empty string to no null fields --- lib/db.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/db.php b/lib/db.php index 347deac851..9699b216f6 100644 --- a/lib/db.php +++ b/lib/db.php @@ -292,8 +292,10 @@ class OC_DB { 'username' => $user, 'password' => $pass, 'hostspec' => $host, - 'database' => $name - ); + 'database' => $name, + 'charset' => 'UTF-8' + ); + $options['portability'] = $options['portability'] - MDB2_PORTABILITY_EMPTY_TO_NULL; break; default: return false;