case-sensitive

Anyone had success using a specific locale for a PostgreSQL database so that text comparison is case-insensitive?

喜你入骨 提交于 2019-12-05 08:53:14
I'm developing an app in Rails on OS X using PostgreSQL 8.4. I need to setup the database for the app so that standard text queries are case-insensitive. For example: SELECT * FROM documents WHERE title = 'incredible document' should return the same result as: SELECT * FROM documents WHERE title = 'Incredible Document' Just to be clear, I don't want to use: (1) LIKE in the where clause or any other type of special comparison operators (2) citext for the column datatype or any other special column index (3) any type of full-text software like Sphinx What I do want is to set the database locale

MAC OS X: How to determine if filesystem is case sensitive?

放肆的年华 提交于 2019-12-05 05:44:18
I have used the statfs(2) system call to get many characteristics of a Mac OS X filesystem, but it doesn't tell me if the filesystem is case-sensitive or not. I need this information as the application I am developing will be moving many files around and I want to detect potential loss of data due to files being moved from a case- sensitive filesystem to a case- insensitive filesystem. Can anyone suggest a way of detecting this? Don J Brady If you're already using stat(2) , then you can easily use pathconf(2) with the _PC_CASE_SENSITIVE selector (result 0 = case-insensitve, 1 = case-sensitive.

Making MySQL IN Clause Case Sensitive

泄露秘密 提交于 2019-12-05 03:26:07
Does anyone know how I can make an IN clause behave in a case sensitive manner? I have seen that COLLATE can be used with LIKE for string searching but I don't know if or how it can be used with IN. For example I want to do something like SELECT * FROM pages_table WHERE topic IN ('Food','NightLife','Drinks') And I want it to return pages where the topic is 'Food' but not those where the topic is 'food' which is currently what happens on this query. Thanks. You can actually use it as you have likely seen in other examples: SELECT * FROM pages_table WHERE CAST(topic AS CHAR CHARACTER SET latin1)

Swift: sort array with alternative comparison

白昼怎懂夜的黑 提交于 2019-12-05 01:46:01
I'd like to sort my swift struct array using another comparison method (like localizedCompare, caseInsensitiveCompare or localizedCaseInsensitiveCompare). The swift standard string array sort function orders all uppercase letters before lowercase letters. Here's my code: import Foundation struct DataStruct { struct Item { let title: String let number: Int } static var items = [ Item(title: "apple", number: 30), Item(title: "Berry", number: 9), Item(title: "apple", number: 18)] } class DataFunctions { func sortItemsArrayTitle() { DataStruct.items.sort { $0.title < $1.title } } } Once called,

How to eliminate duplicate list entries in Python while preserving case-sensitivity?

 ̄綄美尐妖づ 提交于 2019-12-05 00:09:54
问题 I'm looking for a way to remove duplicate entries from a Python list but with a twist; The final list has to be case sensitive with a preference of uppercase words. For example, between cup and Cup I only need to keep Cup and not cup . Unlike other common solutions which suggest using lower() first, I'd prefer to maintain the string's case here and in particular I'd prefer keeping the one with the uppercase letter over the one which is lowercase.. Again, I am trying to turn this list: [Hello,

Force T-SQL query to be case sensitive in MS

雨燕双飞 提交于 2019-12-04 23:00:42
I have a table that originates in an old legacy system that was case senstive, in particular a status column where 's' = 'Schedule import' and 'S' = 'Schedule management'. This table eventually makes its way into a SQL Server 2000 database which I can query against. My query is relatively simple just going for counts... Select trans_type, count(1) from mytable group by trans_type This is grouping the counts for 'S' along with the 's' counts. Is there any way to force a query to be cap sensitive? I have access to both SQL Server 2000 and 2005 environments to run this, however have limited admin

Oracle - Select where field has lowercase characters

别说谁变了你拦得住时间么 提交于 2019-12-04 16:07:56
问题 I have a table, users, in an Oracle 9.2.0.6 database. Two of the fields are varchar - last_name and first_name. When rows are inserted into this table, the first name and last name fields are supposed to be in all upper case, but somehow some values in these two fields are mixed case. I want to run a query that will show me all of the rows in the table that have first or last names with lowercase characters in it. I searched the net and found REGEXP_LIKE, but that must be for newer versions

How can I sort by a table column in varying cases (Oracle)

旧城冷巷雨未停 提交于 2019-12-04 15:37:02
问题 How can I sort a table with a column of varchar2 with characters in varying cases ( UPPER and lower )? For example, when I do an order by of the Name column, I get the following results: ANNIE BOB Daniel annie bob What I want is something like this: ANNIE annie BOB bob Daniel 回答1: Use lower(field) , e.g. select * from tbl order by lower(name) If you need to address special characters for non-english languages then the other answers about NLSSORT may be what you need. If you don't I would try

How to add lowercase field to NSURLRequest header field?

三世轮回 提交于 2019-12-04 13:13:40
I'm getting pretty frustrated figuring out how to add a lowercase header field to an NSMutableURLRequest. NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:MyURLString]]; [urlRequest setValue:@"aValue" forHTTPHeaderField:@"field"]; In the example above, "field" gets switched to "Field," since the header field names are case insensitive. I would think this shouldn't happen, but it does. The API I am working with is case sensitive, so my GET request is ignored. Is there any way to override the case switch? HTTP header fields are supposed to be case

Is there a way to force case sensitivity in MySQL / Rails for a single find?

早过忘川 提交于 2019-12-04 10:58:43
问题 I'm doing some searching of tags, and some users like "cat" while others like "Cat" Go figure... Anyways, is there a way to force a particular find to be case sensitive? Such as: Tag.find(:some-special-option-here) Any ideas? 回答1: You can also do a case-sensitive search without changing your column properties. SELECT * FROM mytable WHERE myfield='Value' This query matches: Value value VALUE vAlUe and so on While... SELECT * FROM mytable WHERE BINARY myfield='Value' Matches only: Value 回答2: