Skip to content

Commit 214a4b7

Browse files
committed
Uncommented TestToSQL test case (issue #81 resolved)
1 parent 6ca3ece commit 214a4b7

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

tests/sql_builder_test.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -859,13 +859,12 @@ func TestToSQL(t *testing.T) {
859859
})
860860
assertEqualSQL(t, `UPDATE "custom_update_table" SET "updated_at"=?,"name"='patched',"age"=99 WHERE id = 200`, sql)
861861

862-
// https://github.com/oracle-samples/gorm-oracle/issues/81
863-
// sql = DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
864-
// return tx.Clauses(clause.Update{Table: clause.Table{Name: "custom_update_table"}}).
865-
// Where("id = ?", 200).
866-
// Updates(&User{Name: "patched", Age: 99})
867-
// })
868-
// assertEqualSQL(t, `UPDATE "custom_update_table" SET "updated_at"=?,"name"='patched',"age"=99 WHERE id = 200 AND "custom_update_table"."deleted_at" IS NULL`, sql)
862+
sql = DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
863+
return tx.Clauses(clause.Update{Table: clause.Table{Name: "custom_update_table"}}).
864+
Where("id = ?", 200).
865+
Updates(&User{Name: "patched", Age: 99})
866+
})
867+
assertEqualSQL(t, `UPDATE "custom_update_table" SET "updated_at"=?,"name"='patched',"age"=99 WHERE id = 200 AND "custom_update_table"."deleted_at" IS NULL`, sql)
869868

870869
// update
871870
sql = DB.ToSQL(func(tx *gorm.DB) *gorm.DB {

tests/update_test.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,15 +1163,3 @@ func TestUpdateCustomDataType(t *testing.T) {
11631163
t.Errorf("failed to update custom data type field: %v", err)
11641164
}
11651165
}
1166-
1167-
func TestUpdateWithCustomTableName(t *testing.T) {
1168-
sql := DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
1169-
return tx.Clauses(clause.Update{
1170-
Table: clause.Table{Name: "custom_update_table"},
1171-
}).Where("id = ?", 200).
1172-
Updates(&User{Name: "patched", Age: 99})
1173-
})
1174-
1175-
assertEqualSQL(t, `UPDATE "custom_update_table" SET "updated_at"=?,"name"='patched',"age"=99 WHERE id = 200 AND "custom_update_table"."deleted_at" IS NULL`, sql)
1176-
1177-
}

0 commit comments

Comments
 (0)