Laravel/MSSQL(AWS RDS)一般错误:20018 Unicode数据
问题描述:
我正在使用SQL Server与Laravel 5.4项目,但是当我使用Laravel\Socialite
时,它在我的处理程序中返回一个错误。Laravel/MSSQL(AWS RDS)一般错误:20018 Unicode数据
SQLSTATE[HY000]: General error: 20018 Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier. [20018] (severity 16) [(null)] (SQL: select top 1 * from [social_logins] where [social_id] = 109095424026454018110 and [provider] = google)
在谷歌/ *的答案,有的说我必须要改变tds version
到8.0
和client charset
,但我有我的数据库的RDS亚马逊Web Services和不能改变它(我小白)。
答
问题是在Laravel方式中使用select *。
$userRes = User::where('email', '=', $user->email)->first();
所以我加选择( '列1', '列1')这样
$userRes = User::select('id','email')->where('email', '=', $user->email)->first();
然后一切运作良好。