NewQuery implements the [dbx.Builder.NewQuery] interface method by routing the SELECT queries to the concurrent builder instance.
(str string)
| 149 | // NewQuery implements the [dbx.Builder.NewQuery] interface method by |
| 150 | // routing the SELECT queries to the concurrent builder instance. |
| 151 | func (b *dualDBBuilder) NewQuery(str string) *dbx.Query { |
| 152 | // note: technically INSERT/UPDATE/DELETE could also have CTE but since |
| 153 | // it is rare for now this scase is ignored to avoid unnecessary complicating the checks |
| 154 | trimmed := trimLeftSpaces(str) |
| 155 | if hasPrefixFold(trimmed, "SELECT") || hasPrefixFold(trimmed, "WITH") { |
| 156 | return b.concurrentDB.NewQuery(str) |
| 157 | } |
| 158 | |
| 159 | return b.nonconcurrentDB.NewQuery(str) |
| 160 | } |
| 161 | |
| 162 | var asciiSpace = [256]uint8{'\t': 1, '\n': 1, '\v': 1, '\f': 1, '\r': 1, ' ': 1} |
| 163 |