Comments (6)
@staabm hey, I’m looking forward to looking into this, I didn’t have much time this past week. But I should be able to look into this in the upcoming week..
I already had some base for pgsql actions for github prepared, so I’ll start with that for sure.
from phpstan-dba.
correct, atm only mysql is supported. its the only database type I work with. contributions welcome.
in case e.g. a PDOQueryReflector would be implemented phpstan-dba could work across more databases.
alternatively some pgsql specific reflector would also be an option.
from phpstan-dba.
@staabm Hey, I can try to implement this feature into phpstan-dba if you're not against, I'm using pgsql in most of our projects so I'm kind of missing this feature.
from phpstan-dba.
I would love having pgsql support. we also need to add it to the CI pipeline then
from phpstan-dba.
@stof @p4veI do you have plans to work on this?
as we recently landed a PDO based reflector in #261 it should now be possible to work out pgsql support.
possible good first steps would be
- add a github action running pgsql, importing existing db schema and running the testsuite
- figure out whether pgsql support can be easily built into the PDO based reflector, or whether we better would have 2 separate pdo reflectors (one for mysql, one for pgsql)
- tackle possible test-failures
this could be done in several pull requests and should not be done in one huge PR.
I am willing to support whoever wants to work on it. As I never used pgsql and don't have any production app using it at hand, I will not work on this topic myself.
from phpstan-dba.
implemented with #328 et. all
I will push out a release now, but of course also need to update the documentation in #351
for anyone interessted in beta-testing it - the configuration file for using it looks like:
<?php // phpstan-dba-bootstrap.php
use staabm\PHPStanDba\QueryReflection\RuntimeConfiguration;
use staabm\PHPStanDba\QueryReflection\PdoPgSqlQueryReflector;
use staabm\PHPStanDba\QueryReflection\QueryReflection;
use staabm\PHPStanDba\QueryReflection\RecordingQueryReflector;
use staabm\PHPStanDba\QueryReflection\ReflectionCache;
require_once __DIR__ . '/vendor/autoload.php';
$cacheFile = __DIR__.'/.phpstan-dba.cache';
$config = new RuntimeConfiguration();
// $config->debugMode(true);
// $config->stringifyTypes(true);
// TODO: Put your database credentials here
$pdo = new PDO(..)
QueryReflection::setupReflector(
new RecordingQueryReflector(
ReflectionCache::create(
$cacheFile
),
new PdoPgSqlQueryReflector($pdo)
),
$config
);
while the phpstandba engine requires PDO-PGSQL, the codebase beeing analyzed can use Doctrine or PDO.
for custom pgsql query apis you might also use SyntaxErrorInQueryMethodRule
and/or SyntaxErrorInQueryFunctionRule
like described in the project readme
from phpstan-dba.
Related Issues (20)
- Unexpected query error
- Unexpected query error
- Inconsistency for string in query check between Record and Replay HOT 4
- `PDO::FETCH_KEY_PAIR` errors when selecting not exactly 2 columns
- SqlAst: throw when used with pgsql
- Argument expects a literal string, got literal-string HOT 5
- Connection::insert data inference does not use indicated Types HOT 4
- 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
- Support for (PDO->prepare())->execute() HOT 6
- generic type mysqli_result error with phpstan v1.10.36 and v1.10.37 HOT 2
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.