1384 Commits

Author SHA1 Message Date
Gerhard Gruber
edbcbe3126 Fixed limit and offset for subquery 2021-11-23 15:04:56 +01:00
Gerhard Gruber
30f2304e9d Do not order subquery if no limit or order is applied 2021-11-23 14:51:30 +01:00
Gerhard Gruber
de609de5b3 order by for delete not supported 2021-11-23 14:44:27 +01:00
Gerhard Gruber
a06ca0d4d6 order by for update not supported 2021-11-23 14:36:56 +01:00
Gerhard Gruber
edc2d5cc57 Try to fix join errors on MSSQL 2021-11-23 14:17:12 +01:00
Gerhard Gruber
7eb0cacec0 Added LowerExpr and UpperExpr 2021-11-18 09:28:03 +01:00
Gerhard Gruber
9e23996e16 Added Lower and Upper 2021-11-18 09:25:27 +01:00
Gerhard Gruber
221f8963db Added sub-transaction detection to WrapInTx 2021-10-27 12:22:54 +02:00
Gerhard Gruber
410393c804 try to fix too much updates 2021-10-22 12:18:02 +02:00
Gerhard Gruber
8417729f4b Update issue with UpdateFields
When calling UpdateFields on a DB, it modified the DB and the field names persisted
2021-10-21 19:52:23 +02:00
Gerhard Gruber
9922312e08 One more situation with empty in arrays 2021-10-21 17:39:54 +02:00
Gerhard Gruber
5fecbbd4e2 in and not in support empty arrays 2021-10-21 17:33:34 +02:00
Gerhard Gruber
0e9bb664cd Fixed variable name 2021-09-15 16:46:35 +02:00
Lukas Jorg
f8938253ce Implemented small method to disable association saving 2021-09-14 07:45:42 +02:00
Lukas Jorg
98d691603d Created transaction wrapper 2021-09-13 09:19:42 +02:00
Gerhard Gruber
0caca1a6f9 Remove WHERE word 2021-09-08 09:01:03 +02:00
Gerhard Gruber
099a4048ae Fixed bind variable resolution 2021-09-08 08:55:17 +02:00
Gerhard Gruber
4d92c6df26 Removed duplicated method 2021-09-08 08:19:34 +02:00
Gerhard Gruber
c4a4f834f7 Added GetSQLWhereClause 2021-09-08 08:04:46 +02:00
Gerhard Gruber
9cf19aaa35 Added GetSQL method 2021-09-07 20:59:42 +02:00
Gerhard Gruber
4878e0917e Fix multi-order in a better way
First and Last do not order if query is already ordered (inspired by ActiveRecord)
2021-08-10 12:06:43 +02:00
Gerhard Gruber
f930ed782b Fix multiple columns in order by clause 2021-08-10 12:06:43 +02:00
Daniel Hammerschmid
2435f46bf8 Added function gorm.Concat 2021-08-05 14:47:12 +02:00
maddie
12fab57a74 Improve preload speed
All credits to @vanjapt who came up with this patch.

