uepg / laravel-sybase

Connection and Laravel Eloquent driver for Sybase
GNU General Public License v2.0
33 stars 18 forks source link

Issue while using sybase with different schemas #40

Open vservin opened 6 years ago

vservin commented 6 years ago

Hello I got this error from the logs while trying to make a model::find(12345789);

Undefined variable: tipos (SQL: select top 1 from [adminSchema].[Alumnos_Expediente] where [adminSchema].[Alumnos_Expediente].[id_documento] = 12345789) {"userId":1,"email":"vservin@text.com","exception":"[object] (Illuminate\Database\QueryException(code: 0): Undefined variable: tipos (SQL: select top 1 from [adminSchema].[Alumnos_Expediente] where [adminSchema].[Alumnos_Expediente].[id_documento] = 12345789) at /var/www/html/expeleLaravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664, ErrorException(code: 0): Undefined variable: tipos at /var/www/html/expeleLaravel/vendor/uepg/laravel-sybase/Database/SybaseConnection.php:177)

My model is well configured given that i had to make a custom find function that implemented a whereRaw, in a whereRaw the query does work, in a normal where it doesn't. class Documento extends Model { protected $connection = 'sybase'; protected $table = 'adminSchema.Documento'; protected $primaryKey = 'id_documento'; public $incrementing = false; public $timestamps = false; public static function find($search){ return static::whereRaw("id_documento = $search")->first(); }

I believe this error has to due that the package can't get the column type, if it's a string or number or what

but I emphasis that my model is correct, since the whereRaw works. I could solve the find method with my custom find, but now i'm stuck while trying to make a validation with "exists:sybase.adminSchema.ActaNacimiento,id_documento" I hope we can solve this error, thanks

mainginski commented 6 years ago

Try to use 'adminSchema..Documento'; (with double .) at table name

vservin commented 6 years ago

Already did, and gives another error

[2018-09-14 11:40:47] local.ERROR: SQLSTATE[HY000]: General error: 20018 adminSchema..systypes not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output). [20018] (severity 16)

vservin commented 6 years ago

Also on the default model method save throws an error

[2018-09-14 12:13:51] local.ERROR: Undefined variable: table (SQL: update [adminSchema].[ActaNacimiento] set [fecha_nacimiento] = 10/11/1985 where [id_documento] = 13779758) {"userId":1,"email":"vservin@test.com","exception":"[object] (Illuminate\Database\QueryException(code: 0): Undefined variable: table (SQL: update [adminSchema].[ActaNacimiento] set [fecha_nacimiento] = 10/11/1985 where [id_documento] = 13779758) at /var/www/html/expeleLaravel/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664, ErrorException(code: 0): Undefined variable: table at /var/www/html/expeleLaravel/vendor/uepg/laravel-sybase/Database/SybaseConnection.php:307)