interfaceSqlTransformer
interface SqlTransformer
Rewrites a statement so that it reads the shadow instead of the database.
A transformer holds nothing: everything it needs about a table is handed to it, so the same transformer can rewrite one statement against one shadow and the next against another.
A shadow row's values are whatever the driver handed back, which is wider than what a row holds once it has been read: a driver may answer a large column as an open stream, or an object that says how it spells itself.
Type Aliases§
ShadowView = array{viewSql: string}ShadowRows = array{rows: array<int, array<string, mixed>>, columns: array<int, string>, columnTypes: array<string, ColumnDeclaration>, primaryKeys?: array<int, string>, candidateKeys?: array<string, array<int, string>>, partialUniqueIndexes?: array<string, PartialUniqueIndex>, columnDefaults?: array<string, string>, identityStrategies?: array<string, IdentityGenerationStrategy>, generatedExpressions?: array<string, string>, partitioning?: TablePartitioning|null, sourceSql?: string, storageTable?: string}ShadowTable = ShadowView|ShadowRowsShadowTables = array<string, ShadowTable>Row = import from TableDefinitionRenderableValue = import from ValueRendererMethods§
public function transform(string $sql, ShadowTables $tables): stringRewrites a statement so that it reads these tables' shadow rows.
A table given as a view is rewritten to the statement that defines it; a table given as rows is rewritten to those rows written out.
Parameters
$sql | string | The statement, as it was written |
$tables | ShadowTables | Table name => what the shadow holds for it |
Returns
string The statement, rewritten to read the shadowTest cases 3§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 1
SqlTransformerTestcalls
Other tests reaching this symbol 2
TransformerContractTestcallsFakeSqlTransformercalls