(cherry picked from commit 012d1479740ec593b0c07f0372e0111c01c3b34a)
2021-05-12 17:49:51 +02:00
Gerhard Gruber
2ce058e0fe Ignore associations in UpdateFields 2021-03-25 14:04:30 +01:00
FFuchsi
b55b8aef36
added group concat expression (#10) 2021-03-25 14:03:56 +01:00
Daniel Hammerschmid
968a09b86f Added funcs QuoteExpr and Min to expression extension 2021-03-17 11:42:28 +01:00
Daniel Hammerschmid
96758ec560 Added func SumExpr to expr 2020-10-30 09:31:08 +01:00
Aleksandar Dimtirov
cf2c573358 Fix LastInsertId is not supported 2020-07-30 14:24:39 +02:00
Gerhard Gruber
7e26dfea98
Fix year date format 2020-06-10 10:16:15 +02:00
Gerhard Gruber
d892695c2b
Fixed max length of nvarchar
See also https://docs.microsoft.com/en-us/sql/t-sql/data-types/nchar-and-nvarchar-transact-sql?view=sql-server-ver15
2020-06-02 13:30:17 +02:00
Daniel Hammerschmid
4aeade3621 Fixed a bug regarding nested subqueries
Fixed a bug which could occur when using the expression extension with nested subqueries.
2020-04-28 16:17:56 +02:00
Gerhard Gruber
ce0675a4fe Fix a problem with identity_insert
When a model with associations is inserted and the model itself and the association
objects contain a value for the ID field, it leads to database errors.
2020-02-19 17:32:18 +01:00
Daniel Hammerschmid
737d170906 Added func Max to the expression extension 2019-04-24 08:39:57 +02:00
Daniel Hammerschmid
32a34dc0e8 Added functions And, Or, Not and NotLike to the expression extension 2019-03-12 20:48:29 +01:00
daniel
7c9ad85cc3 Added func CountExpr to expr 2018-05-28 20:34:12 +02:00
Gerhard Gruber
e7ef150c55 Added gorm.Union and gorm.expr.Union method (#2)
Improved call of In with expr as parameter

changed type check
2018-05-28 20:02:03 +02:00
daniel
4ba55556d6 Fixed a merge error 2018-02-26 16:30:57 +01:00
Gerhard Gruber
c807fe3202 Started with expression extension
Improved questionmark parameter placeholder replacementw

Added support for subqueries in Where and Having clauses

Queries can be transformed into subqueries by calling .Subquery() on a db object

See main_test.go:TestQueryBuilderSubselectInWhere

Fixed comment spacing

Refactoring, adding Having Subquery support, allowing db.T for tablenames

Removed quoting from tablename in db.T, use db.QT for that

Refactoring, adding Having Subquery support, allowing db.T for tablenames

Added changes

Started with expression extension

Refactoring, adding Having Subquery support, allowing db.T for tablenames

Added method to easily update fields of the Model struct

Added column comparison and Join support

Added subquery support for InnerJoin querybuilder

Fixed column comparison

Added support for column prefixes

Models can set their column prefix by implementing the method ColumnPrefix() string

Fixed multi-parameter subselects and introduced aliasing

Improved Related method

Improved Related method to search for foreign key struct fields with the suffix "ID" (additional to "Id")

Got QueryExpr support from upstream

Added support for subqueries in Where and Having clauses

Queries can be transformed into subqueries by calling .Subquery() on a db object

See main_test.go:TestQueryBuilderSubselectInWhere

Improved questionmark parameter placeholder replacementw

Refactoring, adding Having Subquery support, allowing db.T for tablenames

Removed quoting from tablename in db.T, use db.QT for that

Removed quoting from tablename in db.T, use db.QT for that

Added changes

Added method to easily update fields of the Model struct

Fixed column comparison

Added support for column prefixes

Models can set their column prefix by implementing the method ColumnPrefix() string

Fixed multi-parameter subselects and introduced aliasing

Improved Related method

Improved Related method to search for foreign key struct fields with the suffix "ID" (additional to "Id")

Added select extension for multiple columns

Added support for LEFT RIGHT OUTER joins

Fixed slice support for lexpr.In()

Publizised LExpr

Added DateFormatting for all dialects

Added SUM function for columns

Fixed FormatDate

Added count for column

Removed literal expressions LExpr

Rewrote LExpr methods to work with expr structs.

Added methods BAnd and BOr (bitwise & and | )

Added SetLogWriter method

Added NotIn query expression

Added Distinct query expression

Added DistinctColumn query expression

Same as Distinct but returns a string

Added method OnExp to jexpr

Improved query expression .Eq() method for nil pointers

Fixed rebase errors
2018-02-26 16:00:19 +01:00
Jinzhu
48a20a6e9f Add SubQuery method 2018-02-22 12:04:12 +08:00
Jinzhu
58e34726df Don't access scanner's fields if already defined data type 2018-02-18 09:00:03 +08:00
Jinzhu
55945afb34 Update README 2018-02-17 00:33:52 +08:00
Jinzhu
6e1387b44c Update README 2018-02-13 18:12:09 +08:00
Jinzhu
1fb623dfbb Update README 2018-02-13 17:59:48 +08:00
Jinzhu
becd777b1e Fix unicode chars in SQL 2018-02-13 12:37:39 +08:00
Jinzhu
67c4280c57 Fix support embedded pointer type struct, close #1450 2018-02-13 10:00:18 +08:00
Jinzhu
fe3c94cd2d Add Take method, close #1228 2018-02-13 09:18:42 +08:00
Jinzhu
cfd1cc586a Add 2D array support, close #1201 2018-02-13 08:33:11 +08:00
Jinzhu
3b2c4b3608 Fix insert with default value for mysql 2018-02-12 17:39:34 +08:00
Jinzhu
8005321a1c Allow table option when DropTable, close #1514 2018-02-12 14:49:24 +08:00