Bar Weiss
feef77c099
Fix the order of LIMIT and OFFSET clauses when using the Presto flavor (issue #195 )
...
Queries that have both a limit and an offset build a query with a limit clause *before* the offset clause.
```go
fmt.Println(Select("*").From("table").Offset(5).Limit(10))
// SELECT * FROM table LIMIT 10 OFFSET 5
```
This seems to generate syntax errors in Trino. [Presto documentation specifies OFFSET before LIMIT](https://prestodb.io/docs/current/sql/select.html#limit-clause ) in the SELECT statement documentation too, but is not very explicit about the reverse not being supported.
If the OFFSET and LIMIT clauses are swapped, the query succeeds.
Expected:
```go
fmt.Println(Select("*").From("table").Offset(5).Limit(10))
// SELECT * FROM table OFFSET 5 LIMIT 10
```
2025-03-20 10:32:26 +02:00
Huan Du and GitHub
903c2500cd
Merge pull request #191 from huandu/feature/returning-id
...
fix #83 : Support RETURNING in InsertBuilder
2025-02-11 15:48:12 +08:00
Huan Du
ffacf24738
fix #83 : Support RETURNING in InsertBuilder
2025-02-11 15:46:25 +08:00
Huan Du and GitHub
3c20969dde
Merge pull request #189 from huandu/feature/limit-offset-using-args
...
Fix #186 : use args in LIMIT and/or OFFSET expression
2025-02-11 15:11:22 +08:00
Huan Du and GitHub
23890851a4
Merge pull request #190 from huandu/feature/prevent-syntax-error-with-zero-values
...
Ignore empty values and expressions to prevent syntax error
2025-02-11 15:10:42 +08:00
Huan Du
61ff9070f0
generate FALSE if values is empty in IN/ALL/SOME/ANY
2025-02-11 15:09:46 +08:00
Huan Du
ee087fd12b
ignore empty values and expressions to prevent syntax error
2025-01-26 15:35:02 +08:00
Huan Du
827392d26d
fix #186 : use args in LIMIT and/or OFFSET expression
2025-01-26 15:06:21 +08:00
Huan Du
bbd370c39c
fix #184 : fix SQL syntax error in WITH ... UPDATE ... FROM
2024-12-05 13:00:55 +08:00
Huan Du and GitHub
0915e09d81
Merge pull request #183 from huandu/feature/select-lateral-derived-table
...
Support LATERAL keyword
2024-12-03 16:02:23 +08:00
Huan Du
e0939dbf05
fix #181 : Support LATERAL keyword
2024-12-01 03:25:59 +08:00
Huan Du and GitHub
e42f1a65bb
Merge pull request #180 from huandu/bug/cond-misuse
...
Avoid stack overflow when Cond is misused
2024-11-06 12:30:42 +08:00
Huan Du and GitHub
495a64ffb9
Merge pull request #179 from huandu/feature/cte-table-for-update-delete
...
Automatically ref names of CTETables in DELETE and UPDATE statements
2024-11-06 12:30:28 +08:00
Huan Du
d8cdbb7ceb
fix #178 : avoid stackoverflow when Cond is misused
2024-11-05 14:24:10 +08:00
Huan Du
e3eef72bb4
refs #176 : Automatically ref names of CTETables in DELETE and UPDATE statement
2024-11-02 23:03:02 +08:00
Huan Du and GitHub
0fa8701293
Merge pull request #177 from rodionovv/flavor_getter
...
Flavor getters
2024-11-01 14:06:10 +08:00
Vasily Rodionov
98718aad2d
new: Added Flavor method to Builder interface
2024-10-31 15:23:25 +05:00
Vasily Rodionov
b28a583417
new: flavor getters
2024-10-30 20:39:31 +05:00
Huan Du and GitHub
75cca5d6cb
Merge pull request #175 from rodionovv/string-validation
...
Ignore empty content to prevent the output of incorrect SQL
2024-10-28 13:52:43 +08:00
Vasily Rodionov
d21fa10b30
test: Added test cases for empty strings in where clause
2024-10-27 22:20:40 +05:00
Vasily Rodionov
9bf5964c7c
fix #172 : added checks for empty strings in conds.
2024-10-27 18:39:54 +05:00
Huan Du
4e13f47b93
fix #171 : no need to escape field any more
2024-10-10 13:20:45 +08:00
Huan Du
619ac5820e
reduce count of memory allocations in Cond.And/Or/Not
2024-09-24 14:40:15 +08:00
Huan Du
e979adcd4a
update doc for IsDistinctFrom and IsNotDistinctFrom
2024-09-23 22:06:35 +08:00
Huan Du
8329700531
fix #169 : support IS [NOT] DISTINCT FROM operator
2024-09-23 22:03:08 +08:00
Huan Du
19835c7b14
update docs in README and godoc
2024-09-10 17:22:08 +08:00
Huan Du and GitHub
57e597eb7d
Merge pull request #168 from vallahaye/167-add-logical-not-and-not-ilike-comparison-operators
...
Add logical NOT and NOT ILIKE operators
2024-09-10 15:49:16 +08:00
Valentin Lahaye
9d726b4cf4
feat(cond): add logical NOT and NOT ILIKE operators
...
Add Cond.Not and Cond.NotILike to build NOT and NOT ILIKE expressions.
Closes #167
2024-09-10 09:39:27 +02:00
Huan Du
03e80e6f8c
refs #164 : new API SelectMore to add more cols to SELECT after calling Select()
2024-09-09 02:05:14 +08:00
Huan Du
cd1b266513
fix #163 : CTE API refactory; see issue for details
2024-09-09 01:52:01 +08:00
Huan Du and GitHub
a6a0e828d9
Merge pull request #162 from arikkfir/add-recursive-cte-support
...
Fix #161 : Add support for recursive CTEs
2024-08-26 11:49:00 +08:00
Arik Kfir
cacc5a5636
feature #161 : add support for recursive CTEs
...
This change adds support for recursive CTEs by introducing the
`WithRecursive` method, which builds a `WITH RECURSIVE` clause.
2024-08-21 17:14:38 +03:00
Huan Du
e8528206c0
fix : #160 SelectBuilder.With appends table names to FROM
2024-08-04 20:29:26 +08:00
Huan Du and GitHub
b6974302a0
Merge pull request #159 from abanoub-fathy/add-ILIKE-helper-method
...
Add ilike helper method
2024-07-26 12:22:41 +08:00
Huan Du and GitHub
7a24fa087b
Merge pull request #157 from huandu/feature/cte
...
Support CTE (Common Table Expression)
2024-07-26 12:20:39 +08:00
Huan Du
85be89ace1
support multiple tables in a WITH clause
2024-07-24 16:54:41 +08:00
Abanoub Fathy
7c5bcc0430
update readme file to add Cond.ILIKE
2024-07-10 02:59:56 +03:00
Abanoub Fathy
4f113ee4b9
add test for ILIKE cond
2024-07-09 21:07:45 +03:00
Abanoub Fathy
4613287c0e
add ILIKE method to Cond
2024-07-09 21:07:23 +03:00
Huan Du
75c6f8c1e4
implement CTEBuilder
2024-07-06 23:58:26 +08:00
Huan Du
1c64d87a7c
fix #150 : remove useless deps in go.mod and go.sum
2024-05-26 14:23:24 +08:00
Huan Du
fbe2e35f71
fix #149 : avoid to generate invalid WHERE clause if andExpr is empty
2024-05-20 11:34:51 +08:00
Huan Du
76f1e16370
add sample to show how to build JOIN with Struct
2024-04-24 02:52:38 +08:00
Huan Du and GitHub
20c2b710b3
Merge pull request #146 from zhangyongding/master
...
Optimize paging syntax for Informix SELECT.
2024-04-15 11:53:04 +08:00
Huan Du and GitHub
bd079c473c
Merge pull request #147 from huandu/feature-where-clause
...
`WhereClause`: A new dedicated builder for WHERE clause
2024-04-15 11:52:17 +08:00
Huan Du
64a2aa1d63
update doc to be clear about the goal of this package
2024-04-15 11:44:51 +08:00
Huan Du
e4e0abc70f
add more cases for WhereClause
2024-04-15 01:41:27 +08:00
Huan Du
ca1312d057
add more cases to increase test coverage
2024-04-14 00:02:57 +08:00
Huan Du
96e64e9b7d
feature: new builder WhereClause dedicated for WHERE
2024-04-13 23:32:24 +08:00
zhangyongding and GitHub
2a9154c2b5
Merge branch 'huandu:master' into master
2024-04-10 17:37:44 +08:00