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

SQLite3 Datasource - Wrong regexp to get field names #69

Open
ghost opened this issue Oct 11, 2013 · 0 comments
Open

SQLite3 Datasource - Wrong regexp to get field names #69

ghost opened this issue Oct 11, 2013 · 0 comments
Assignees
Labels

Comments

@ghost
Copy link

ghost commented Oct 11, 2013

Created by Sebastian Isaac Velasco, 30th Jun 2011. (originally Lighthouse ticket #24):


What happened

The function resultSet (dbo_sqlite3.php) has a regexp to extract the field name from the columns defined like:

field_expression AS field_name

The current regexp is a bit weak and sometimes (using virtual fields) the field name is not the correct.
The code to modify is:

https://github.com/cakephp/datasources/blob/master/models/datasources/dbo/dbo_sqlite3.php

534            if (preg_match('/.*AS (.*).*/i', $selects[$j], $matches)) {

What I expected to happen

The code should be like:

https://github.com/cakephp/cakephp/blob/2.0/lib/Cake/Model/Datasource/Database/Sqlite.php

302            if (preg_match('/\bAS\s+(.*)/i', $selects[$j], $matches)) {

Thanks for all !!!

@ghost ghost assigned predominant Oct 11, 2013
@AD7six AD7six added the sqlite3 label Feb 17, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants