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

Raw SQL in log file shows wrong query SQL text #5

Closed
kirkkhua opened this issue Nov 9, 2013 · 3 comments
Closed

Raw SQL in log file shows wrong query SQL text #5

kirkkhua opened this issue Nov 9, 2013 · 3 comments

Comments

@kirkkhua
Copy link

kirkkhua commented Nov 9, 2013

I think, in DB class, Init method it would be better to use:

echo $this->ExceptionLog($e->getMessage(),$query);

instead of

echo $this->ExceptionLog($e->getMessage(),$this->sQuery->queryString);

with UPDATE query.

@wickyaswal
Copy link
Owner

What do you mean with UPDATE query ? When the user provides an update query the class should use this :

 $this->ExceptionLog($e->getMessage(), $query);

@kirkkhua
Copy link
Author

The code you provided showed me following:

Time : 00:01:14 SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE user_id = ? LIMIT 1' at line 5 Raw SQL : SELECT * FROM users WHERE phone_number='1' LIMIT 1

Taw SQL above runs without any errors (I removed some quotes to use GitHub markdown), while another query in the same script with "UPDATE ..." contained syntax error. The problem is that code you've provided above shows different query which doesn't contain any errors.

You may also see that log is pointing on line 5 while it is hard to imagine that there is 5 lines in such simple query.

@wickyaswal
Copy link
Owner

Yes. Instead of using $this->sQuery->queryString, the direct $query variable would be better.
I've replaced that line.

Thanks again smoyzasoboy 👍

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

2 participants