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

grabFromDatabase doesn’t work #105

Closed
pim opened this issue Jan 9, 2013 · 2 comments
Closed

grabFromDatabase doesn’t work #105

pim opened this issue Jan 9, 2013 · 2 comments

Comments

@pim
Copy link

pim commented Jan 9, 2013

Hey,

I’m new to Codeception but and I have a small problem. It might be me who doesn’t fully understand the framework, don’t bite me in that case please ;)

I have WebGuy test in which I wanted to get some data from database, just like this: $I->grabFromDatabase('users_data', array('phone' => '555666777'));.
I keep getting this error:
PDOException: 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 '' at line 1

I thought it’s my mistake, but when I changed the grabFromDatabase to seeInDatabase it worked properly, so my syntax was apparently okay. It looks like Codeception is generating invalid SQL code, but it’s only my theory there’s a possibility that I’m wrong.

Cheers!

@DavertMik
Copy link
Member

There is different syntax in grabFromDatabase. In this command you need to specify a column to grab.

->grabFromDatabase('users', 'email', array('name' => 'davert'));

Ok, ok, bad example in docs.
Fixing...

@pim
Copy link
Author

pim commented Jan 9, 2013

Thanks for help! :)

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