Comments (6)
no error (but table tasks_invalid does not exist):
$pdo = new \PDO('mysql:host=mysql;dbname=tasks;port=3306;charset=utf8mb4;', 'root', 'root');
$query = 'SELECT id, title, duedate, completed, last_updated_by FROM tasks_invalid WHERE customer_id = ? AND completed = 1';
$statement = $pdo->prepare($query);
$statement->execute([123]);
$result = $statement->fetch();
Query error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'tasks.tasks_invalid' doesn't exist (42S02).
$pdo = new \PDO('mysql:host=mysql;dbname=tasks;port=3306;charset=utf8mb4;', 'root', 'root');
$query = 'SELECT id, title, duedate, completed, last_updated_by FROM tasks_invalid WHERE customer_id = 123 AND completed = 1';
$statement = $pdo->prepare($query);
$statement->execute([]);
$result = $statement->fetch();
from phpstan-dba.
Another example:
no error (but table task_invalid does not exist):
$pdo = new \PDO('mysql:host=mysql;dbname=tasks;port=3306;charset=utf8mb4;', 'root', 'root');
$ids = implode(',', array_map(intval(...), [1,2,3]));
$query = sprintf('SELECT id, title, duedate, completed, last_updated_by FROM task_invalid WHERE id IN (%s)', $ids);
$statement = $pdo->query($query);
Query error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'tasks.task_invalid' doesn't exist (42S02).
$pdo = new \PDO('mysql:host=mysql;dbname=tasks;port=3306;charset=utf8mb4;', 'root', 'root');
$ids = '1,2,3';
$query = sprintf('SELECT id, title, duedate, completed, last_updated_by FROM task_invalid WHERE id IN (%s)', $ids);
$statement = $pdo->query($query);
from phpstan-dba.
thanks for the report.
please try enabling debugMode
and see whether you get a usefull error.
can you reproduce the error in a small repository?
from phpstan-dba.
<?php
$pdo = new \PDO('mysql:host=mysql;dbname=tasks;port=3306;charset=utf8mb4;', 'root', 'root');
$ids = implode(',', array_map(intval(...), [1,2,3]));
$query = sprintf('SELECT id, title, duedate, completed, last_updated_by FROM task_invalid WHERE id IN (%s)', $ids);
$statement = $pdo->query($query);
print_r($statement->fetchAll());
$pdo = new \PDO('mysql:host=mysql;dbname=tasks;port=3306;charset=utf8mb4;', 'root', 'root');
$query = sprintf('SELECT id, title, duedate, completed, last_updated_by FROM task_invalid WHERE id IN (%s)', '1,2,3');
$statement = $pdo->query($query);
print_r($statement->fetchAll());
$pdo = new \PDO('mysql:host=mysql;dbname=tasks;port=3306;charset=utf8mb4;', 'root', 'root');
$query = 'SELECT id, title, duedate, completed, last_updated_by FROM tasks_invalid WHERE customer_id = ? AND completed = 1';
$statement = $pdo->prepare($query);
$statement->execute([123]);
$result = $statement->fetch();
$pdo = new \PDO('mysql:host=mysql;dbname=tasks;port=3306;charset=utf8mb4;', 'root', 'root');
$query = 'SELECT id, title, duedate, completed, last_updated_by FROM tasks_invalid WHERE customer_id = 123 AND completed = 1';
$statement = $pdo->prepare($query);
$statement->execute([]);
$result = $statement->fetch();
gives:
------ ---------------------------------------------------------------------------------------------------------------------
Line test.php
------ ---------------------------------------------------------------------------------------------------------------------
6 Unresolvable Query: Cannot resolve query with variable type: non-falsy-string.
💡 Consider replacing concatenated string-variables with prepared statements or @phpstandba-inference-placeholder.
6 Unresolvable Query: Cannot resolve query with variable type: non-falsy-string.
💡 Consider replacing concatenated string-variables with prepared statements or @phpstandba-inference-placeholder.
11 Query error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'tasks.task_invalid' doesn't exist (42S02).
22 Query error: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'tasks.tasks_invalid' doesn't exist (42S02).
------ ---------------------------------------------------------------------------------------------------------------------
from phpstan-dba.
here is the repository and the pipeline:
https://github.com/thbley/phpstan_dba
https://github.com/thbley/phpstan_dba/actions/runs/5081767755/jobs/9130588776
from phpstan-dba.
Closing due to inactivity of project maintainer.
from phpstan-dba.
Related Issues (20)
- mysqli: error on invalid escaping HOT 5
- Query AST analysis? HOT 2
- Get AST data from `$queryReflection->getResultType` HOT 15
- AST doubts regarding null/not-null HOT 4
- AST: inconsistent behavior with functions and aliases HOT 4
- Analyzing multiple connections HOT 6
- Right vs left join HOT 2
- AST: generic operator support HOT 2
- pgsql support for AST HOT 2
- give up sql based narrowing in case sqlftw cannot parse the query
- pgsql support for uuid type
- generic type mysqli_result error with phpstan v1.10.36 and v1.10.37 HOT 2
- Support for custom API's for type inference HOT 1
- Check driver differences
- dibi support DATE_FORMAT
- Psalm support
- Using with doctrine/dbal HOT 8
- CI: Separate Testing of Doctrine 3.x and 4.x
- Issue with update to 0.2.80: Query expects 0 placeholder, but 1 value is given HOT 3
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 phpstan-dba.