Comments (6)
No problem, thanks for answering !
It indeed works better thanks :)
from pdo.
I also have an error Fatal error: Uncaught PDOException: SQLSTATE[HY093]: Invalid parameter number
on this code:
$countStmt = $db->select(['count' => new Method('COUNT', 'id')])
->from('game_prize_won')
->where(new Conditional('creationDate', '>', date('c', strtotime('today midnight'))));
from pdo.
Can you try with version 2.1 and let me know if you still have this problem.
from pdo.
Can you try with version 2.1 and let me know if you still have this problem.
Yep, still have both issues..
from pdo.
So, any idea of the issue @kwhat ?
from pdo.
Sorry, I've been out of town for a few days and things have been a bit busy at work.
There are a couple of problems with the first select statement. The arguments for the Grouping do not require an array, the constructor should be veradic. The Conditional statements for the data will need either Raw or Method to work correctly due to the statement being prepared.
$db->select([
'id',
'value',
'text',
'isLosing',
'_maxWinner',
'_maxWinnerPerPeriod',
'_maxWinnerPeriod',
'_minDate',
'_maxDate',
'totalWon',
])
->from('game_prize_types')
->where(
new Grouping(
'AND',
new Grouping(
'OR',
new Conditional('totalWon', '>', '_maxWinner'),
new Conditional('_maxWinner', 'IS', 'NULL')
),
new Grouping(
'OR',
new Conditional('_minDate', '<=', new Raw('NOW()')),
new Conditional('_minDate', 'IS', 'NULL')
),
new Grouping(
'OR',
new Conditional('_maxDate', '>=', new Method('NOW')),
new Conditional('_maxDate', 'IS', 'NULL')
)
)
)
The second is a little more subtle. The issue is because you cannot prepare values for columns, so you need to use Raw instead of Method. Method was really only conceived for calling stored procedures but will also work for functions called within conditionals. I know, its a bit confusing and I am working on making it a bit more flexible with 3.x among other things.
$db->select(['count' => new Raw('COUNT(id)')])
->from('game_prize_won')
->where(new Conditional('creationDate', '>', date('c', strtotime('today midnight'))))
from pdo.
Related Issues (20)
- Email and domain not working? HOT 1
- MD5 of column value in where clause HOT 1
- Error when setting charset HOT 1
- Join not working properly HOT 4
- Uncaught TypeError: Argument 1 passed to FaaPz\PDO\DatabaseException::__construct() must be of the type string, null given HOT 15
- Invalid value for insert statement when trying to insert NULL HOT 4
- Insert execute no longer return new id HOT 1
- How to use Clasule RAW HOT 2
- Creating the WHERE clause HOT 1
- Inserts are duplicated HOT 1
- Error in docs of update HOT 1
- Insert Many Table HOT 1
- Help needed on insert statement HOT 14
- Update about text "Just another PDO database library" HOT 1
- lastinsertid removed? HOT 2
- README not up to date HOT 4
- orderBy is not rendered when optional direction is omitted HOT 2
- Limit is treated as a string HOT 7
- Between condition with parentheses lead to strange state HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdo.