laravel-msaccess
laravel-msaccess copied to clipboard
I keep getting "Couldn't parse SQL"
Hi, I liked your package, so far is the only one I've found that makes a .mdb to behave in a similar way to any other eloquent model, however I can't make it to work properly.
My environment would be the following
OS: Ubuntu 16.04 PHP: 7.2 Laravel: 5.6 Mysql: 8.0.16 (I need both MySQL and the .mdb)
the legacy .mdb file that the mdb viewer can open normally
I've follow the link (https://github.com/zoilomora/laravel-msaccess/issues/2#issuecomment-407362111) that explains how to correctly configure the odbc to work in linux, and I can confirm that it works correclty if a do a vanilla "select * from Workers", and in a way I could confirm that it works with your package, now, I say "In a way", because I had to manually disable the "[" and "]" that wraps the table names from "Illuminate\Database\Query\Grammar\Grammar" on every query that I run
class Grammar extends BaseGrammar{
...
protected function compileFrom(Builder $query, $table)
{
// return 'from '.$this->wrapTable($table);
return 'from '.$table;
}
...
protected function compileOrders(Builder $query, $orders)
{
// if (! empty($orders)) {
// return 'order by '.implode(', ', $this->compileOrdersToArray($query, $orders));
// }
return '';
}
...
}
Otherwise I keep getting "Couldn't parse SQL", also by default it normaly adds an order clause "order by 1 asc" which I also disabled (shown above), disabling those makes a php like the following to work
return Worker::first();
which previously generated a query like this
select * from [Workers] order by 1 asc
so, how could I make it to work without all this ugly hacks that kind of messes up with my other normal database (mysql).
Thank you very much, for the package and for the help.