Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions ascii.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ func (c *STableField) IsSearchable() bool {
return c.spec.IsSearchable()
}

func (c *STableField) GetWidth() int {
return c.spec.GetWidth()
}

func getTableField(f IQueryField) *STableField {
if gotypes.IsNil(f) {
return nil
Expand All @@ -47,10 +51,10 @@ func getTableField(f IQueryField) *STableField {
}
}

func IsFieldText(f IQueryField) bool {
func IsLongFieldText(f IQueryField) bool {
tf := getTableField(f)
if tf != nil {
return tf.IsText() && tf.IsSearchable()
return tf.IsText() && tf.IsSearchable() && tf.GetWidth() == 0
}
return false
}
Expand Down
2 changes: 1 addition & 1 deletion backends/dameng/conditions.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (t *SDamengEqualsCondition) WhereClause() string {
// Equals filter conditions
func (dameng *SDamengBackend) Equals(f sqlchemy.IQueryField, v interface{}) sqlchemy.ICondition {
// log.Debugf("field %s isFieldText: %v %#v", f.Name(), sqlchemy.IsFieldText(f), f)
if sqlchemy.IsFieldText(f) {
if sqlchemy.IsLongFieldText(f) {
c := SDamengEqualsCondition{sqlchemy.NewTupleCondition(f, v)}
return &c
} else {
Expand Down
2 changes: 1 addition & 1 deletion backends/dameng/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestQuery(t *testing.T) {
t.Run("query selected fields varchar ", func(t *testing.T) {
testReset()
q := testTable.Query(testTable.Field("col0")).Equals("col0", "abce")
want := `SELECT "t1"."col0" AS "col0" FROM "test" AS "t1" WHERE TEXT_EQUAL("t1"."col0" , ? )`
want := `SELECT "t1"."col0" AS "col0" FROM "test" AS "t1" WHERE "t1"."col0" = ? `
testGotWant(t, q.String(), want)
})

Expand Down