expr.txt 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402
  1. # Test the "debug_label_color" feature
  2. #
  3. linerad = 10px
  4. linewid *= 0.5
  5. $h = 0.21
  6. margin = 1cm
  7. debug_label_color = Red
  8. color = LightGray
  9. circle radius 10%
  10. OUT: 6.3in right of previous.e # FIX ME
  11. IN_X: linerad east of first circle.e
  12. # The literal-value line
  13. arrow
  14. LTV: box "literal-value" fit
  15. arrow right even with linerad+2*arrowht east of OUT
  16. circle same
  17. # The bind-parameter line
  18. right
  19. BNDP: oval "bind-parameter" fit with .w at 1.25*$h below LTV.w
  20. arrow right even with OUT; line right linerad then up linerad
  21. arrow from first circle.e right linerad then down even with BNDP \
  22. then to BNDP.w
  23. # The table column reference line
  24. right
  25. SN: oval "schema-name" fit with .w at 2.0*$h below BNDP.w
  26. arrow 2*arrowht
  27. oval "." bold fit
  28. arrow
  29. TN: oval "table-name" fit
  30. arrow right 2*arrowht
  31. oval "." bold fit
  32. arrow
  33. CN: oval "column-name" fit
  34. arrow right even with OUT; line right linerad then up linerad
  35. arrow from (IN_X,SN.n) down even with SN then to SN.w
  36. TN_Y: 0.375*$h above TN.n
  37. arrow from (IN_X,linerad above TN_Y) down linerad \
  38. then right even with SN
  39. arrow right right even with TN
  40. line right even with linerad+arrowht west of CN.w \
  41. then down even with CN then right linerad
  42. line from (linerad+2*arrowht left of TN.w,TN_Y) right linerad \
  43. then down even with TN then right linerad
  44. # Unary operators
  45. right
  46. UOP: oval "unary-operator" fit with .w at 1.25*$h below SN.w
  47. arrow right even with OUT; line right linerad then up linerad
  48. arrow from (IN_X,UOP.n) down even with UOP then to UOP.w
  49. # Binary operators
  50. right
  51. BINY: box "expr" fit with .w at 1.25*$h below UOP.w
  52. arrow 2*arrowht
  53. oval "binary-operator" fit
  54. arrow 2*arrowht
  55. box "expr" fit
  56. arrow right even with OUT; line right linerad then up linerad
  57. arrow from (IN_X,BINY.n) down even with BINY then to BINY.w
  58. # Function calls
  59. right
  60. FUNC: oval "function-name" fit with .w at 2.0*$h below BINY.w
  61. arrow 1.5*arrowht
  62. FLP: oval "(" bold fit
  63. arrow
  64. FDCT: oval "DISTINCT" fit
  65. arrow
  66. FEXP: box "expr" fit
  67. arrow 150%
  68. FRP: oval ")" bold fit
  69. arrow right linerad then down $h then right 2*arrowht
  70. FFC: box "filter-clause" fit
  71. FA1: arrow right linerad then up even with FUNC then right 2*arrowht
  72. arrow right linerad then down $h then right 2*arrowht
  73. FOC: box "over-clause" fit
  74. arrow right even with OUT; line right linerad then up linerad
  75. arrow from (IN_X,FUNC.n) down even with FUNC then to FUNC.w
  76. # filter clause bypass
  77. arrow from FRP.e right even with FFC
  78. line to arrowht left of FA1.end
  79. # over clause bypass
  80. arrow from FA1.end right even with OUT
  81. line right linerad then up linerad
  82. # expr loop
  83. FCMA: oval "," bold fit at 1.25*$h above FEXP
  84. arrow from FEXP.e right linerad then up even with FCMA \
  85. then to FCMA.e
  86. line from FCMA.w left even with 2*arrowht west of FEXP.w \
  87. then down even with FEXP then right linerad
  88. # "*" argument list
  89. FSTR: oval "*" bold fit with .w at 1.25*$h below FDCT.w
  90. arrow from FLP.e right linerad then down even with FSTR \
  91. then to FSTR.w
  92. FA2: arrow from FSTR.e right even with linerad+2*arrowht west of FRP.w
  93. line right linerad then up even with FRP then right linerad
  94. # empty argument list
  95. arrow from (linerad east of FLP.e,FSTR.n) \
  96. down even with $h below FSTR then right even with FDCT.w
  97. arrow right even with FA2.end
  98. line right linerad then up even with FSTR.n
  99. # parenthesized and vector expressions
  100. right
  101. PRN: oval "(" bold fit with .w at 3.0*$h below FUNC.w
  102. arrow
  103. PEXP: box "expr" fit
  104. arrow
  105. oval ")" bold fit
  106. arrow right even with OUT; line right linerad then up linerad
  107. arrow from (IN_X,PRN.n) down even with PRN then to PRN.w
  108. # expr loop
  109. PCMA: oval "," bold fit at 1.25*$h above PEXP
  110. arrow from PEXP.e right linerad then up even with PCMA \
  111. then to PCMA.e
  112. line from PCMA.w left even with 2*arrowht left of PEXP.w \
  113. then down even with PEXP then right linerad
  114. # CAST expression
  115. right
  116. CAST: oval "CAST" fit with .w at 1.25*$h below PRN.w
  117. arrow 2*arrowht
  118. oval "(" bold fit
  119. arrow 2*arrowht
  120. box "expr" fit
  121. arrow 2*arrowht
  122. oval "AS" fit
  123. arrow 2*arrowht
  124. box "type-name" fit
  125. arrow 2*arrowht
  126. oval ")" bold fit
  127. arrow right even with OUT; line right linerad then up linerad
  128. arrow from (IN_X,CAST.n) down even with CAST then to CAST.w
  129. # COLLATE expression
  130. right
  131. COLL: box "expr" fit with .w at 1.25*$h below CAST.w
  132. arrow 2*arrowht
  133. oval "COLLATE" fit
  134. arrow 2*arrowht
  135. oval "collation-name" fit
  136. arrow right even with OUT; line right linerad then up linerad
  137. arrow from (IN_X,COLL.n) down even with COLL then to COLL.w
  138. # LIKE expressions
  139. right
  140. LIKE: box "expr" fit with .w at 1.25*$h below COLL.w
  141. arrow
  142. LNOT: oval "NOT" fit
  143. arrow 150%
  144. LOP1: oval "LIKE" fit
  145. LOP2: oval "GLOB" fit with .w at 1.25*$h below LOP1.w
  146. LOP3: oval "REGEXP" fit with .w at 1.25*$h below LOP2.w
  147. LOP4: oval "MATCH" fit with .w at 1.25*$h below LOP3.w
  148. LE2: box "expr" fit with .w at (4*arrowht+linerad east of LOP3.e,LIKE)
  149. arrow from LE2.e right linerad then down $h then right 2*arrowht
  150. LESC: oval "ESCAPE" fit
  151. arrow 2*arrowht
  152. box "expr" fit
  153. LA1: arrow right linerad then up even with LIKE then right
  154. arrow right even with OUT; line right linerad then up linerad
  155. arrow from (IN_X,LIKE.n) down even with LIKE then to LIKE.w
  156. # NOT bypass
  157. line from linerad*2 west of LNOT.w \
  158. right linerad then down $h \
  159. then right even with arrowht east of LNOT.e \
  160. then up even with LNOT then right linerad
  161. # Inputs to the operators
  162. LX1: 2*arrowht west of LOP1.w
  163. arrow from linerad west of LX1 right linerad \
  164. then down even with LOP4 then to LOP4.w
  165. arrow from (LX1,LOP2.n) down even with LOP2 then to LOP2.w
  166. arrow from (LX1,LOP3.n) down even with LOP3 then to LOP3.w
  167. # Outputs from the operators
  168. LX2: 2*arrowht east of LOP3.e
  169. arrow from LOP4.e right even with LX2
  170. arrow right linerad then up even with LE2 then to LE2.w
  171. arrow from LOP3.e right even with LX2
  172. line right linerad then up linerad
  173. arrow from LOP2.e right even with LX2
  174. line right linerad then up linerad
  175. line from LOP1.e to arrowht west of LE2.w
  176. # ESCAPE bypass
  177. arrow from LE2.e right even with LESC
  178. line to arrowht left of LA1.end
  179. # ISNULL and NOTNULL operators
  180. right
  181. NNUL: box "expr" fit with .w at 5.0*$h below LIKE.w
  182. arrow
  183. NN1: oval "ISNULL" fit
  184. arrow right even with OUT; line right linerad then up linerad
  185. arrow from (IN_X,NNUL.n) down even with NNUL then to NNUL.w
  186. NN2: oval "NOTNULL" fit with .w at 1.25*$h below NN1.w
  187. right
  188. NN3: oval "NOT" fit with .w at 1.25*$h below NN2.w
  189. arrow 2*arrowht
  190. NN3B: oval "NULL" fit
  191. NNA1: arrow 2*arrowht
  192. arrow right linerad then up even with NN1 then right
  193. arrow from NN2.e right even with NNA1.end
  194. line right linerad then up linerad
  195. arrow from NNUL.e right linerad then down even with NN3 then to NN3.w
  196. arrow from NNUL.e right linerad then down even with NN2 then to NN2.w
  197. # The IS operator
  198. right
  199. IS: box "expr" fit with .w at 3.75*$h below NNUL.w
  200. arrow 2*arrowht
  201. oval "IS" fit
  202. arrow
  203. ISN: oval "NOT" fit
  204. arrow
  205. box "expr" fit
  206. arrow right even with OUT; line right linerad then up linerad
  207. arrow from (IN_X,IS.n) down even with IS then to IS.w
  208. # NOT bypass
  209. line from 3*arrowht west of ISN.w right linerad \
  210. then down 0.8*$h then right even with arrowht east of ISN.e \
  211. then up even with ISN then right linerad
  212. # The BETWEEN operator
  213. right
  214. BTW: box "expr" fit with .w at 1.5*$h below IS.w
  215. arrow
  216. BTWN: oval "NOT" fit
  217. arrow
  218. oval "BETWEEN" fit
  219. arrow 2*arrowht
  220. box "expr" fit
  221. arrow 2*arrowht
  222. oval "AND" fit
  223. arrow 2*arrowht
  224. box "expr" fit
  225. arrow right even with OUT; line right linerad then up linerad
  226. arrow from (IN_X,BTW.n) down even with BTW then to BTW.w
  227. # NOT bypass
  228. line from 3*arrowht west of BTWN.w right linerad \
  229. then down 0.8*$h then right even with arrowht east of BTWN.e \
  230. then up even with BTWN then right linerad
  231. # The IN operator
  232. right
  233. IN: box "expr" fit with .w at 1.75*$h below BTW.w
  234. arrow
  235. INNT: oval "NOT" fit
  236. arrow
  237. ININ: oval "IN" fit
  238. arrow
  239. INLP: oval "(" bold fit
  240. arrow
  241. INSS: box "select-stmt" fit
  242. arrow
  243. oval ")" bold fit
  244. arrow right even with OUT; line right linerad then up linerad
  245. arrow from (IN_X,IN.n) down even with IN then to IN.w
  246. # NOT bypass
  247. line from 3*arrowht west of INNT.w right linerad \
  248. then down 0.8*$h then right even with arrowht east of INNT.e \
  249. then up even with INNT then right linerad
  250. # select-stmt bypass
  251. line from 3*arrowht west of INSS.w right linerad \
  252. then up 0.8*$h then right even with arrowht east of INSS.e \
  253. then up even with INSS then right linerad
  254. # expr list instead of select-stmt
  255. INE1: box "expr" fit at 1.25*$h below INSS
  256. arrow from 3*arrowht west of INSS.w right linerad \
  257. then down even with INE1 then to INE1.w
  258. line from INE1.e right even with arrowht east of INSS.e \
  259. then up even with INSS then right linerad
  260. # expr loop
  261. INC1: oval "," bold fit at 1.25*$h below INE1
  262. arrow from INE1.e right linerad then down even with INC1 \
  263. then to INC1.e
  264. line from INC1.w left even with 2*arrowht west of INE1.w \
  265. then up even with INE1 then right linerad
  266. # reference-to-table choice as RHS
  267. INSN: oval "schema-name" fit with .w at 4.25*$h below INLP.w
  268. arrow from INSN.e right 1.5*arrowht
  269. INDT: oval "." bold fit
  270. arrow 150%
  271. INTF: oval "table-function" fit
  272. arrow 1.5*arrowht
  273. INL2: oval "(" bold fit
  274. arrow 125%
  275. INE2: box "expr" fit
  276. arrow 125%
  277. INR2: oval ")" bold fit
  278. arrow right even with OUT; line right linerad then up linerad
  279. # table reference branch
  280. right
  281. INTB: oval "table-name" fit with .w at 2*$h above INTF.w
  282. arrow right even with OUT; line right linerad then up linerad
  283. arrow from linerad+2*arrowht west of INTF.w right linerad \
  284. then up even with INTB then to INTB.w
  285. # expr-list no table-valued-functions
  286. INC2: oval "," bold fit at 1.1*$h above INE2
  287. arrow from INE2.e right linerad then up even with INC2 \
  288. then to INC2.e
  289. line from INC2.w right even with 2*arrowht west of INE2.w \
  290. then down even with INE2 then right linerad
  291. # expr-list bypass for table-valued functions
  292. line from INL2.e right linerad then down .7*$h \
  293. then right even with 2*arrowht left of INR2.w \
  294. then up even with INR2 then right linerad
  295. # links from IN operator to table references
  296. arrow from ININ.e right linerad then down even with INSN \
  297. then to INSN.w
  298. # schema-name bypass
  299. INY3: 0.45*$h above INSN.n
  300. arrow from (linerad east of ININ.e,linerad above INY3) \
  301. down linerad then right even with arrowht right of INSN.e
  302. line right even with arrowht east of INDT.e \
  303. then down even with INDT then right linerad
  304. # NOT? EXISTS? (SELECT) clause
  305. right
  306. NE: oval "NOT" fit with .w at (IN.w,1.5*$h below INSN)
  307. arrow
  308. NEE: oval "EXISTS" fit
  309. arrow
  310. NELP: oval "(" bold fit
  311. arrow 2*arrowht
  312. box "select-stmt" fit
  313. arrow 2*arrowht
  314. oval ")" bold fit
  315. arrow right even with OUT; line right linerad then up linerad
  316. arrow from (IN_X,NE.n) down even with NE then to NE.w
  317. NE_Y: 0.375*$h above NE.n
  318. arrow from (IN_X,linerad above NE_Y) down linerad \
  319. then right even with NE
  320. line right even with linerad+arrowht west of NELP.w \
  321. then down even with NELP then right linerad
  322. line from (linerad+2*arrowht left of NEE.w,NE_Y) right linerad \
  323. then down even with NEE then right linerad
  324. # CASE expressions
  325. right
  326. CS: oval "CASE" fit with .w at 1.25*$h below NE.w
  327. arrow
  328. CSE1: box "expr" fit
  329. arrow 150%
  330. CSW: oval "WHEN" fit
  331. arrow 2*arrowht
  332. CSE2: box "expr" fit
  333. arrow 2*arrowht
  334. oval "THEN" fit
  335. arrow 2*arrowht
  336. CSE3: box "expr" fit
  337. arrow 200%
  338. CSEL: oval "ELSE" fit
  339. arrow 2*arrowht
  340. CSE4: box "expr" fit
  341. arrow
  342. oval "END" fit
  343. arrow right even with OUT; line right linerad then up linerad
  344. arrow from (IN_X,CS.n) down even with CS then to CS.w
  345. # first expr bypass
  346. CSY: 0.9*$h below CS
  347. line from CS.e right linerad then down even with CSY \
  348. then right even with arrowht east of CSE1.e then up even with CSE1 \
  349. then right linerad
  350. # when clause loop
  351. arrow from CSE3.e right linerad then down even with CSY \
  352. then left even with CSE2
  353. line left even with 2*arrowht west of CSW.w \
  354. then up even with CSW then right linerad
  355. # ELSE clause bypass
  356. line from linerad+2*arrowht west of CSEL.w right linerad \
  357. then down even with CSY then right even with arrowht east of CSE4.e \
  358. then up even with CSE4 then right linerad
  359. # The RAISE function
  360. right
  361. RSE: box "raise-function" fit with .w at 1.9*$h below CS.w
  362. arrow right even with OUT;
  363. line right linerad then up even with first circle then right linerad
  364. arrow from (IN_X,BNDP.n) down even with RSE then to RSE.w