Commit Graph

1765 Commits

Author SHA1 Message Date
Lunny Xiao 65846bacc3 Improve QueryString performance (#1962)
As title.

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1962
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-07-02 11:25:20 +08:00
Lunny Xiao 8f8195a86b Improve get field value of bean (#1961)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1961
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-29 14:32:29 +08:00
Lunny Xiao 053a094740 refactor splitTag function (#1960)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1960
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-28 22:41:54 +08:00
antialiasis 44f892fddc Ignore comments when deciding when to replace question marks. #1954 (#1955)
This should solve #1954 and adds some tests for it. I will note I'm not 100% clear on whether there are other edge cases that should be covered here. From what I understand the only standard SQL way to escape single quotes is to double them, which shouldn't cause any problems with this, but if some SQL flavors allow other kinds of escaping, for instance, that would probably need to be covered too for ideal results.

Co-authored-by: Hlín Önnudóttir <hlin@nanitor.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1955
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: antialiasis <antialiasis@noreply.gitea.io>
Co-committed-by: antialiasis <antialiasis@noreply.gitea.io>
2021-06-26 19:19:13 +08:00
Lunny Xiao 5a58a272bc fix lint (#1953)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1953
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-15 20:28:49 +08:00
Lunny Xiao bc25b4128b Fix #1663 (#1952)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1952
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-14 11:23:05 +08:00
knice88 9461461967 fix pg GetColumns missing comment (#1949)
xorm reverse生成的结构体缺少备注信息

Co-authored-by: chad <example@qq.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1949
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: knice88 <knice88@noreply.gitea.io>
Co-committed-by: knice88 <knice88@noreply.gitea.io>
2021-06-12 22:47:15 +08:00
Lunny Xiao e1422f183c Add test to confirm #1247 resolved (#1951)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1951
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-12 20:35:22 +08:00
Lunny Xiao 00ee06fdd5 Add test for dump table with default value (#1950)
Confirm #1391 resolved.

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1950
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-12 20:27:49 +08:00
Lunny Xiao 7fd6356a85 Add DBVersion (#1723)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1723
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-12 15:06:05 +08:00
Lunny Xiao 0907b7a7fd test for unsigned int32 (#1923)
To confirm #722 has been resolved.

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1923
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-12 13:27:56 +08:00
Lunny Xiao 9c0901bd35 Add sync tests to confirm #539 is gone (#1937)
Fix #539

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1937
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-12 12:11:30 +08:00
Lunny Xiao 2b78150f70 Fix create table with struct missing columns (#1938)
Fix #1911, #1790

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1938
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-12 11:44:39 +08:00
Lunny Xiao 8e22bad304 Fix bug didn't reset statement on update (#1939)
Fix #1900

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1939
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-12 11:43:45 +08:00
Lunny Xiao 5b624ed051 Fix drone (#1946)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1946
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-12 10:47:31 +08:00
Lunny Xiao 083ab38ea0 disable unnecessary clone (#1945)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1945
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-10 21:09:01 +08:00
Lunny Xiao fa4b4c4ee3 Test for #1486 (#1942)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1942
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-09 19:30:15 +08:00
Lunny Xiao a6d2bfb4ba Compitable with cockroach (#1930)
Fix #1292

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1930
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-09 14:07:34 +08:00
Lunny Xiao 7864cb5ae6 refactor exprParam (#1825)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1825
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-09 09:05:50 +08:00
Lunny Xiao eda6fefba3 Remove mymysql from ci (#1928)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1928
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-08 21:41:13 +08:00
Lunny Xiao 43977186d3 Add tests for array store (#1922)
Fix #504

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1922
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-07 17:36:22 +08:00
Lunny Xiao 0f69f1eda2 Fix exist (#1921)
Fix #1818

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1921
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-07 13:45:29 +08:00
janse_zyd b1449d0fb7 Replace goracle with godror (#1914)
Co-authored-by: janse_zyd <59941594@qq.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1914
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: janse_zyd <janse_zyd@noreply.gitea.io>
Co-committed-by: janse_zyd <janse_zyd@noreply.gitea.io>
2021-06-06 21:34:02 +08:00
Lunny Xiao 2910bffb1b Add test for find limit (#1904)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1904
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-06 21:31:15 +08:00
Ikko Ashimine 8843a88503 Fix typo in column.go (#1908)
Avaiable -> Available

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1908
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Ikko Ashimine <eltociear@noreply.gitea.io>
Co-committed-by: Ikko Ashimine <eltociear@noreply.gitea.io>
2021-06-06 20:41:42 +08:00
Lunny Xiao 99cd8c80fb Add tests for big.Int usage (#1917)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1917
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-06 20:34:45 +08:00
Lunny Xiao 409cb7c0f1 Fix findandcount or count with groupby (#1915)
Fix #1022, #1221, #1726, #1836, #1910.

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1915
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-06 20:21:39 +08:00
Lunny Xiao 136cf1a843 Add tests for FindAndCount with custom table name (#1918)
Fix #1851

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1918
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-06 19:15:51 +08:00
Lunny Xiao d0219c37a8 Support build flag jsoniter to replace default json (#1916)
So you can `go build -tags=jsoniter` to use `github.com/json-iterator/go` as default json handler

Fix #1744

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1916
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-06-06 14:20:43 +08:00
Lunny Xiao 711f95d804
Update Changelog for v1.1.0 2021-05-14 17:36:07 +08:00
Andrew Thornton d2f52eba64 Byte strings in postgres aren't 0x... (#1906)
Byte strings in postgres are actually E'\x...' not 0x...

This is part of the follow-up to #1872

Signed-off-by: Andrew Thornton <art27@cantab.net>

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1906
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
2021-05-09 15:09:59 +08:00
Andrew Thornton dab09c73ab Fix another bug with #1872 (#1905)
Ensure that structs, arrays and slices are properly converted to strings.

Signed-off-by: Andrew Thornton <art27@cantab.net>

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1905
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
2021-05-08 21:39:03 +08:00
Andrew Thornton 210c30a7dd Fix two issues with dumptables (#1903)
There are two issues with #1872 which have become apparent
after testing on Gitea.

1. Ensure structs which are have before processors run correctly
2. Ensure structs extending other structs work
3. Ensure that numerical enums become numeric

Signed-off-by: Andrew Thornton <art27@cantab.net>

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1903
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
2021-05-08 12:27:22 +08:00
Andrew Thornton 912c2524f8 RFC: Use provided type to create the dstTable rather than inferring from the SQL types (#1872)
When using dumptables to convert between dialects if a struct is provided we should use it to generate the SQL types rather than infer them by mapping from the sql types.

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1872
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
2021-05-07 09:19:03 +08:00
Lunny Xiao ce2a743e88 Fix comments (#1896)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1896
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-04-12 16:00:07 +08:00
Lunny Xiao bd9535d781 Fix comments (#1893)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1893
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-04-12 09:19:08 +08:00
Lunny Xiao 1ade49614b More tests (#1890)
replace #1585

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1890
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-04-11 23:41:20 +08:00
Lunny Xiao 60cc3eaaf0 Unsigned Support (#1889)
This PR add support to MySQL, for other databases unsigned type will be downgrade to the related signed type.

Replace #1810

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1889
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-04-11 16:47:04 +08:00
Lunny Xiao 4bfe6853f5 Fix some comments lint and bug (#1888)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1888
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-04-10 10:57:36 +08:00
Lunny Xiao b92d951eac Fix drone (#1842)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1842
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-04-10 09:45:18 +08:00
Lunny Xiao ee78664413 Fix sqlite test (#1887)
Fix bug

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1887
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-04-08 21:26:21 +08:00
Andrew Thornton 2142e31d95 Fix formatting (#1886)
Fix newline formatting

Signed-off-by: Andrew Thornton <art27@cantab.net>

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1886
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
2021-04-08 20:51:48 +08:00
Andrew Thornton 21881d8b84 MariaDB 10.5 adds a suffix on old datatypes (#1885)
MariaDB when encountering an old datetime type will add a suffix of /* mariadb-5.3 */
on its schema information page. Xorm does not understand this and then its mappings
fail.

The simplest solution is just to remove any fixed suffix and that is what this PR does
- a clever solution would look for and remove any comments or match them.

See https://mariadb.com/kb/en/time/ for more details about the comment.

Related: https://github.com/go-gitea/gitea/issues/15277

Signed-off-by: Andrew Thornton <art27@cantab.net>

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1885
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-committed-by: Andrew Thornton <art27@cantab.net>
2021-04-08 14:12:40 +08:00
Lunny Xiao 40ee326cac More clear for Get with nil (#1879)
Resolve #1844

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1879
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-03-23 21:48:58 +08:00
Lunny Xiao 9286f29576 Fix bug on import when split SQLs (#1878)
Fix #1876

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1878
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-03-23 21:34:42 +08:00
Lunny Xiao e660414278 Support modernc.org/sqlite (#1850)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1850
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-03-15 23:34:33 +08:00
4color a7a51533d1 fix oracle insert datetime (#1873)
oracle下的日期插入问题。

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1873
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 4color <4color@noreply.gitea.io>
Co-committed-by: 4color <4color@noreply.gitea.io>
2021-03-04 23:40:35 +08:00
clannadxr eed7e65bd9 Panic when setting wrong logger (#1868)
Co-authored-by: clannadxr <clannadxr@hotmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1868
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: clannadxr <clannadxr@noreply.gitea.io>
Co-committed-by: clannadxr <clannadxr@noreply.gitea.io>
2021-02-18 17:14:13 +08:00
clannadxr 407da9ddd8 export tag identifier (#1865)
#1864 Export tag identifier so we can change that form `xorm` to others

This will be useful when in some migration scenarios such as migrate `sqlx` to `xorm`, the former uses `db` as the identifier and has a very simple rule which can be covered by xorm parser rules

Co-authored-by: clannadxr <clannadxr@hotmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1865
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: clannadxr <clannadxr@noreply.gitea.io>
Co-committed-by: clannadxr <clannadxr@noreply.gitea.io>
2021-02-09 15:20:54 +08:00
whybangbang ffac8e3577 session add method IsInTx (#1863)
Co-authored-by: whybangbang <525484036@qq.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1863
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: whybangbang <whybangbang@noreply.gitea.io>
Co-committed-by: whybangbang <whybangbang@noreply.gitea.io>
2021-02-03 23:27:07 +08:00