|
|
|
MSSQL + Linux + PHP + поиск по CHAR с кирилицей
|
|||
|---|---|---|---|
|
#18+
Делимся опытом. Была задача из под RedHatLinux + PHP соединиться с MS SQL и сделать выборку по текстовому полю типа CHAR c кирилическим значением поиска. Решение было придумано следующим образом: 1. что касается connect то на форуме написано много http://php.ru/manual/ref.pdo-dblib.html https://connect.microsoft.com/SQLServer/feedback/details/541956/pdo-driver-for-sql-server авторyou can use the PDO_ODBC driver to connect to Microsoft SQL Server and Sybase databases, as the native Windows DB-LIB is ancient, thread un-safe and no longer supported by Microsoft. 2. самое сложное было правильно сделать запрос, вот что придумал один разработчик из нашей команды что в итоге и заработало: $find_name = bin2hex(iconv('UTF-8', 'UTF-16LE', 'Пушкин')); $sql = "select * from table_name where find_field = CONVERT(nvarchar, 0x".$find_name.")"; Модератор: Тема перенесена из форума "Microsoft SQL Server". ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 27.03.2014, 10:40 |
|
||
|
|

start [/forum/search_topic.php?author=BSD&author_mode=last_posts&do_search=1]: |
0ms |
get settings: |
8ms |
get forum list: |
19ms |
get settings: |
9ms |
get forum list: |
18ms |
check forum access: |
4ms |
check topic access: |
4ms |
track hit: |
210ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
34ms |
get tp. blocked users: |
1ms |
| others: | 441ms |
| total: | 759ms |

| 0 / 0 |
