Skip to content
This repository has been archived by the owner on Nov 27, 2020. It is now read-only.

I keep getting "Couldn't parse SQL" #6

Open
quarkmarino opened this issue Jul 9, 2019 · 0 comments
Open

I keep getting "Couldn't parse SQL" #6

quarkmarino opened this issue Jul 9, 2019 · 0 comments

Comments

@quarkmarino
Copy link

quarkmarino commented Jul 9, 2019

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 (#2 (comment)) 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.

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

No branches or pull requests

1 participant