24 protected $dbViewName;
26 protected $dbViewQuery;
28 protected $materialized =
false;
36 $this->dbViewQuery = $dbViewQuery;
37 $this->dbViewName = $dbViewName;
45 return $this->dbViewName;
53 if ($this->materialized) {
57 $dbManager = $container->get(
'db.manager');
58 $dbManager->queryOnce(
"CREATE TEMPORARY TABLE $this->dbViewName AS $this->dbViewQuery",
"CREATE DbView ".$this->dbViewName);
59 $this->materialized =
true;
67 if (!$this->materialized) {
71 $dbManager = $container->get(
'db.manager');
72 $dbManager->queryOnce(
"DROP TABLE $this->dbViewName",
"DROP DbView ".$this->dbViewName);
73 $this->materialized =
false;
82 return "WITH $this->dbViewName AS (".$this->dbViewQuery.
")";
85 public function getDbViewQuery()
87 return $this->dbViewQuery;
unmaterialize()
drops temp table
asCTE()
Common Table Expressions.
__construct($dbViewQuery, $dbViewName)
materialize()
create temp table