Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select count have error Incorrect syntax near ')'. #35

Open
sandyh90 opened this issue Jan 15, 2023 · 0 comments
Open

Select count have error Incorrect syntax near ')'. #35

sandyh90 opened this issue Jan 15, 2023 · 0 comments

Comments

@sandyh90
Copy link

sandyh90 commented Jan 15, 2023

PHP Version: 8.1.2 (x64)
SQL Server Version: Microsoft SQL Server 2022 (RTM) - 16.0.1000.6 (X64)
Framework: Codeigniter 4.3.1

Hello,

I have a problem when using this library with this error message
[Microsoft][ODBC Driver 17 for SQL Server][SQL Server] Incorrect syntax near ')'.

here is my error debug:

{
    "title": "CodeIgniter\\Database\\Exceptions\\DatabaseException",
    "type": "CodeIgniter\\Database\\Exceptions\\DatabaseException",
    "code": 500,
    "message": "[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near ')'.",
    "file": "D:\\Server\\ci-attend\\vendor\\codeigniter4\\framework\\system\\Database\\BaseConnection.php",
    "line": 645,
    "trace": [
        {
            "file": "D:\\Server\\ci-attend\\vendor\\codeigniter4\\framework\\system\\Database\\BaseBuilder.php",
            "line": 1686,
            "function": "query",
            "class": "CodeIgniter\\Database\\BaseConnection",
            "type": "->",
            "args": [
                "SELECT COUNT(*) AS \"numrows\"\nFROM \"ci-attend\".\"dbo\".\"employees\"\nWHERE   (\n )",
                [],
                false
            ]
        },
        {
            "file": "D:\\Server\\ci-attend\\vendor\\irsyadulibad\\codeigniter4-datatables\\src\\DataTableAbstract.php",
            "line": 137,
            "function": "countAllResults",
            "class": "CodeIgniter\\Database\\BaseBuilder",
            "type": "->",
            "args": [
                false
            ]
        },
        {
            "file": "D:\\Server\\ci-attend\\vendor\\irsyadulibad\\codeigniter4-datatables\\src\\DataTableAbstract.php",
            "line": 146,
            "function": "countTotal",
            "class": "Irsyadulibad\\DataTables\\DataTableAbstract",
            "type": "->",
            "args": []
        },
        {
            "file": "D:\\Server\\ci-attend\\vendor\\irsyadulibad\\codeigniter4-datatables\\src\\QueryDataTable.php",
            "line": 37,
            "function": "countFiltered",
            "class": "Irsyadulibad\\DataTables\\DataTableAbstract",
            "type": "->",
            "args": []
        },
        {
            "file": "D:\\Server\\ci-attend\\vendor\\irsyadulibad\\codeigniter4-datatables\\src\\QueryDataTable.php",
            "line": 27,
            "function": "execQueries",
            "class": "Irsyadulibad\\DataTables\\QueryDataTable",
            "type": "->",
            "args": []
        },
        {
            "file": "D:\\Server\\ci-attend\\app\\Controllers\\Admin\\EmployeeManageController.php",
            "line": 35,
            "function": "make",
            "class": "Irsyadulibad\\DataTables\\QueryDataTable",
            "type": "->",
            "args": [
                true
            ]
        },
        {
            "file": "D:\\Server\\ci-attend\\vendor\\codeigniter4\\framework\\system\\CodeIgniter.php",
            "line": 934,
            "function": "get_employees",
            "class": "App\\Controllers\\Admin\\EmployeeManageController",
            "type": "->",
            "args": []
        },
        {
            "file": "D:\\Server\\ci-attend\\vendor\\codeigniter4\\framework\\system\\CodeIgniter.php",
            "line": 499,
            "function": "runController",
            "class": "CodeIgniter\\CodeIgniter",
            "type": "->",
            "args": [
                {}
            ]
        },
        {
            "file": "D:\\Server\\ci-attend\\vendor\\codeigniter4\\framework\\system\\CodeIgniter.php",
            "line": 368,
            "function": "handleRequest",
            "class": "CodeIgniter\\CodeIgniter",
            "type": "->",
            "args": [
                null,
                {
                    "handler": "file",
                    "backupHandler": "dummy",
                    "storePath": "D:\\Server\\ci-attend\\writable\\cache/",
                    "cacheQueryString": false,
                    "prefix": "",
                    "ttl": 60,
                    "reservedCharacters": "{}()/\\@:",
                    "file": {
                        "storePath": "D:\\Server\\ci-attend\\writable\\cache/",
                        "mode": 416
                    },
                    "memcached": {
                        "host": "127.0.0.1",
                        "port": 11211,
                        "weight": 1,
                        "raw": false
                    },
                    "redis": {
                        "host": "127.0.0.1",
                        "password": null,
                        "port": 6379,
                        "timeout": 0,
                        "database": 0
                    },
                    "validHandlers": {
                        "dummy": "CodeIgniter\\Cache\\Handlers\\DummyHandler",
                        "file": "CodeIgniter\\Cache\\Handlers\\FileHandler",
                        "memcached": "CodeIgniter\\Cache\\Handlers\\MemcachedHandler",
                        "predis": "CodeIgniter\\Cache\\Handlers\\PredisHandler",
                        "redis": "CodeIgniter\\Cache\\Handlers\\RedisHandler",
                        "wincache": "CodeIgniter\\Cache\\Handlers\\WincacheHandler"
                    }
                },
                false
            ]
        },
        {
            "file": "D:\\Server\\ci-attend\\public\\index.php",
            "line": 67,
            "function": "run",
            "class": "CodeIgniter\\CodeIgniter",
            "type": "->",
            "args": []
        }
    ]
}

here the code what I produce:

        return DataTables::use('employees')
            ->addColumn('employee', function ($data) {
                return '-';
            })
            ->addColumn('workgroup', function ($data) {
                return '-';
            })
            ->addColumn('actions', function ($data) {
                return '<div class="d-grid gap-2 d-sm-block">
                <div class="btn btn-primary"><span class="bi bi-card-text"></span></div>
                <div class="btn btn-danger"><span class="bi bi-trash"></span></div>
            </div>';
            })
            ->rawColumns(['actions'])
            ->hideColumns(['password'])
            ->make(true);

And already check this issue the same as what I got in #20 but the version that I use for the library is 3.0.0 and still have issues.

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

No branches or pull requests

1 participant