|
| 1 | +# Software Architectural Design -- Exasol SQL Statement Builder |
| 2 | + |
| 3 | +## Building Block View |
| 4 | + |
| 5 | +### Select Statement |
| 6 | +`dsn~dql-statement~1` |
| 7 | + |
| 8 | +The Data Query Language (DQL) building block is responsible for managing `SELECT` statements. |
| 9 | + |
| 10 | +## Solution Strategy |
| 11 | + |
| 12 | +### Fluent Programming |
| 13 | + |
| 14 | +#### Statement Construction With Fluent Programming |
| 15 | +`dsn~statement-construction-with-fluent-programming~1` |
| 16 | + |
| 17 | +All statement builders use the "fluent programming" model, where the return type of each builder step determines the possible next structural elements that can be added. |
| 18 | + |
| 19 | +Comment: |
| 20 | + |
| 21 | +This is a design principle that cuts across the whole project. Therefore locating it in a single test or implementation part makes no sense. |
| 22 | + |
| 23 | +Covers: |
| 24 | + |
| 25 | +* `req~statement-structure-limited-at-compile-time~1` |
| 26 | + |
| 27 | +## Runtime View |
| 28 | + |
| 29 | +### Building Select Statements |
| 30 | + |
| 31 | +#### Accessing the Clauses That Make Up a SELECT Statement |
| 32 | +`dsn~select-statement.out-of-order-clauses~1` |
| 33 | + |
| 34 | +`SELECT` commands allow attaching the following clauses in any order: |
| 35 | + |
| 36 | +* `FROM` clause |
| 37 | +* `WHERE` clause |
| 38 | +* `LIMIT` clause |
| 39 | + |
| 40 | +Covers: |
| 41 | + |
| 42 | +* `req~statement-structure.step-wise~1` |
| 43 | + |
| 44 | +Needs: impl, utest |
| 45 | + |
| 46 | +Tags: Select Statement Builder |
| 47 | + |
| 48 | +### Building Boolean Expressions |
| 49 | + |
| 50 | +#### Forwarded Requirements |
| 51 | + |
| 52 | +* `dsn --> impl, utest: req~boolean-operators~1` |
| 53 | +* `dsn --> impl, utest: req~comparison-operations~1` |
| 54 | + |
| 55 | +#### Constructing Boolean Comparison Operations From Operator Strings |
| 56 | +`dsn~boolean-operation.comparison.constructing-from-strings~1` |
| 57 | + |
| 58 | +The Boolean Expression builder allows creating expression objects from a string representing the comparison operator (options listed below) and a list of operands. |
| 59 | + |
| 60 | +* `>` |
| 61 | +* `<` |
| 62 | +* `=` |
| 63 | +* `>=` |
| 64 | +* `<=` |
| 65 | +* `<>` |
| 66 | + |
| 67 | +Covers: |
| 68 | + |
| 69 | +* `req~boolean-operators~1` |
| 70 | + |
| 71 | +Needs: impl, utest |
| 72 | + |
| 73 | +#### Constructing Boolean Comparison Operations From Operator Enumeration |
| 74 | +`dsn~boolean-operation.comparison.constructing-from-enum~1` |
| 75 | + |
| 76 | +The Boolean Expression builder allows creating expression objects from a enumeration of comparison operators. |
| 77 | +Covers: |
| 78 | + |
| 79 | +* `req~boolean-operators~1` |
| 80 | + |
| 81 | +Needs: impl, utest |
| 82 | + |
| 83 | +### Building INSERT Statements |
| 84 | + |
| 85 | +#### Forwarded Requirements |
| 86 | + |
| 87 | +* `dsn --> impl, utest: req~insert-statements~1` |
| 88 | +* `dsn --> impl, utest: req~values-as-insert-source~1` |
| 89 | + |
| 90 | +### Rendering Statements |
| 91 | + |
| 92 | +#### Forwarded Requirements |
| 93 | + |
| 94 | +* `dsn --> impl, utest: req~rendering.sql.configurable-case~1` |
| 95 | +* `dsn --> impl, utest: req~rendering.sql.select~1` |
| 96 | +* `dsn --> impl, utest: req~rendering.sql.insert~1` |
| 97 | + |
| 98 | +#### Renderer add Double Quotes for Schema, Table and Column Identifiers |
| 99 | +`dsn~rendering.add-double-quotes-for-schema-table-and-column-identifiers~1` |
| 100 | + |
| 101 | +The renderer sets the following identifiers in double quotes if configured: |
| 102 | + |
| 103 | +* Schema identifiers |
| 104 | +* Table identifiers |
| 105 | +* Column identifiers (except the asterisks) |
| 106 | + |
| 107 | +Comment: |
| 108 | + |
| 109 | +Examples are `"my_schema"."my_table"."my_field"`, `"MY_TABLE"."MyField"` and `"MyTable".*` |
| 110 | + |
| 111 | +Covers: |
| 112 | + |
| 113 | +* `req~rendering.sql.confiugrable-identifier-quoting~1` |
| 114 | + |
| 115 | +Needs: impl, utest |
| 116 | + |
| 117 | +### Exasol Dialect Specific |
| 118 | + |
| 119 | +#### Converting from 64 bit Integers to INTERVAL DAY TO SECOND |
| 120 | +`dsn~exasol.converting-int-to-interval-day-to-second~1` |
| 121 | + |
| 122 | +The data converter converts integers to `INTERVAL DAY TO SECOND`. |
| 123 | + |
| 124 | +Covers: |
| 125 | + |
| 126 | +* `req~integer-interval-conversion~1` |
| 127 | + |
| 128 | +Needs: impl, utest |
| 129 | + |
| 130 | +#### Parsing INTERVAL DAY TO SECOND From Strings |
| 131 | +`dsn~exasol.parsing-interval-day-to-second-from-strings~1` |
| 132 | + |
| 133 | +The data converter can parse `INTERVAL DAY TO SECOND` from strings in the following format: |
| 134 | + |
| 135 | + interval-d2s = [ days SP ] hours ":" minutes [ ":" seconds [ "." milliseconds ] ] |
| 136 | + |
| 137 | + hours = ( "2" "0" - "3" ) / ( [ "0" / "1" ] DIGIT ) |
| 138 | + |
| 139 | + minutes = ( "5" DIGIT ) / ( [ "0" - "4" ] DIGIT ) |
| 140 | + |
| 141 | + seconds = ( "5" DIGIT ) / ( [ "0" - "4" ] DIGIT ) |
| 142 | + |
| 143 | + milliseconds = 1*3DIGIT |
| 144 | + |
| 145 | +Examples are `12:30`, `12:30.081` or `100 12:30:00.081`. |
| 146 | + |
| 147 | +Covers: |
| 148 | + |
| 149 | +* `req~integer-interval-conversion~1` |
| 150 | + |
| 151 | +Needs: impl, utest |
| 152 | + |
| 153 | +#### Converting from 64 bit Integers to INTERVAL YEAR TO MONTH |
| 154 | +`dsn~exasol.converting-int-to-interval-year-to-month~1` |
| 155 | + |
| 156 | +The data converter converts integers to `INTERVAL YEAR TO MONTH`. |
| 157 | + |
| 158 | +Covers: |
| 159 | + |
| 160 | +* `req~integer-interval-conversion~1` |
| 161 | + |
| 162 | +Needs: impl, utest |
| 163 | + |
| 164 | +#### Parsing INTERVAL YEAR TO MONTH From Strings |
| 165 | +`dsn~exasol.parsing-interval-year-to-month-from-strings~1` |
| 166 | + |
| 167 | +The data converter can parse `INTERVAL YEAR TO MONTH` from strings in the following format: |
| 168 | + |
| 169 | + interval-y2m = days "-" months |
| 170 | + |
| 171 | + days = 1*9DIGIT |
| 172 | + |
| 173 | + months = ( "1" "0" - "2" ) / DIGIT |
| 174 | + |
| 175 | +Examples are `0-1` and `100-11`. |
| 176 | + |
| 177 | +Covers: |
| 178 | + |
| 179 | +* `req~integer-interval-conversion~1` |
| 180 | + |
| 181 | +Needs: impl, utest |
0 commit comments