Commit Graph

66 Commits

Author SHA1 Message Date
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 a0aa21aec5 Refactor 2016-03-08 22:29:58 +08: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