Commit Graph

29 Commits

Author SHA1 Message Date
liu-xuewen 10e217e2bc Print affected rows ()
* fix better

* add the rows number that the sql result affected or returned
2017-07-23 16:04:22 +08:00
Jinzhu adf9b80fb7 Refactor format log for postgres 2017-02-10 16:50:55 +08:00
Jinzhu df6c3c9237 Refactor format log for postgres 2017-02-10 16:49:28 +08:00
Jinzhu 97949fdbc1 Refactor Logger 2017-01-15 16:58:55 +08:00
Francisco Obispo 7f328975cd When using the LogMode(true), the SQL produced during the log message, places the bounded variables in the wrong location, this is due to the fact that the current implementation splits the values with a regex similar to: ($\d+)|?.
That works well for ? placeholders because they should be replaced in order.

However, the numeric placeholders should be replaced based on their value, for instance:

SELECT name,last FROM contact WHERE name=$2 and age=$1
Should NOT be replaced in order, because it will yield an incorrectly formed SQL command, which is not very useful for debugging.

Fixes issue: 
2016-11-09 17:05:21 -08:00
Jinzhu 1819dda80a Export LogWriter interface 2016-03-10 17:38:52 +08:00
Jinzhu ec110657da Refactor based on golint 2016-03-07 17:49:55 +08:00
Jinzhu e0cca89ce3 Handle binary in log, close 2016-03-04 09:12:01 +08:00
Jinzhu 8b291cc32b Fix format log, close 2016-03-04 08:59:51 +08:00
Daniel Hobe fac5e822ff Change logger to use an interface. This allows reuse of the nice formatting
done by gorm while still sending the output to a custom logger.
2015-09-02 09:37:44 -07:00
Jinzhu 7934223f99 Better formated logger 2015-02-23 09:26:26 +08:00
Jinzhu 38938f299f Better formated sql log 2015-02-20 22:41:03 +08:00
Jinzhu 0b32041135 Review and Refactor 2015-02-17 22:55:14 +08:00
Cihangir SAVAS 4e90fbf4e8 gorm: added ability to change the time.now format 2014-08-23 01:00:04 -07:00
Jinzhu 6bb7c8b744 Add callback.go 2014-01-23 16:43:39 +08:00
Jinzhu 30e1b07f7e Refact logger 2014-01-04 17:36:58 +08:00
Jinzhu 66bfcec72e Initalize default logger when initalize DB 2014-01-04 15:32:44 +08:00
Jinzhu 4125526ef6 Improve Logger 2014-01-03 19:23:41 +08:00
Jinzhu 29bc814934 Remove unnecessary init method 2013-11-19 08:50:07 +08:00
Jinzhu ea67d1d377 Move non-public DB method to private.go 2013-11-16 11:41:31 +08:00
Jinzhu 2d85c30fde Add search condition 2013-11-15 22:29:42 +08:00
Jinzhu c03999a44e Add Tag Support 2013-11-14 00:03:31 +08:00
Jinzhu ce91468922 Make Save, Delete, Updates be executed in transaction to keep data consistency 2013-11-11 18:40:02 +08:00
Jinzhu f2c7beb19f Better default logger 2013-11-11 17:16:15 +08:00
Jinzhu 32562b5537 Better Log support 2013-11-11 15:48:31 +08:00
Jinzhu d550315548 Add Transaction Support 2013-11-11 13:16:24 +08:00
Jinzhu 50a1b6e3e5 show sql query log 2013-11-11 11:59:15 +08:00
Jinzhu 9bc11d6637 Support Logger 2013-11-11 11:11:49 +08:00
Jinzhu 9e762a9a30 Try to add logger 2013-11-11 09:10:16 +08:00