Search code examples
phpquickbooks

How change the default DB prefix and table names in Consolibyte Quickbooks Web Connector


I'm using the Consolibyte Quickbooks Web Connector PHP Library and testing the example app in web_connector/example_app_web_connector/and it works in most parts. However, it generates its own DB prefix & tables names upon initialization. I'm wondering how I can override them so that I can use my own database naming structure.

I've seen that they were defined in QuickBooks/Driver/Sql.php but I know it's not a good idea to directly change the values from there.

I found $driver_options = [] but I'm not sure what option keys to provide.


Solution

  • You can define the prefix before including the code.

    define('QUICKBOOKS_DRIVER_SQL_MYSQLI_PREFIX', 'your_custom_prefix');

    Reference this:

    Where the code does this to allow you to override the prefix:

    if (!defined('QUICKBOOKS_DRIVER_SQL_MYSQLI_PREFIX'))
    {
        define('QUICKBOOKS_DRIVER_SQL_MYSQLI_PREFIX', QUICKBOOKS_DRIVER_SQL_PREFIX);
    }