YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense alongwiththisprogram;ifnot,writetotheFreeSoftware
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
class With_element : public Sql_alloc
{ private:
With_clause *owner; // with clause this object belongs to
With_element *next; // next element in the with clause
uint number; // number of the element in the with clause (starting from 0)
table_map elem_map; // The map where with only one 1 set in this->number /* Themapbase_dep_maphas1inthei-thpositionifthequerythat specifiesthiswithelementcontainsareferencetothewithelementnumberi inthequeryFROMlist. (Inthiscasethiswithelementdependsdirectlyonthei-thwithelement.)
*/
table_map base_dep_map; /* Themapderived_dep_maphas1ini-thpositionifthiswithelementdepends directlyorindirectlyfromthei-thwithelement.
*/
table_map derived_dep_map; /* Themapsq_dep_maphas1ini-thpositionifthereisareferencetothis withelementsomewhereinsubqueriesofthespecificationsofthetables definedinthewithclausecontainingthiselement;
*/
table_map sq_dep_map;
table_map work_dep_map; // dependency map used for work /* Dependency map of with elements mutually recursive with this with element */
table_map mutually_recursive; /* Dependencymapbuiltonlyforthetoplevelreferencesi.e.forthosethat areencounteredinfromlistsoftheselectsofthespecificationunit
*/
table_map top_level_dep_map; /* Pointstoarecursivereferenceinsubqueries. Usedonlyforspecificationswithoutrecursivereferencesonthetoplevel.
*/
TABLE_LIST *sq_rec_ref; /* Thenextwithelementfromthecircularchainofthewithelements mutuallyrecursivewiththiswithelement. (IfThiselementissimplyrecursivethannext_mutually_recursivecontains thepointertoitself.Ifit'snotrecursivethannext_mutually_recursive issettoNULL.)
*/
With_element *next_mutually_recursive; /* TotalnumberofreferencestothiselementintheFROMlistsof thequeriesthatareinthescopeoftheelement(including subqueriesandspecificationsofotherwithelements).
*/
uint references;
/* Unparsedspecificationofthequerythatspecifiesthiselement. It'susedtobuildclonesofthespecificationiftheyareneeded.
*/
LEX_CSTRING unparsed_spec; /* Offset of the specification in the input string */
my_ptrdiff_t unparsed_spec_offset;
/* True if the with element is used a prepared statement */ bool stmt_prepare_mode;
/* Return the map where 1 is set only in the position for this element */
table_map get_elem_map() { return (table_map) 1 << number; }
/* Optionallistofcolumnnamestonamethecolumnsofthetableintroduced bythiswithelement.Itisusedinthecasewhenthenamesarenot inheritedfromthequerythatspecifiedthetable.Otherwisethelistis alwaysempty.
*/
List <Lex_ident_sys> column_list;
List <Lex_ident_sys> *cycle_list; /* The query that specifies the table introduced by this with element */
st_select_lex_unit *spec; /* Settotrueisrecursionisused(directlyorindirectly) forthedefinitionofthiselement
*/ bool is_recursive; /* ForasimplerecursiveCTE:thenumberofreferencestotheCTEfrom outsideoftheCTEspecification. ForaCTEmutuallyrecursivewithotherCTEs:thetotalnumberof referencestoalltheseCTEsoutsideoftheirspecification. EachofthesemutuallyrecursiveCTEshasthesamevalueinthisfield.
*/
uint rec_outer_references; /* Anynon-recursiveselectinthespecificationofarecursive withelementisacalledanchor.Inthecasemutuallyrecursive elementsthespecificationofsomethemmaybewithoutanyanchor. Yetatleastoneofthemmustcontainananchor. Allanchorsofanyrecursivespecificationaremovedaheadbefore thepreparestage.
*/ /* Set to true if this is a recursive element with an anchor */ bool with_anchor; /* Settothefirstrecursiveselectoftheunitspecifyingtheelement afterallanchorhavebeenmovedtotheheadoftheunit.
*/
st_select_lex *first_recursive;
/* List of Item_subselects containing recursive references to this CTE */
SQL_I_List<Item_subselect> sq_with_rec_ref; /* List of derived tables containing recursive references to this CTE */
SQL_I_List<TABLE_LIST> derived_with_rec_ref;
class With_clause : public Sql_alloc
{ private:
st_select_lex_unit *owner; // the unit this with clause attached to
/* The list of all with elements from this with clause */
SQL_I_List<With_element> with_list; /* Thewithclauseimmediatelycontainingthiswithclauseifthereisany, otherwiseNULL.Nowusedonlyatparsing.
*/
With_clause *embedding_with_clause; /* Thenextwiththeclauseofthechainofwithclausesencountered inthecurrentstatement
*/
With_clause *next_with_clause; /* Set to true if dependencies between with elements have been checked */ bool dependencies_are_checked; /* Thebitmapofallrecursivewithelementswhosespecifications arenotcompliedwithrestrictionsimposedbytheSQLstandards onrecursivespecifications.
*/
table_map unrestricted; /* Thebitmapofallrecursivewithelementswhoseanchors hasbeenalreadyprepared.
*/
table_map with_prepared_anchor;
table_map cleaned; /* Thebitmapofallrecursivewithelementsthat hasbeenalreadymaterialized
*/
table_map stabilized;
public: /* If true the specifier RECURSIVE is present in the with clause */ bool with_recursive;
/* Add this with clause to the list of with clauses used in the statement */ void add_to_list(With_clause **ptr, With_clause ** &last_next)
{ if (embedding_with_clause)
{ /* Anembeddedwithclauseisalwaysplacedbeforetheembeddingone inthelistofwithclausesusedinthequery.
*/ while (*ptr != embedding_with_clause)
ptr= &(*ptr)->next_with_clause;
*ptr= this;
next_with_clause= embedding_with_clause;
} else
{
*last_next= this;
last_next= &this->next_with_clause;
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.