andreossido / laravel-odbc

ODBC integration for Laravel framework
35 stars 29 forks source link

PSR-4 autoloader instead of class map #15

Open Enrica-r opened 3 years ago

Enrica-r commented 3 years ago

In the composer.json file is call map used for autoloading:

    "autoload": {
        "classmap": [
            "src"
        ]
    },

I would recommend to use PSR-4 for follwing reasons:

   "autoload": {
        "psr-4": {
            "Abram\\ODBC\\": "src/"
        }
    },

With current solution I have to put the grammar classes in 'App' Folder somewhere in order that autoloader can find the grammar classes.

andreossido commented 2 years ago

Hi, can you PR this feature?

prasanth-j commented 2 years ago

Hi @Enrica-r

I am also working with SAP HANA SQL. I used this ODBC to connect with HANA SQL. It is working fine. But migrations are not working. If you know any solution please, help me.

Enrica-r commented 2 years ago

Hi @prasanthjayakumar The default grammars doesn't work for all databases. I used SQLAnywhere database 2 years ago. So I found in another repo a query grammar and a schema grammar class. I modified this and copied it in a folder "grammar" within database/grammar. Check that this folder is loaded in composor.json (psr-4). Then define the two files in your database options of your odbc driver. The array has a property options.grammar.query or ...schema. If there doesn't exist grammar classes for Hana SQL so you have to write it by yourself.