You didn't actually show how you are connecting, so I have no clue what your $query object was.
I usually extend the PDO object myself -- making it call the connection info itself with a check so it can only initialize once from my 'one index.php to rule them all'; restricting the $db var's scope as the only allowed instance of PDO so that only code that should be able to use the database can do so (reducing the windows in which code elevations can occur)...
I even override ::prepare, ::exec and ::query with the ability to pass a $module and $query strings, which lets me use 'named queries' loaded from a $module.ini file (which are kept local in scope when loaded to my extended PDO object) so code can't just 'make up' queries out of the blue. You have to add them to the appropriate .ini file.
... which also means I can load different .ini files depending on the engine.
Would load /queries/engineName/common.ini if it's not already in the array of queries (pdoExtended::queryStrings['common']), and then parent::exec($this->queryStrings['common']['purgeExpiredSessions']);
The neat part being that doing it this way lets me have:
... and so forth. I also store my db.php file (containing the extended objects) in /queries/engineName so I can have different codebases of the object for each engine, letting me 'polyfill' engine differences. (which can normally be a PITA)
The technique is called "named queries" -- was really big in the mid 1990's when suddenly there were all these new engines people wanted to use in existing languages, but faded into obscurity for... well, I'm not sure why.
In any case (yeah, I know, I'm rambling. Insomnia does that) without seeing what you are using FOR an object, it's hard to say if you're doing it right or not. If your object is WRAPPING PDO, that might be a waste, if however you are extending it? Usually not a bad idea. After all, extensibility is one of the entire reasons to use objects in the first place.
Though if your object is wrapping the old mysql_ functions -- do yourself a favor and stop right there.