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>
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>
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>
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>
1. add: support xml column type for mssql.
2. fix: array index overflow when getindexs caused by unregular indexname(eg.idx_(tablename))
Co-authored-by: Rick <lonelyangel.jcw@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1852
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: L-Angel <l-angel@noreply.gitea.io>
Co-committed-by: L-Angel <l-angel@noreply.gitea.io>
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>
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>
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
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
go mod tidy
stop using xorm.io/core
Merge branch 'master' into fix-oracle-db
revert a goracle parser function
add TestParseOracleConnStr
Oracle : Local Naming Method
Co-authored-by: Tomoya AMACHI <tomoya.amachi@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1515
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
fix test
fix test
Fix mssql issue with duplicate columns.
The `GetColumns()` method for the mssql dialect can return the same
column multiple times if the column is in multiple indexes.
Co-authored-by: Robert G. Jakabosky <bobby@sharedrealm.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1225
names with upper charactor on postgres will need quotes
Fix bug
Add new quote parameter on tests
Fix bug
Fix tests
Fix quotes
fix test
Improve quote policy
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1567
Fix tests
fix some tests and ignore some
Add &experimental_serial_normalization=sql_sequence on test so that id will increase from 1
fix drone
Fix drone
Fix drone
Fix drone
Remove space
Add makefile
fix drone
fix drone
fix drone
update
fix tests
use sql_sequence when testing
fix postgres ci
fix circle ci for cockroach
upgrade cockroach version
add trace on error
add drone ci
run cockroach background
run cockroach backround
run cockroach backround
fix test
fix run cockroach
add cockroach test to circleci
add cockroach support
Add tests for table name (#1...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/896
Fix test
Fix test
Add new Quoter object to handle quote
Fix join table name quote bug
Move reserve words related files into dialects sub package (#1544)
Move reserve words related files into dialects sub package
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1544
Fix mssql quote (#1535)
Fix some quotes
Fix mssql quote
Merge core package back into the main repository and split into serval sub packages. (#1543)
Fix test
Improve fmt
update go.mod
Move core as a sub package
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1543
Fix int time deleted bug (#1539)
Fix panic
Fix test
Fix test for mssql time
Add sql type check on deleted cond
Fix int time deleted bug
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1539
Add test for mysql8.0 (#1538)
Fix pk order on test
Add test for mysql8.0
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1538
Add test for join limit (#1536)
Add test for join limit
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1536
Improve drone (#1537)
Fix drone
Improve drone
* use traditional positional parameters on inser...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1537
Fix slice of struct not cache bug (#895)
Fix failure caused by nil bean
Judge both type of struct and pointer in case of out-of-range
Fix issue #894
Add test for join subquery (#1528)
Fix test
Fix subquery with schema
Add test for join subquery
Add makefile (#1531)
Fix drone
Fix ci
Add deps
Improve drone
Fix envs
Add makefile
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1531
Add password for postgres drone image (#1530)
Add password for postgres drone image
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1530
format time when sqlTypeName is core.Varchar (#1026)
fix time test
add test for time format
sign codes according to contributing rules.
format time when sqlTypeName is core.Varchar. Same with core.DateTime or core.TimeStamp
Add test for second insert error (#1527)
Add test for second insert error
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1527
Add tests for table name (#1517)
add tests for table name
Fix test (#1526)
Fix test
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1526
Fix test (#1526)
Fix test
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1526
Fix wrong warning log on autoincrement column when sync table (#1525)
improve doc
Fix wrong warning log on autoincrement column when sync table
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1525
Fixed Join strings on func Exist (#1520)
fix test
fixed Join strings on func Exist
Co-authored-by: Tomofumi Kusana <tkusana@morisawa.co.jp>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1520
For nullable columns, store nil values as NULL (#531)
Merge branch 'master' into jcsalem/fix/nil_ptr_is_nullable
fix bug when buffersize with iterate (#941)
Merge branch 'master' into lunny/fix_buffer_iterate
Exclude schema from index name (#1505)
Merge branch 'master' into fix-schema-idx
SetExpr support more go types (#1499)
Improve tests
SetExpr support more go types
fix vet
fix drone lint
remove go1.10 test on drone
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499
fix vet
fix drone lint
remove go1.10 test on drone
Exclude schema from the index name
Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1505
fix test
fix bug
fix bug when buffersize with iterate
SetExpr support more go types (#1499)
Improve tests
SetExpr support more go types
fix vet
fix drone lint
remove go1.10 test on drone
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499
fix vet
fix drone lint
remove go1.10 test on drone
Fix update with Alias (#1455)
Co-authored-by: Guillermo Prandi <guillep2k@noreply.gitea.io>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/941
fix update map with version (#1448)
fix test
fix update map with version
SetExpr support more go types (#1499)
Improve tests
SetExpr support more go types
fix vet
fix drone lint
remove go1.10 test on drone
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499
fix vet
fix drone lint
remove go1.10 test on drone
Fix update with Alias (#1455)
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1448
Exclude schema from index name (#1505)
Merge branch 'master' into fix-schema-idx
SetExpr support more go types (#1499)
Improve tests
SetExpr support more go types
fix vet
fix drone lint
remove go1.10 test on drone
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499
fix vet
fix drone lint
remove go1.10 test on drone
Exclude schema from the index name
Co-authored-by: Guillermo Prandi <guillep2k@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1505
SetExpr support more go types (#1499)
Improve tests
SetExpr support more go types
fix vet
fix drone lint
remove go1.10 test on drone
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1499
For nullable columns, store nil values as NULL
fix vet
fix drone lint
remove go1.10 test on drone
Fix update with Alias (#1455)
Improve c...
Reviewed-on: https://gitea.com/xorm/xorm/pulls/1534