Commit Graph

50 Commits

Author SHA1 Message Date
Jinzhu 7c0de9199c Test Migrate Indexes 2020-05-30 22:43:41 +08:00
Jinzhu 028c9d6e17 Test Updates 2020-05-30 17:01:28 +08:00
Jinzhu 05e1af3bfb Test Upsert 2020-05-30 14:28:42 +08:00
Jinzhu cc07ee0444 Support mssql merge 2020-05-30 13:22:15 +08:00
Jinzhu c07a08d88b Support mssql 2020-05-30 10:50:56 +08:00
Jinzhu f7f633590f Fix tests with mysql, postgres 2020-03-12 13:05:22 +08:00
Jinzhu af080e6773 Fix primary key tag 2020-03-12 08:39:42 +08:00
Jinzhu 2a0c3e39f2 AddVar accept writer 2020-03-09 17:59:54 +08:00
Jinzhu 504f42760a Refactor clause Writer 2020-03-09 17:07:00 +08:00
Jinzhu a145d7e019 Refactor structure 2020-03-09 14:25:50 +08:00
Jinzhu 078ba75b9c Add QuoteTo method 2020-03-08 23:30:16 +08:00
Jinzhu bc5ceff82f Explain SQL for dialects 2020-02-23 12:41:13 +08:00
Jinzhu a67be2a1f1 Refactor reorder migrator models 2020-02-23 08:54:13 +08:00
Jinzhu 1d803dfdd9 Add migrator tests for mssql 2020-02-23 01:02:07 +08:00
Jinzhu 215f5e7765 Add Raw, Row, Rows 2020-02-22 19:41:01 +08:00
Jinzhu fab7d96da5 Add DataTypeOf for dialector 2020-02-22 17:53:57 +08:00
Jinzhu f0d514e330 Cleanup 2020-01-28 16:22:07 +08:00
jaden 79a77d771d go.mod: remove unnecessary dependences through upgrade go-mssqldb (#2795)
* go.mod: remove unnecessary dependences through upgrade go-mssqldb

$ go get -v -u github.com/denisenkom/go-mssqldb && go mod tidy -v
go: finding github.com/denisenkom/go-mssqldb latest
go: finding github.com/golang-sql/civil latest
go: finding golang.org/x/crypto latest
unused cloud.google.com/go
unused gopkg.in/check.v1
unused gopkg.in/yaml.v2

* mssql: use SCOPE_IDENTITY() if OUTPUT not possible

* go-mssqldb: find a up-to-date version pass test -race
2019-12-06 22:22:28 +08:00
Jinzhu 11e2819f44 Extract parseInt 2019-12-05 23:13:54 +08:00
zaneli 23f6840776 Add limit and offset parse error 2019-11-27 11:21:05 +09:00
Alex Stockwell 820b5f244a MSSQL Create() fix: Add LastInsertIDReturningSuffix to dialect (#2690)
* MSSQL Create() fix: Add LastInsertIDReturningSuffix to dialect

Per https://github.com/denisenkom/go-mssqldb/issues/355

* MSSQL Create() fix: Added OUTPUT query to Create() builder
2019-10-17 22:54:11 +08:00
zaneli 09a868b381 Handle syntax to specify an index prefix length 2019-04-20 01:04:23 +09:00
Eyal Posener 123d4f50ef lock TagSettings structure when modified (#1796)
The map is modified in different places in the code which results in race conditions
on execution.
This commit locks the map with read-write lock when it is modified
2018-09-10 07:11:00 +08:00
Louis Brauer dbb25e9487 Adding json type for mssql dialect, similar to postgres.Jsonb (#1934)
* Adding json type for mssql dialect, similar to postgres.Jsonb

* Adding proper comments
2018-07-27 07:30:57 +08:00
Olga Kleitsa 82eb9f8a5b included actual sql query to discover fi foreign key with the same name exists in a specific table of the database in use (#1896) 2018-05-12 01:29:00 -05:00
Jinzhu 3b2c4b3608 Fix insert with default value for mysql 2018-02-12 17:39:34 +08:00
Giuseppe 706b8f55da Use brackets for quoting (#1736) 2018-02-10 12:28:01 +08:00
Jinzhu ae509ab237 Port AUTO_INCREMENT false support to mssql 2018-02-10 08:30:05 +08:00
Jinzhu 89a726ce5d Move ModifyColumn implemention to Dialect 2018-02-09 22:58:34 +08:00
Jinzhu 87fc1b2473 Refactor PR #1751 2018-02-03 20:27:19 +08:00
Jinzhu 969ab67636 [mssql] Fix save time struct's timezone 2017-08-11 17:18:49 +08:00
Jinzhu 717654b31c Merge pull request #1420 from ModelRocket/master
Adding more complete binary support for standard dialects
2017-04-19 15:35:50 +08:00
Rob Rodriguez bae0799bd8 Adding better binary type support for common SQL dialects 2017-04-19 00:21:56 -07:00
Jinzhu a870874bb5 Accept 0 as a value for Limit, Offset 2017-04-18 23:32:31 +08:00
Jinzhu 2a041971f9 Change bind var to 24652$ to avoid possible confliction 2017-04-18 16:13:02 +08:00
Jinzhu 5730b92954 Fix tests with mssql 2017-03-22 23:50:42 +08:00
John Mick 66982a7047 Remove SET_IDENTITY_INSERT for transactions in MS SQL
SET_IDENTITY_INSERT should be handled by each individual developer to avoid extra queries to the database.
2017-03-22 23:50:42 +08:00
Russ Egan 45f1a95051 Replace all use of *sql.DB with sqlCommon
Exporting sqlCommon as SQLCommon.

This allows passing alternate implementations of the database connection, or wrapping the connection with middleware.  This change didn't change any usages of the database variables.  All usages were already only using the functions defined in SQLCommon.

This does cause a breaking change in Dialect, since *sql.DB was referenced in the interface.
2017-03-14 17:02:14 -04:00
Craig Peterson c3276eb221 fix issue with mssql NEXT option.
Fixes #1205
2017-02-21 14:23:01 -07:00
Jinzhu a3b8b332ed Allow customize data type via ParseFieldStructForDialect 2017-01-15 21:45:17 +08:00
Jinzhu b507cdf93d Expose current database name API 2016-07-11 21:37:44 +08:00
Jay Taylor 1485f4bce9 Use validated interface{} for limit/offset values to ensure values greater than
max 32-bit integer are addressable, and in a backwards-compatible way.
2016-06-23 06:29:51 -07:00
Jinzhu f926dd9f9f Revert "Use int64 for limit/offset values to ensure values > 32-bit int are addressable." 2016-06-16 16:31:50 +08:00
Jay Taylor 9b0fb2feb9 Use int64 for limit/offset values to ensure values greater than max 32-bit
integer are addressable.
2016-06-08 17:03:22 -07:00
Nikola Kovacs 6eb73ae654 Fix too long foreign key names in mysql.
The dialect must define its own foreign key generator method.
The previous default is available as a method on gorm.DefaultForeignKeyNamer
and can be embedded in other dialects.
The mysql dialect uses the first 24 characters plus an sha1 hash of the
full key name if the key name is more than 64 characters.
2016-05-22 00:13:26 +02:00
Jinzhu ec110657da Refactor based on golint 2016-03-07 17:49:55 +08:00
Jinzhu 60a859d966 Add check HasForeignKey method to dialect, also move mssql dialect to a separate repo as it is not well tested, close #832 2016-03-05 22:51:11 +08:00
Jinzhu b6a2710a15 Don't execute SET IDENTITY_INSERT if dialect is not mssql 2016-03-05 21:24:54 +08:00
Jinzhu 2522f03c1f Set identity insert on after create transaction, close #841 2016-03-05 19:22:33 +08:00
Jinzhu c811590d4e Add dialects for supported databases for easier to use 2016-03-05 18:54:59 +08:00