Comments (6)
you have $query_id->getStatement();
please change this
from pdooci.
I'm missing your point. PHP PDO::query
accepts a SQL string and returns a statement:
https://www.php.net/manual/en/pdo.query.php
Parameters
query
The SQL statement to prepare and execute.
Return Values
Returns a PDOStatement object or false on failure.
That's exactly what PDO::query
does here. They are compatible. What is wrong? It's not supposed to return the query string.
from pdooci.
in pdo we can get the query string with this command :
$query_id->queryString;
in your code we can get string we this code :
$query_id->getStatement();
please change this
from pdooci.
Not really.
Taliking about the original PDO
, we can get the query string from the statement using
$statement->queryString;
Check https://www.php.net/manual/en/class.pdostatement.php :
class PDOStatement implements Traversable {
/* Properties */
readonly string $queryString;
So, if you use
$query_id->getStatement();
as said, it will return the statement, not the SQL string, which is correct.
To the get the SQL string, now it's a new implementation, because we don't have the $queryString
property on the Statement
class and it will need to be implemented as a readonly property and stored on the Statement
constructor.
Is that correct? But I wouldn't use readonly properties, because it's only available on PHP 8.1 and I don't want to break compatibility with older versions.
from pdooci.
dear
if possible just change $query_id->getStatement(); to $query_id->queryString;
from pdooci.
No, it's not possible, it will not work, did you test it? You can write code and test by hand. You can write code and test via the test suite. Did you run the test suite to check it?
The queryString
property is a read only property, as I mentioned before. If we try to store it on the Statement
constructor, we'll get an error. I just tested it here:
PDOException: SQLSTATE[HY000]: General error: property queryString is read only
So, with the current code we can access it (it's inherited from PDO::Statement
) but we can't change it. Check this:
The PDO::Statement
class does not have a constructor to call with the SQL string. So, the only way to make this works is removing the PDO::Statement
inheritance from the current Statement
class, but I'm not sure it will miss some methods there. It worked removing, but we need to make sure everything is working.
I just created a new branch called query_string
, could you please use the code there and make sure it works? I don't even use PHP or Oracle anymore. Just installed it here to run the tests.
If you test it, run the test suite, please.
But I think it will be more dangerous to remove the inheritance than to avoid using queryString
.
from pdooci.
Related Issues (20)
- When inserting value with "?" then ":pdooci_m" is inserted instead of "?" HOT 8
- Bind array for sql IN(?) HOT 2
- Class 'PDOStatement' not found HOT 2
- Statement->execute() needs to bind values by reference HOT 3
- Why my code isn't easily translated HOT 1
- Error inserting CLOB value HOT 5
- PHP 5.6 or PHP 7.1 Support? HOT 3
- datatype mismatch PDO vs OCI HOT 7
- Enable dbms_output HOT 1
- Statement->execute() doesn't like bind variables with null values HOT 1
- Can't find way to set prefetch
- Undefined variable: case in file: vendor/taq/pdooci/src/Statement.php on line: 642 HOT 6
- PHP Warning: oci_fetch_all(): ORA-24374:
- ATTR_DEFAULT_FETCH_MODE HOT 1
- ATTR_STRINGIFY_FETCHES
- the question mark problem
- php 8.1 HOT 9
- \PDO::FETCH_BOTH is only fetched as \OCI_NUM HOT 6
- bindParam doesn't use type and leng informations HOT 6
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 pdooci.