2017-09-26 152 views
0

我正在使用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) 

在谷歌/ StackOverflow的答案,有的說我必須要改變tds version8.0client charset,但我有我的數據庫的RDS亞馬遜Web Services和不能改變它(我小白)。

回答

0

問題是在Laravel方式中使用select *。

$userRes = User::where('email', '=', $user->email)->first(); 

所以我加選擇( '列1', '列1')這樣

$userRes = User::select('id','email')->where('email', '=', $user->email)->first(); 

然後一切運作良好。