Commit Graph

1506 Commits

Author SHA1 Message Date
Lunny Xiao 8284e5defa Automatically convert datetime to int64 (#1715)
Fix #1714

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1715
Reviewed-by: Jerry <jerry@noreply.gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-01-05 11:04:22 +08:00
Lunny Xiao 26b248c569 Fix update bug (#1823)
Fix #1821

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1823
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-01-05 10:55:36 +08:00
Lunny Xiao b65276da85 Fix index (#1841)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1841
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-01-05 10:42:14 +08:00
Lunny Xiao 7c8d3f1ad9 Fix bug when modify column on mssql (#1849)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1849
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-committed-by: Lunny Xiao <xiaolunwen@gmail.com>
2021-01-05 10:37:41 +08:00
finelog 3472d80a6d prevent panic when struct with unexport field (#1839)
prevent panic when struct with unexport field

add test for prevent panic when vanial struct with unexport field panic

minor code fix

minor fix part II

Co-authored-by: finelog <kaicltw@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1839
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-Authored-By: finelog <finelog@noreply.gitea.io>
Co-Committed-By: finelog <finelog@noreply.gitea.io>
2020-12-02 22:07:35 +08:00
Lunny Xiao acb337ba1f Fix find and count bug with cols (#1826)
Fix find and count bug with cols

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1826
Co-Authored-By: Lunny Xiao <xiaolunwen@gmail.com>
Co-Committed-By: Lunny Xiao <xiaolunwen@gmail.com>
2020-11-09 12:23:14 +08:00
Lunny Xiao beac298c02 Fix json tag with other type (#1822)
Fix json tag with other type

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1822
Co-Authored-By: Lunny Xiao <xiaolunwen@gmail.com>
Co-Committed-By: Lunny Xiao <xiaolunwen@gmail.com>
2020-11-03 17:10:35 +08:00
jumpeiMano 17f28a1314 feat: define xorm.FromDialectAndDB (#1812)
refactor: rename the function name

feat: define xorm.FromDialectAndDB

Co-authored-by: jumpeiMano <jumpeim37@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1812
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-Authored-By: jumpeiMano <jumpeimano@noreply.gitea.io>
Co-Committed-By: jumpeiMano <jumpeimano@noreply.gitea.io>
2020-10-20 11:11:04 +08:00
Lunny Xiao 0c1b815227 Performance improvement for columnsbyName (#1788)
Performance improvement for columnsbyName

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1788
2020-09-09 13:44:18 +00:00
Lunny Xiao e35662b1ed
Change log for v1.0.5 2020-09-08 23:42:39 +08:00
Lunny Xiao 1b200bdcba Fix bug of ToDB when update on a nil pointer (#1786)
Fix test

Fix bug

Fix bug

Add test for insert nil struct field

Fix test

Fix bug of ToDB when update on a nil pointer

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1786
2020-09-08 15:40:26 +00:00
Andrew Thornton b422930617 Fix warnings with schema Sync2 with default varchar as NVARCHAR (#1783)
prod CI

Merge branch 'fix-1782-MSSQL-nvarchar-fixes' of gitea.com:zeripath/xorm into fix-1782-MSSQL-nvarchar-fixes

map "character" to Char for postgres

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

Merge branch 'master' into fix-1782-MSSQL-nvarchar-fixes

Postgres (and cockroachDB by inheritance) maps Char to Varchar

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

fix test

Add a few more column testcases in light of postgres weirdness

prod CI

prod CI

prod CI

Properly handle MAX

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

Add tests for Test and Char columns

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

prod CI

fix test

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

Remove the duplicate mssql drone test and add a specific sync test

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

add depends_on (2)

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

add depends_on

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

add nvarchar as a testcase

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

Set defaultVarchar to upper case

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

Fix length issue

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

schemas.Text should map to db.defaultVarchar

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

Add failing test

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

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1783
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-09-08 01:36:50 +00:00
lafriks 01e1e98dd5 Do not ever quote asterisk symbol. Fixes #1780 (#1781)
Do not ever quote asterisk symbol. Fixes #1780

Co-authored-by: Lauris BH <lauris@nix.lv>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1781
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-09-06 08:22:34 +00:00
Lunny Xiao 3e0179ff26 Fix bug on get columns for postgres (#1779)
Fix bug on get columns for postgres

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1779
2020-09-03 13:10:27 +00:00
Lunny Xiao b10919ec56
Add changelog for v1.0.4 2020-09-02 20:40:16 +08:00
Andrew Thornton f8c91ec4a3 Correct default detection in MariaDB >= 10.2.7 (#1778)
try again ci

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

try again ci

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

tidy up appearance of the alreadyQuoted SQL string

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

Merge remote-tracking branch 'origin/master' into fix-defaults-sync2-mysql

Try MariaDB 10.4

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

fix drone

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

Correct default detection in MariaDB >= 10.2.7

MariaDB in version 10.2.7 changed the reporting of COLUMN_DEFAULT in
INFORMATION_SCHEMA.COLUMNS to quote string values.

This PR adds a version detection test to the columns query.

References: https://jira.mariadb.org/browse/MDEV-13132
References: https://jira.mariadb.org/browse/MDEV-15390

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

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1778
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-09-02 12:37:16 +00:00
jdkendall 76d6b9fdf5 Fix mysql dialect error from invalid db identifier in orderby clause (#1743) (#1751)
Fix mysql dialect error from invalid db identifier in orderby clause (#1743)

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1751
2020-08-31 01:19:12 +00:00
w3xse7en f39a4cb41c solve duplicate log in commit and rollback (#1750)
solve duplicate log in commit and rollback

Co-authored-by: Lyi <zhanghong@zuodashi.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1750
Reviewed-by: helong zhang <outman99@hotmail.com>
2020-07-30 09:05:59 +00:00
sylba2050 4a6b8c29bf Fix typo (#1748)
Fix typo

Co-authored-by: Masataka Hisasue <masataka.hisasue@optim.co.jp>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1748
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-07-27 09:29:33 +00:00
appleboy fe3bc3851e chore: enable fmt check (#1742)
chore: enable fmt check

Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1742
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-07-21 04:36:55 +00:00
Lunny Xiao 318102c9ff Add params for mssql to allow redefine varchar as nvarchar or char as nchar (#1741)
Update drone test for mssql nvarchar

Add params for mssql to allow redefine varchar as nvarchar or char as nchar

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1741
2020-07-18 08:01:27 +00:00
Thomas_An 0fae64bb3b Support get dataSourceName on ContextHook for monitor which DB executed SQL (#1740)
Merge branch 'log_context_add_db_info'

add session to context

Revert "accept lunny's suggestion"

This reverts commit 57fd669942.

Merge branch 'master' of https://gitea.com/Thomas_An/thomasan_xorm

accept lunny's suggestion

Merge branch 'master' into master

add test code

session add Engine func

Used to monitor which DB executed this SQL

Co-authored-by: yong.an <yong.an@shopee.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1740
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-07-13 13:29:38 +00:00
Lunny Xiao 946fb57e1c
Add 1.0.3 to changelog 2020-07-10 20:57:00 +08:00
StdioA be7800fc63 Fix index name parsing in SQLite dialect (#1737)
Fix index name parsing in SQLite dialect

If index is created with statement like CREATE INDEX "IDX_tbl_field" ON "tbl" (field), the dialect will parse index name as "IDX_tbl_field" and recognize it as an irregular index.

Co-authored-by: David Dai <stdioa@163.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1737
2020-07-09 08:26:18 +00:00
MURAOKA Taro 56881e64a9 put ContextLogger in higher priority (#1656)
Merge branch 'master' into logger-priority

Merge branch 'master' into logger-priority

Merge branch 'master' into logger-priority

Merge branch 'master' into logger-priority

put ContextLogger in higher priority

SetLogger use `Logger` when give a interface which implements both
ContextLogger and Logger.  Because Go's type `switch` uses prior `case`.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: MURAOKA Taro <koron.kaoriya@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1656
2020-07-09 06:44:26 +00:00
Lunny Xiao 1a39682180 Fix dump of sqlite (#1639)
Fix test

fix test

Fix sqlite dump

Fix sqlite dump

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1639
2020-07-09 01:41:12 +00:00
Ky 6becb291d3 update sqlite3 (#1730)
update sqlite3

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1730
2020-07-07 14:49:58 +00:00
MURAOKA Taro 14a98ca9d2 add hooks for Commit and Rollback (#1733)
add hooks for Commit and Rollback

Related issue: https://gitea.com/xorm/xorm/issues/1732

Co-authored-by: MURAOKA Taro <koron.kaoriya@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1733
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-07-04 06:13:15 +00:00
getsu 677c0d7411 fix invalid date when update for oracle (#1694)
Merge branch 'master' into master

Merge branch 'master' into master

Merge branch 'master' into master

fix invalid date when update for oracle

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: chendy <dengyue.chen@ebaotech.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1694
2020-07-03 08:10:09 +00:00
Lunny Xiao 9b41b879a7 return the result on transaction (#1725)
return the result on transaction

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1725
2020-06-26 13:06:46 +00:00
Lunny Xiao cc7d219065 Upgrade some dependencies (#1718)
Upgrade some dependencies

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1718
2020-06-18 11:36:19 +00:00
Lunny Xiao b434b045ad Add missing changelog for 1.0.2 (#1712)
Add missing changelog for 1.0.2

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1712
2020-06-16 02:09:37 +00:00
Lunny Xiao 08a18027a0
Update README badges 2020-06-13 13:37:43 +08:00
Lunny Xiao 4dde8f14e6 Fix find and count bug (#1651)
Fix bug

fix mssql findandcount

Fix find and count bug

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1651
2020-06-13 05:31:33 +00:00
Lunny Xiao b08f962d7a Fix bug when ID used but no reference table given (#1709)
Fix bug when ID used but no reference table given

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1709
2020-06-13 01:20:25 +00:00
appleboy f071e5eb96 chore: improve titleCasedName performance (#1691)
udpate

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

chore: improve titleCasedName performance

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1691
2020-05-23 02:22:08 +00:00
Lunny Xiao d485101331 chore: improve snakeCasedName performance (#1688)
chore: update

chore: udpate

chore: improve snakeCasedName performance

Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1688
Reviewed-by: appleboy <appleboy.tw@gmail.com>
2020-05-22 02:53:55 +00:00
tmalaher 55594d1dbe Oracle uses double quotes for quoting table/column/etc. names (#1674)
Oracle uses doulbe quotes for quoting table/column/etc. names

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1674
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-05-08 12:13:13 +00:00
Lunny Xiao 8ebcb8b557 Fix find with another struct (#1666)
Fix find with another struct

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1666
2020-04-26 11:34:05 +00:00
daxiong 3bb787a2f7 fix GetColumns missing ordinal position (#1660)
fix GetColumns missing  ordinal position

Co-authored-by: zhubo <816078@qq.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1660
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-04-23 12:57:44 +00:00
limo.creed 34dc7f8791 Add Hook (#1644)
move hook to standalone package

add hook for engine

Co-authored-by: yuxiao.lu <yuxiao.lu@liulishuo.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1644
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-04-09 06:03:39 +00:00
limo.creed cfa88b908c fix context not deliver in QueryStructContext (#1645)
fix context not deliver in QueryStructContext

Co-authored-by: yuxiao.lu <yuxiao.lu@liulishuo.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1645
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-04-08 02:20:36 +00:00
rosbit 7e981f5f5e fix bug for mis-converting uint64 to int64 (#1647)
fix bug for mis-converting uint64 to int64

Co-authored-by: rosbit <me@rosbit.cn>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1647
2020-04-05 04:49:44 +00:00
limo.creed 410c2de923 fix misspelled words (#1642)
fix misspelled words

Co-authored-by: yuxiao.lu <yuxiao.lu@liulishuo.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1642
2020-04-01 12:37:03 +00:00
Lunny Xiao 5d90695511 update discuss forum new address (#1638)
update discuss forum new address

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1638
2020-03-28 02:24:39 +00:00
Lunny Xiao 0a06dc204a Move processor function into one file (#1637)
Move processor function into one file

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1637
2020-03-28 02:23:37 +00:00
Lunny Xiao 79bdda3cf1 Move all integrations tests to a standalone sub package (#1635)
Fix vet

Remove unused files

Move all integrations tests to a standalone sub package

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1635
2020-03-27 07:13:04 +00:00
Lunny Xiao 2ac051f075 Improve insert map generating SQL (#1634)
Fix writeArg

Improve insert map generating SQL

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1634
2020-03-27 03:13:25 +00:00
Lunny Xiao 78bb4c711d Improve codes (#1630)
Improve codes

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1630
2020-03-26 13:24:11 +00:00
Lunny Xiao b78418daa5 Support session id (#1632)
small nit

Support session id

Reviewed-on: https://gitea.com/xorm/xorm/pulls/1632
2020-03-26 12:31:08 +00:00