Closed FaaPz closed 4 years ago
Add a way to do WHERE X = 1 OR (Y = 2 AND Z = 3)
.
Also should think about things like nested queries.
I have some ideas about how to accomplish these, but I am probably not going to have time to look at them for another week or so.
Maybe a way to do field aliases AS
in a SELECT
clause.
Useful when you join tables with same field names.
@kwhat Well, I don't know what you want to do exactly, but what I understand from your question is possible by doing:
$array = $pdo->select()
->from('friends')
->where('friend_one', '=', $args['id'])
->orWhere('friend_two', '=', $args['id'])
->where('status', '=', 1)
->orWhere('status', '=', 0)
->execute()
->fetchAll();
@gromez +1, I had the same problem not a long time ago, it would be really interesting!
@gromez I believe there is a way to do that, but I would like to make it a little more intuitive. I need to relay more heavily on that that functionality for MsSQL.
A way to accomplish this would be nice, "SELECT abc, def, MAX(ghj) FROM...", I tried this
->select(array('abc','def')) ->from('table') ->max('gjh')
But due to the $aggregate variable being set, it will trim of everything except the MAX(ghj)
. Maybe I'm missing something and it's possible?
@bubach In v1.9.6 (5f766ca63b8a8e45e7a27acaa3edadb1cf5e55a8) I've fixed it. The $aggregate
variable won't do anything (for) now. :grin:
@FaaPz Will you rewrite the whole thing or patch v.1? And how about BC? I think that it's also a good idea to bump the required PHP version to 5.5 or 5.6. Then we can use the newer array syntax.
@jordi12100 V2 will be a whole rewrite, so it's easier extendable for all kinds of projects with different RDBMSs. There will be BC for fixes, not for (new) features. And yes, I'm thinking about using PHP 5.6. What do you prefer/recommend?
It would be nice if this library also included tests. :)
I wanted to use pdo, but there is only one thing missing that i really needed. The ability to work with stored procedures. For now i have forked this repo and added stored produces. Its not completely ready but for me it works (should work for others). Not yet tested by others.
Let me know if you are interested and what you think needs to be done.
@EdwinHuijsing Stored procedures are fully supported in 2.x right now :)
Hello Everyone,
I have tagged the 2.0 release. I am pleased with the number of issues addressed and goals met for this release. A couple of items didn't quite make it and should be pushed to a future 2.x release.
ON DUPLICATE KEY UPDATE (#32)
I still haven't come up with a way to handle this but I am shooting for 2.1 along with support for multiple insert statements.
Detect database driver (could be useful for e.g. #29)
This was a good idea, however, things fall apart as soon as you introduce ODBC. This could still be possible with a factory, but I think the better answer maybe to add extension projects that support the required database. For example, something to the effect of FaaPz/PDO-Postgres and FaaPz/PDO-Microsoft. Those requiring compatibility would add these package(s) and construct it's PDO object.
None of these decisions are final, ideas and comments are welcome. I will come back and update this ticket with new tickets to address the above features and then close this issue.
Version 2.1 will address the remaining issues and a new branch has already been created.
For #29, I have created https://github.com/kwhat/PDO-SqlSrv as an experimental extension library. If everything works out, I will create another one for Postgres and any other databases we would like to support. @FaaPz I will be gifting this repo to you.
V2 Road Map
private
variables and functions, onlyprotected
'one, two'
), arrays ([$one, $two]
) and...
parametersAS
inSELECT
clausesON DUPLICATE KEY UPDATE
(#32)If anyone has any suggestions, let me know! :pray: