Saturday, August 27, 2016

Re: iregex doesn't work properly

Not sure that problem is related to character_set_server due to highest priority of create table option.  I'm using postgres as default.  I'm proposing to check latin chars and turn on mysql debugging  in case of your permission. 
  localization coding  of MySql is  here http://dev.mysql.com/doc/refman/5.7/en/charset-syntax.html


 At this moment I propose do next : 
1)  check log for sql request from django to Mysql 
2) execute next sql from mysql :    SELECT id from Order_process WHERE step_description REGEXP BINARY '^заказ роутера%';


 Why are you not using raw string in your regex ?


Many thanks,

Serge


+380 636150445
skype: skhohlov

On Sat, Aug 27, 2016 at 8:13 PM, Denis Yu <denis.yugay@gmail.com> wrote:
Sergiy,

Thank you for reply

I checked following parameters:

mysql> show create table clients_order_process; (clients_order_process - it's my table)

| clients_order_process | CREATE TABLE `clients_order_process` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `step` int(11) NOT NULL,
  `step_description` longtext NOT NULL,
  `date_step` datetime NOT NULL,
  `order_id` int(11) NOT NULL,
  `manager_id` int(11),
  PRIMARY KEY (`id`),
  KEY `clients_order_proces_order_id_1eb697bf_fk_clients_order_id` (`order_id`),
  KEY `clients_order_process_8784215c` (`manager_id`),
  CONSTRAINT `clients_order_proces_order_id_1eb697bf_fk_clients_order_id` FOREIGN KEY (`order_id`) REFERENCES `clients_order` (`id`),
  CONSTRAINT `clients_order_process_manager_id_f3e3fa60_fk_auth_user_id` FOREIGN KEY (`manager_id`) REFERENCES `auth_user` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=249 DEFAULT CHARSET=utf8 |


mysql> show variables like 'character_set%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client     | utf8                       |
| character_set_connection | utf8                       |
| character_set_database   | utf8                       |
| character_set_filesystem | binary                     |
| character_set_results    | utf8                       |
| character_set_server     | latin1                     |
| character_set_system     | utf8                       |
| character_sets_dir       | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0,01 sec)


so, I found  | character_set_server     | latin1 
is this the problem?





суббота, 27 августа 2016 г., 19:28:18 UTC+6 пользователь Sergiy Khohlov написал:

Try to check this via mysql shell. It will be nice to know codepage at system, database and django project. Have you checked this with Latin charset already ?


27 серп. 2016 16:06 "Denis Yu" <denis...@gmail.com> пише:
Hi,

Someone please, help to resolve my problem with iregex !

using Django 1.9
mysql Server version: 5.7.13-0ubuntu0.16.04.2 (Ubuntu)
python 2.7

I got the record in mysql in table Order_process:

+-----+------+---------------------------+---------------------+----------+------------+
| id  | step | step_description          | date_step           | order_id | manager_id |
+-----+------+---------------------------+---------------------+----------+------------+
| 241 |    1 | заказ роутера             | 2016-08-21 11:03:16 |      170 |          1 |
+-----+------+---------------------------+---------------------+----------+------------+
 
next, I'd like to get thi record by queryset:
    str_iregex = '^заказ роутер.$'
    orders = Order_process.objects.filter(step_description__iregex = str_iregex , step = 1).order_by('-id')

But the got no result.
pls help








--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8da615e3-c990-4359-9851-32d12b5d9fb0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b909b7c6-d8f3-41e5-99d5-19708446f4df%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CADTRxJMOgHOAyqJSjBSXEBMDtUARSvxrfDM_kZY%3Dy009O2_qaA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment