Case-sensitive comparison of a character field

In SQL, you apply comparison predicates to column values in the WHERE clause. For example, the following SQL statement applies the predicate = "Acme Rentals" to values in the name column of the companies table to select the company “Acme Rentals.”

SELECT * from companies
  WHERE name = "Acme Rentals";

With the query builder APIs, you apply predicates to entity fields by using methods on the query object. The following Gosu code applies the compare method to values in the Name field of Company entity instances to select the company “Acme Rentals.”

uses gw.api.database.Query 

// Query the Company instances for a specific company. 
var query = Query.make(Company)
query.compare(Company#Name, Equals, "Acme Rentals")

// Fetch the data and print it.
var result = query.select()
for (company in result) {
  print (company.Name)
}

In the result set, the values in the character field exactly match the comparison value that you provide to the compare method, including the case of the comparison value. For example, the preceding query builder code selects only “Acme Rentals,” but not “ACME Rentals.”

Note: In configurations that use primary or secondary linguistic sort strength, the preceding query builder code does not perform a case-sensitive comparison. If either of your PolicyCenter or the relational database that your PolicyCenter uses have these configurations, the result includes both “Acme Rentals” and “ACME Rentals.”

See also