{"action":"opened","issue":{"url":"https://api.github.com/repos/yiisoft/yii/issues/3719","labels_url":"https://api.github.com/repos/yiisoft/yii/issues/3719/labels{/name}","comments_url":"https://api.github.com/repos/yiisoft/yii/issues/3719/comments","events_url":"https://api.github.com/repos/yiisoft/yii/issues/3719/events","html_url":"https://github.com/yiisoft/yii/issues/3719","id":54873725,"number":3719,"title":"CDbCommandBuilder::createMultipleInsertCommand should use 'schemaName' in insert query","user":{"login":"gopi-ar","id":3132453,"avatar_url":"https://avatars.githubusercontent.com/u/3132453?v=3","gravatar_id":"","url":"https://api.github.com/users/gopi-ar","html_url":"https://github.com/gopi-ar","followers_url":"https://api.github.com/users/gopi-ar/followers","following_url":"https://api.github.com/users/gopi-ar/following{/other_user}","gists_url":"https://api.github.com/users/gopi-ar/gists{/gist_id}","starred_url":"https://api.github.com/users/gopi-ar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gopi-ar/subscriptions","organizations_url":"https://api.github.com/users/gopi-ar/orgs","repos_url":"https://api.github.com/users/gopi-ar/repos","events_url":"https://api.github.com/users/gopi-ar/events{/privacy}","received_events_url":"https://api.github.com/users/gopi-ar/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-20T11:45:49Z","updated_at":"2015-01-20T11:45:49Z","closed_at":null,"body":"If we pass a database name along with a table name to `createMultipleInsertCommand`, it leaves the database name out of the final query. This causes issues when the default DB specified in the connection is not the DB we need to make the inserts into.\r\n\r\nFor e.g. if we call\r\n `CDbCommandBuilder::createMultipleInsertCommand(\"db_b.table_a\", $data)` \r\nwe expect the final `INSERT` query to retain `db_b` as well. \r\n\r\nHowever, this is removed from the query at:\r\n`$tableName = $this->getDbConnection()->quoteTableName($table->name);`\r\n\r\nTo retain the DB name, $tableName can be changed as:\r\n`$tableName = $this->getDbConnection()->quoteTableName($table->rawName);`"}}