-
Notifications
You must be signed in to change notification settings - Fork 61
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
Using Sqlserver "WITH" clause in CakePhp2 #33
Comments
Hey @Alibert-07 Thanks for creating the issue! My intention of this fork is to just support PHP8.* and provide necessary fixes. I didn't plan to add new features to the framework. Unfortunately I have limited amount of time I can spend working on this work. Could you try running raw query as a workaround? E.g.: $this->AppModel->query("SELECT * WHERE id = ?", [$id]); I think first param should accept also a table expression query. |
Hi! I am quite new to github. I have to use cakephp 2 for sometime in the future because of massive amount of code, ported from 1.1, 1.2, 1.3 to 2 but didn't have time and resources to port it to 3 and higher. I am glad, if i can help maintain the fork. Should i fork the project and use pull requests to suggest updates? |
@Alibert-07 Yes, please fork the repository and create PR if you have some spare time. I will really appreciate it. 😊 |
I use the Sqlserver "WITH common_table_expression" expression in CakePhp 2.
In Sqlserver.php in the Method "_execute" the Code tests for "SELECT" or "EXEC" to determine if an SQL Statement is valid for Execution.
cakephp2-php8/lib/Cake/Model/Datasource/Database/Sqlserver.php
Lines 798 to 802 in ce3e0c3
May it be possible to change the Code in Line 799 to
if ((strncasecmp($sql, 'SELECT', 6) === 0) || (strncasecmp($sql, 'WITH', 4) === 0) || preg_match('/^EXEC(?:UTE)?\s/mi', $sql) > 0) {
so the WITH clause can be used out of the box.
Sorry if the is not the correct way to make suggestions, but i am relatively new to GitHub. ;-)
The text was updated successfully, but these errors were encountered: