Русское сообщество fluxbb

Быстрый лёгкий надёжный форумный движок

Вы не вошли.

Объявление

Вы можете внести свой вклад в содержание сайта. Жертвователи попадут в почетную группу "Спонсоры". Поддержать сайт.

#1 2010-05-26 21:31:06

systech
Участник
Из Вологда
Зарегистрирован: 2010-05-26
Сообщений: 2

PDO_SQLite3

Нашёл когда-то мод:

##
##
##        Mod title:  PDO_SQLite dblayer
##
##      Mod version:  1.0
##   Works on PunBB:  1.2.12 was tested; Should work with 1.2.x
##     Release date:  2006-09-14
##           Author:  Robert Diamond ([email protected])
##
##      Description:  Adds support for SQLite3 databases (through PDO and PDO_SQLite)
##
##   Affected files:  viewforum.php
##                    search.php
##                    install.php (optional)
##                    include/dblayer/common_db.php
##                    admin_maintenance.php
##                    admin_index.php
##                    
##       Affects DB:  Yes
##
##            Notes:  Require PDO and PDO_SQLite.
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

Пробовал его довести до ума и прикрутить к разным версиям punbb, fluxbb
Сейчас тестирую локально на XAMPP с версией v1.4RC3 - вот что получилось:

fixed:
fluxbb_v1.4RC3_PDO_SQLite3.zip

При установке, выберите тип PDO_SQLite (SQLite3), в качестве имени базы введите название файла - например base.s3db (в случае использования DENWER или XAMPP если не указать путь, то файл создаётся в корне форума ). Расширение файла .s3db я использую чтобы открывать этот файл с помощью программы SQLite Administrator

На реальном хостинге тестировался - при установке нужно указать папку в которой есть права на запись (в корне форума таких прав по умолчанию нет, я при тестах ставил базу в папку cache)

Иногда при интенсивном кликанье по любым ссылкам (не дожидаясь загрузки страницы и ответа) появляется ошибка

An error was encountered
Error: Unable to update online list.

Подобная ошибка при тестировании в XAMPP не проявляется.

Я так понимаю, затык происходит в функции check_cookie(&$pun_user)?

Версии PDO Driver for SQLite 3.x:

На хостинге: SQLite Library 3.4.2

На XAMMP: SQLite Library 3.3.7undefined

UPD:
Судя по всему вся проблема с ошибкой из-за блокировки базы, не обратил внимание, что в комментах автор об этом говорит

pdosqlite3.php

    // Why do we HAVE to store that fetchAll in $both_data?
    // Once you fetch/fetchAll, you have to execute a PDOStatement over again, causing a number of follies!
    // It's particularly bad when the god dam mother fucking php script never uses the fucking free_result function, and tried to fucking well query to high hell and back forcing the PDO implementation to sit on it's ass until it decides that the SQLite3 database is locked, mother fucker, eh?
    // Clearly I'm not happy about that... :P

Редактировался systech (2010-05-28 08:50:23)

Offline

#2 2010-05-27 10:20:39

artoodetoo
Admin by chance
Зарегистрирован: 2008-09-09
Сообщений: 887
Сайт

Re: PDO_SQLite3

комментарии в коде жгучие smile

и какой мы сделаем вывод? imho, sqlite вообще не предназначен для сетевой работы. его цель - дать sql-интерфейс для "встроенных приложений" с минимальными накладными расходами. другими словами - для персонального использования.

с другой стороны, если вы найдете workaround чтобы эти ошибки не возникали, было бы здорово. но ставить на production в сеть я бы в любом случае не советовал. разве что во внутренней сетке…


There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors.

Offline

#3 2010-05-27 16:02:59

systech
Участник
Из Вологда
Зарегистрирован: 2010-05-26
Сообщений: 2

Re: PDO_SQLite3

Как ни странно, но проблема была из-за параметра

PRAGMA synchronous

Глюки стали реже.

Вычитал рекомендации использовать параметр

PRAGMA read_uncommitted

read_uncommitted — Enables reads of uncommitted data from database cache

http://using-sqlite.labs.oreilly.com/re193.html

Description

The read_uncommitted pragma is used to set or get the shared cache isolation method.

If the same process opens the same database multiple times, SQLite can be configured to allow those connections to share a single cache instance. This is helpful in very low-memory situations, such as low-cost embedded systems.

This pragma controls which locks are required to access the shared cache. Setting this pragma relaxes some of the locking requirements and allows connections to read from the cache, even if another connection is in the middle of a transaction. This allows better concurrency, but it also means that readers may see data that the writer has not committed.

The read_uncommitted pragma is only applicable to systems that use shared-cache mode, which is normally not used on desktop systems. If you are using shared cache mode and may have a need for this pragma, please see the source code and on-line documentation for more information.

Добавил в код - сейчас тестирую такой вариант:

pdosqlite3.php

PS: ОС - Убунту

PS2: Где то вычитал что есть проблема у SQLite с блокировками при размещении базы на NFS причём на FreeBSD и других проблем нет, а вот с Linux есть - это надо только проверить

Offline

Подвал доски

Под управлением FluxBB. Хостинг Hostens