Firefox has a SQLite Manager extension. In this extension, I make a request 1 in 1 as I do in the program, but unfortunately in the program it shows that the list is empty. And in the extension shows the entire list. Here is my request

SELECT * FROM goods WHERE lower(name) LIKE '%прочий%' OR lower(descr) LIKE '%прочий%' ORDER BY (lower(name) LIKE '%прочий%') DESC LIMIT 0, 20 

here is the answer from the extension. enter image description here

Here is the code from the program:

enter image description here

to note, if I make a request with such text - “about”, then the list comes from the base, everything is fine.

here is the code

 // получение товаров из поиска func getGoodsItemForSearch(offSet: Int, searchBarText: String)-> [GoodsItem] { openBase() // offSet для постраничной загрузки. // searchBarText введенный текст в поиске. var where1 = "" let search1 = searchBarText.replacingOccurrences(of: "'", with: "\'\'", options: .literal, range: nil) if !searchBarText.isEmpty { let search = search1.lowercased() where1 += "WHERE lower(name) LIKE '%\(search)%' OR lower(descr) LIKE '%\(search)%' ORDER BY (lower(name) LIKE '%\(search)%') DESC" } let count = getCountInTable(table: "goods"); let needCount = offSet * API.GET_MAX_SIZE_FROM_PAGE let startCount = offSet == 1 ? 0 : (needCount - API.GET_MAX_SIZE_FROM_PAGE) //API.GET_MAX_SIZE_FROM_PAGE = 20 var limit = " LIMIT " if count < needCount { limit += String(startCount) + ", " + String(count-startCount) } else { limit += (String(startCount) + ", " + "\(API.GET_MAX_SIZE_FROM_PAGE)") } let resultSet : FMResultSet! = database!.executeQuery("SELECT * FROM goods \(where1) \(limit)", withArgumentsIn: nil) print("SELECT * FROM goods \(where1) \(limit)") var items:[GoodsItem] = [] while resultSet.next() { let item = GoodsItem() item.name = resultSet.string(forColumn: "name") item.parent_id = resultSet.string(forColumn: "parent_id") item.price = resultSet.double(forColumn: "price") item.price_format = resultSet.string(forColumn: "price_format") item.ammount = resultSet.string(forColumn: "ammount") item.descr = resultSet.string(forColumn: "descr") item.id_serv = resultSet.string(forColumn: "id_serv") // recipe item.recipe = resultSet.string(forColumn: "recipe") item.img = resultSet.string(forColumn: "img") item.measure = resultSet.string(forColumn: "measure") items.append(item) } closeBase() print("items count goods where name = \(searchBarText) = \(items.count)") return items } 
  • code can not be a screenshot - Max Mikheyenko
  • Of course. Already added. above in the description. - Kerim Khasbulatov
  • in the office of a friend who has the same request on Android, his result shows the same as in my extension. - Kerim Khasbulatov
  • you can still print'y lay out for confidence - cerberus
  • first print SELECT * FROM goods WHERE lower (name) LIKE '% other%' OR lower (descr) LIKE '% other%' ORDER BY (lower (name) LIKE '% other%') DESC LIMIT 0, 20 second print items count goods where name = other = 0 - Kerim Khasbulatov

0