uepg/laravel-sybase

I do not understand how Sybase queries from the model of laravel

Opened this issue · 4 comments

$chq_cust = chq_cust::select('active')->where('active', 'y')->get();

error SQLSTATE[HY000]: General error: 20018 SQL Anywhere Error -852: Table name 'syscolumns' is ambiguous [20018] (severity 16) [ SELECT a.name, st.name AS type FROM syscolumns a, systypes b, systypes s, systypes st WHERE a.usertype = b.usertype AND s.usertype = a.usertype AND s.type = st.type AND st.name NOT IN ( 'timestamp', 'sysname', 'longsysname', 'nchar', 'nvarchar' ) AND st.usertype < 100 AND object_name (a.id) = 'dba.chq_cust'] (SQL: select [active] from [dba].[chq_cust] where [active] = y)

@Montolsky Try use yourdatabase..tablename in $table var on Model. See #63

hey @Montolsky , had the same error, could connect and could query the tables with models, but anytime I tried a WHERE clause I had the error you mentioned.

only using whereRaw I could made it work, not using Where

/*** Option A ****/
$carrera = \App\Carrera::whereRaw('carrera = 171')->first();

/*** Option B - just plain SQL ****/
$carrera= DB::select("SELECT * from carreras where carrera = 171");

/*** Option C /
$carrera= DB::table('carreras')->select('
')->whereRaw('carrera = 171')->get();

Same error but when trying to insert a row into any table.

After trying this solution "tablename in $table var on Model." I got an error saying:
Undefined variable $types at /var/www/html/vendor/jcrodriguezt/laravel-sybase/src/Database/Connection.php:447

Same error but when trying to insert a row into any table.

After trying this solution "tablename in $table var on Model." I got an error saying: Undefined variable $types at /var/www/html/vendor/jcrodriguezt/laravel-sybase/src/Database/Connection.php:447

Show your model code perhaps