Этот баннер — требование Роскомнадзора для исполнения 152 ФЗ.
«На сайте осуществляется обработка файлов cookie, необходимых для работы сайта, а также для анализа использования сайта и улучшения предоставляемых сервисов с использованием метрической программы Яндекс.Метрика. Продолжая использовать сайт, вы даёте согласие с использованием данных технологий».
Политика конфиденциальности
|
|
|
(Python) При повторном запросе к mysql возвращаются старые данные
|
|||
|---|---|---|---|
|
#18+
Приветствую! * попытался поискать в гугле, решив что стандартная проблема, но подаются или простые инструкции где нет этого, или не то вот простой код Код: python 1. 2. 3. получаю ответ 3L, т.е. 3 строки найдено. Добавляю через myphpadmin еще строку, вызываю Код: python 1. получаю опять 3L пробовал заново cursor создавать - безрезультатно. Помогает только переконнект к базе. Но хотелось бы делать это в одном коннекте, т.к. скрипт будет регулярно обращаться к базе работая по циклу. python 2.7. Хелп Pro-питоноводы... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 04.08.2016, 22:46 |
|
||
|
(Python) При повторном запросе к mysql возвращаются старые данные
|
|||
|---|---|---|---|
|
#18+
А с чего вы взяли, что cursor.execute возвращает количество строк? В стандарте это не определено автор.execute ( operation [, parameters ]) Prepare and execute a database operation (query or command). Parameters may be provided as sequence or mapping and will be bound to variables in the operation. Variables are specified in a database-specific notation (see the module's paramstyle attribute for details). [5] A reference to the operation will be retained by the cursor. If the same operation object is passed in again, then the cursor can optimize its behavior. This is most effective for algorithms where the same operation is used, but different parameters are bound to it (many times). For maximum efficiency when reusing an operation, it is best to use the .setinputsizes() method to specify the parameter types and sizes ahead of time. It is legal for a parameter to not match the predefined information; the implementation should compensate, possibly with a loss of efficiency. The parameters may also be specified as list of tuples to e.g. insert multiple rows in a single operation, but this kind of usage is deprecated: .executemany() should be used instead. Return values are not defined делайте fetchall и получите ваши записи ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 05.08.2016, 06:22 |
|
||
|
(Python) При повторном запросе к mysql возвращаются старые данные
|
|||
|---|---|---|---|
|
#18+
FishHookА с чего вы взяли, что cursor.execute возвращает количество строк? В стандарте это не определено автор.execute ( operation [, parameters ]) Prepare and execute a database operation (query or command). Parameters may be provided as sequence or mapping and will be bound to variables in the operation. Variables are specified in a database-specific notation (see the module's paramstyle attribute for details). [5] A reference to the operation will be retained by the cursor. If the same operation object is passed in again, then the cursor can optimize its behavior. This is most effective for algorithms where the same operation is used, but different parameters are bound to it (many times). For maximum efficiency when reusing an operation, it is best to use the .setinputsizes() method to specify the parameter types and sizes ahead of time. It is legal for a parameter to not match the predefined information; the implementation should compensate, possibly with a loss of efficiency. The parameters may also be specified as list of tuples to e.g. insert multiple rows in a single operation, but this kind of usage is deprecated: .executemany() should be used instead. Return values are not defined делайте fetchall и получите ваши записи да делал я fetchall, там то же. пока помогает Код: python 1. после него уже при выборке будут новые данные ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 05.08.2016, 20:01 |
|
||
|
(Python) При повторном запросе к mysql возвращаются старые данные
|
|||
|---|---|---|---|
|
#18+
тут Код: python 1. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 05.08.2016, 20:03 |
|
||
|
(Python) При повторном запросе к mysql возвращаются старые данные
|
|||
|---|---|---|---|
|
#18+
ErshKUSdb.commit() после него уже при выборке будут новые данные После него новые данные будут в базе, а не только в выборке. Этим подаётся SQL команда COMMIT, означающая, что изменения, сделанные в базе, должны быть сохранены. Без неё они пропадут. Напротив, SQL команда ROLLBACK отменяет изменения, сделанные после последнего COMMIT (нужно при возникновении ошибки в процессе изменения), ей соответствует db.rollback() . Вместо того, чтобы каждый раз делать db.commit(), можно задать db.autocommit (True). ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 09.08.2016, 10:12 |
|
||
|
|

start [/forum/topic.php?fid=23&msg=39286694&tid=1460970]: |
0ms |
get settings: |
9ms |
get forum list: |
9ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
50ms |
get topic data: |
6ms |
get forum data: |
1ms |
get page messages: |
26ms |
get tp. blocked users: |
1ms |
| others: | 267ms |
| total: | 373ms |

| 0 / 0 |
