Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue while using sybase with different schemas #40

Open
vservin opened this issue Sep 14, 2018 · 3 comments
Open

Issue while using sybase with different schemas #40

vservin opened this issue Sep 14, 2018 · 3 comments

Comments

@vservin
Copy link

vservin commented Sep 14, 2018

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":"[email protected]","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
Copy link
Collaborator

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

@vservin
Copy link
Author

vservin commented Sep 14, 2018

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
Copy link
Author

vservin commented Sep 14, 2018

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":"[email protected]","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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants