Closed mxzwrnz closed 7 years ago
I found something that might cause the error. The URL created when using a database in the config ends with a /, which is interpreted as part of the database name by the Clickhouse Server. The server the throws an exception. Where and how excatly is the building of the URL done?
Hello, will do a fix soon
Fix done, thank you very much
Doesn't work for me. The $url property in Request is empty and can't be trimmed. If I modify afterPrepraeUrl() in Request.php to the following it works:
private` function afterPrepareUrl()
{
$url = $this->getFullUrl();
if (strpos($this,'?') !== false) {
$url = trim($url,'/');
$this->setUrl($url);
}
}
You can url post an example, it can be seen at debug-panel -> log
I have the code locally on my machine. But here's a screen:
If you try to output the $url in the function afterPrepareUrl you get an empty string. Maybe there's the problem?
In my config it says:
'database' => 'productive'
15:29:36.961 error yii\base\Exception exception 'yii\base\Exception' with message 'Query error: Code: 81, e.displayText() = DB::Exception: Database productive/ doesn't exist, e.what() = DB::Exception
' in D:\xampp\htdocs\yii2\vendor\kak\clickhouse\Command.php:245
Stack trace:
#0 D:\xampp\htdocs\yii2\vendor\kak\clickhouse\Command.php(151): kak\clickhouse\Command->queryInternal('fetchAll', NULL)
#1 D:\xampp\htdocs\yii2\vendor\yiisoft\yii2\db\Query.php(210): kak\clickhouse\Command->queryAll()
#2 D:\xampp\htdocs\yii2\vendor\yiisoft\yii2\db\ActiveQuery.php(133): yii\db\Query->all(NULL)
#3 D:\xampp\htdocs\yii2\models\inRouter.php(23): yii\db\ActiveQuery->all()
#4 D:\xampp\htdocs\yii2\controllers\AjaxController.php(80): app\models\inRouter->getResultList('13')
#5 [internal function]: app\controllers\AjaxController->actionAutocomplete()
#6 D:\xampp\htdocs\yii2\vendor\yiisoft\yii2\base\InlineAction.php(55): call_user_func_array(Array, Array)
#7 D:\xampp\htdocs\yii2\vendor\yiisoft\yii2\base\Controller.php(154): yii\base\InlineAction->runWithParams(Array)
#8 D:\xampp\htdocs\yii2\vendor\yiisoft\yii2\base\Module.php(454): yii\base\Controller->runAction('autocomplete', Array)
#9 D:\xampp\htdocs\yii2\vendor\yiisoft\yii2\web\Application.php(100): yii\base\Module->runAction('ajax/autocomple...', Array)
#10 D:\xampp\htdocs\yii2\vendor\yiisoft\yii2\base\Application.php(375): yii\web\Application->handleRequest(Object(yii\web\Request))
#11 D:\xampp\htdocs\yii2\web\index.php(12): yii\base\Application->run()
#12 {main}
i uploaded your fix, pls test
I tried to set the config parameter 'database' to my productive database and I also tried to set the table to 'db.table' which both returns an error. How to set a database properly?