Drupal-SQLite

Please let our ADS show!

This sites offers only FREE software and it's supported by a few advertisement boxes (no intrusive popups).
Please:

  • disable your AdBlocker by adding CoolSoft website to whitelist
  • give the proper cookie consent
  • enable JavaScript for this website

This seconds wait is to let you update your browser configuration...

Ok, I've done the required changes... now show me your content!
!!! Please enable JavaScript !!!

Introduzione

Drupal-SQLite è un progetto per rendere Drupal funzionante con un database SQLite.

SQLite è un database leggero, veloce, di pubblico dominio e multipiattaforma.
E' usato da molti importanti progetti opensource; solo per nominarne uno: Mozilla Firefox.

Perchè ne ho bisogno?

Beh, molti hosting provider forniscono PHP 5.2 o successivi gratuitamente, mentre per avere un database MySQL è necessario pagare una (piccola) somma. Se ne vale la pena per siti medio grandi, con centinaia o migliaia di utenti, per siti medio-piccoli (come questo) un database MySQL è uno spreco.

Con Drupal-SQLite è possibile configurare rapidamente un sito Drupal che funzioni immediatamente non appena installato, dato che tutto il DB è contenuto in un singolo file.
Supponi di essere un theme designer o uno sviluppatore di moduli: puoi distribuire il tuo tema in un unico .zip o .tar.gz con un overhead di soli 1,5 Mb.

Questo thread mi ha dato la spinta per iniziare.
In questo lungo post diversi bravi sviluppatori si sono impegnati per aggiungere il supporto a SQLite per Drupal 4.7, 5 e quindi 6. Il thread è ora inattivo dato che la maggioranza di loro si è spostata alla versione 7 di Drupal, che avrà SQLite come cittadino di prima classe tra i DB supportati. Dato però che la transizione alla versione 7 richiederà diverso tempo, Drupal-SQLite può essere usato immediatamente come valida alternativa a Drupal 6.

Alternative

Esistono in rete diverse versioni di Drupal con supporto SQLite, ma nessuna di questa ha soddisfatto le mie aspettative.

Speedtech.it

(link attualmente disattivo)
Funzionante e basata su una verisone di Drupal 5.6 (vecchiotta) modificata per SQLite.

Pro:

  • funziona (questo sito l'ha usata fino a 6 mesi fa)

Contro:

  • è una versione 5.6 di Drupal, quindi un po vecchia
  • non usa i PDO, quindi il supporto ai DB SQLite è limitato alle versioni 2.x (che non sono così performanti come le 3.x)
  • non ci sono aggiornamenti da tempo

Siren

Profonda (forse troppo) patch a Drupal 6.x

Pro:

  • supporto ai PDO, quindi SQLite versione 3.x
  • altri database oltre a SQLite

Contro:

  • modifiche molto profonde al codice core di Drupal
    Dal sito ufficiale: "According to the needs of PDO and Oracle drivers implementation, ALL core queries and some APIs are hacked for compatibility concern."
  • anche se basato su Drupal (ver. 6.4) è ora completamente separato da esso; ciò significa che non potrete usare gli update di Drupal.

Drupal-SQLite

Ecco quindi i pro di Drupal-SQLite:

  • costruito su Drupal 6.10 (e successive, leggi punto seguente)
  • nessun core file modificato (eccetto uno, usato solo durante l'installazione: includes/install.inc.php) (*)
  • usa PDO (anche se l'originale Drupal non lo fa), quindi supporto a SQLite 3.x
  • supporta una gran numero di moduli e temi Drupal senza modifica

Drupal-SQLite è disponibile in due versioni:
- un archivio .zip pronto per essere scompattato nella radice del vostro server web
- un .patch file da applicare ai sorgenti di Drupal 6.x

Dopo aver installato la versione che preferite, aprite con il browser la pagina index.php del vostro nuovo sito Drupal e siete pronti ad iniziare.

(*) Drupal-SQLite modifica questo file per aggiungere alcune frasi di aiuto all'installazione con database SQLite. Dopo l'installazione questo file non è più usato quindi può essere tranquillamente sovrascritto da aggiornamenti successivi. Gli altri file modificati da Drupal-SQLite sono file aggiuntivi rispetto a Drupal standard.
Ciò significa che sarà possibile installare i successivi aggiornamenti ufficiali di Drupal senza "rompere" Drupal-SQLite.

Requisiti

Drupal-SQLite richiede PHP5 con il supporto PDO-SQLite abilitato.
Questo è fornito tramite l'estensione php_pdo_sqlite.dll(win) or php_pdo_sqlite.so(linux).

Per verificare che il supporto sia abilitato, create un file phpinfo.phpcontenente:

<?php phpinfo(); ?>

Aprite questo file nel browser e verificate che la sezione pdo_sqlite esista e sia abilitata.

NOTE to XAMPP users:
XAMPP 1.7.0 comes with pdo_sqlite disabled by default. To enable it:

  • open C:\xampp\apache\bin\php.inifile
  • find the row containing
    ;extension=php_pdo_sqlite.dll
  • remove the leading ;to enable PDO-SQLite
  • restart Apache

Come installare Drupal-SQLite

Scegliete il file da scaricare (in base alla soluzione di hosting e alle vostre preferenze):

  • Archivio ZIP
    Questa è la soluzione più "comoda", ed è la migliore sia per gli hosting su piattaforma Windows che per quelli su piattaforma Linux.
    L'archivio contiene la versione base di Drupal (indicata nel nome del file) già modificata per l'utilizzo di SQLite.
    Scaricate il file e scompattatelo nella cartella radice del vostro sito.
    Ora aprite con il browser il file install.php e seguite le istruzioni.
  • File .patch
    Dato che l'applicazione di file .patch su Windows non è proprio immediata, questa versione è dedicata agli utenti Linux esperti (ma anche Windows ovviamente).
    Scaricate il .patch file della versione Drupal che state per modificare, quindi applicate la patch al source-tree.

Ora aprite con il browser il file install.php e seguite le istruzioni, ricordando di:

  • selezionare il profilo Drupal-SQLite nella prima pagina, in modo da avere una configurazione ottimizzata
  • scegliere sqlite come "database type" nel blocco "basic options" della pagina successiva (purtroppo non c'è modo di forzare questa scelta attraverso il profilo)

Note di sicurezza

Il vostro database è ora un singolo file, per default sites/default/*.s3db.
Dovreste proteggere l'accesso a questo tipo di files per evitarne il download diretto.
Drupal-SQLite ha già preconfigurato nella cartella "sites/default" un file .htaccess per Apache che nega l'accesso a tutti i file *.s3db.
Se usate un file diverso oppure se non usate Apache, per favore proteggete questo fali dall'accesso esterno.

Moduli base

Drupal-SQLite fornisce un profilo di installazione (la prima pagina che appare durante l'install) che disabilita alcuni moduli base per funzionare più velocemente e ridurre il carico sul DB.
Questi moduli sono, ad esempio, dblog and syslog.
I moduli abilitati di default sono: 'color', 'comment', 'help', 'menu', 'taxonomy' e 'sqlitetools'.

Modulo sqlitetools

Dato che il database è ora un file singolo, è molto semplice farne un backup/restore tramite un semplice copia/incolla.
Per Drupal-SQLite ho creato il modulo sqlitetools (disponibile nell'area download) che permette di fare il backup del database corrente in un file ZIP e viceversa per il restore.
Sqlitetools permette inoltre di eseguire una pulizia del database (VACUUM) per liberare lo spazio inutilizzato.

Altri moduli aggiuntivi

Come detto Drupal-SQLite è una patch "non invasiva" a Drupal; per questo motivo dovrebbe funzionare correttamente con qualsiasi modulo che acceda al database tramite le funzioni di Drupal.
In alcuni casi particolari gli sviluppatori di moduli devono ricorrere a query SQL specifiche per il tipo di database attivo; per fare ciò solitamente includono un costrutto switch nel loro codice, come questo (dal modulo xmlsitemap):

switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
      $query .= "LEFT JOIN {url_alias} ua ON ua.src = ('node/' || '%d')";
      break;
    case 'pgsql':
      $query .= "LEFT JOIN {url_alias} ua ON ua.src = CONCAT('node/', CAST(%d AS VARCHAR))";
      break;
}

Come potete vedere una parte della query è composta diversamente in base al tipo di database attivo e, peggio ancora, non esiste un caso "default:" che metta almeno un errore nella pagina. Nel nostro caso $GLOBALS['db_type'] == 'sqlite', quindi nessun codice è eseguito e la query risulta essere incompleta.

Nell'esempio la soluzione è semplice:

switch ($GLOBALS['db_type']) {
    case 'mysql':
    case 'mysqli':
    case 'sqlite':
      $query .= "LEFT JOIN {url_alias} ua ON ua.src = ('node/' || '%d')";
      break;
    case 'pgsql':
      $query .= "LEFT JOIN {url_alias} ua ON ua.src = CONCAT('node/', CAST(%d AS VARCHAR))";
      break;
}

Come vedete il codice SQL è lo stesso di MySQL.

Il mio suggerimento è: prima di installare un modulo, cercate nei suoi sorgenti (grep per gli amici Linuxiani) la stringa 'mysql'o 'pgsql'e verificate che si tratti di un costrutto switch.
Se lo trovate, esaminate il codice e cercate di sistemarlo in modo che funzioni anche con SQLite; altrimenti mandate una segnalazione agli sviluppatori del modulo stesso.
Ok ok, so che potrebbero rispondervi che SQLite non è un database supportato (lo farei anche io ;) ), ma in molti casi il fix è molto semplice e si riduce a qualche riga.

Elenco moduli funzionanti

Per comodità ecco una lista di moduli dei quali posso confermare il funzionamento senza modifiche (molti di loro sono in uso in questo sito).
Se avete provato qualche modulo non listato, mandatemi il nome e la versione e li includerò in questa lista.

Modulo Versione Note
admin_menu 6.x-1.3  
blockquote 6.x-1.0  
captcha 6.x-1.0  
cck 6.4-2.4  
comment_notify 6.x-1.2  
devel 6.x-1.17 (vedi questo commento)
dhtml_menu 6.x-3.4  
fckeditor 6.x-2.0-alpha5  
geshifilter 6.x-1.2  
languageicons 6.x-1.1  
pathauto 6.x-2.x-dev  
permalink 6.x-1.1  
poormanscron 6.x-1.0  
potx (Translation Template Extractor) 6.x-3.0  
service_links 6.x-1.0  
taxonomy_dhtml 6.x-1.0-rc3  
token 6.x-1.11  
wysiwyg 6.x-2.0 + FCKeditor 2.6.4.1

Moduli non funzionanti

I moduli seguenti non funzionano immediatamente ma richiedono delle modifiche al codice.
Queste modifiche possono interessare poche linee (rilevanza=1) fino ad una importante riscrittura del modulo (rilevanza=5).

Modulo Versione Relevanza patch
date 6.x-2.3 5

Contributi e ringraziamenti

  • Guida all'installazione di Drupal-SQLite su Altervista (di Roberto Capuzzo, aka robocap)
    Guida pratica passo passo, completa di screenshots, per l'installazione di un sito Drupal-SQLite su spazio web Altervista.
    (ringrazio l'autore sia per la guida che per il permesso di pubblicarla)
  • Dmitri Schamschurko
    Grande aiuto nel debugging ed ottimizzazione nelle funzioni di modifica tabelle SQLite in database.sqlite.inc.
    Questo lavoro ha permesso il supporto del modulo CCK in Drupal-SQLite-6.13-1.2
Version history 

Drupal-SQLite-6.25-1.5, 2012-02-29

Drupal-SQLite-6.24-1.5, 2012-02-03

Drupal-SQLite-6.22-1.5, 2011-06-02

Drupal-SQLite-6.20-1.5, 2010-12-16

  • Drupal official version 6.20

Drupal-SQLite-6.19-1.5, 2010-08-12

Drupal-SQLite-6.17-1.5, 2010-06-03

  • Drupal official version 6.17

Drupal-SQLite-6.16-1.5, 2010-03-05

  • Drupal official version 6.16
    This release fixes security vulnerabilities.
    Sites are urged to upgrade immediately after reading the official security announcement:
    http://drupal.org/drupal-6.16

Drupal-SQLite-6.15-1.5, 2010-01-07

  • Drupal official version 6.15
  • Optimized query rewriting by adding shortcut returns after a successful rewrite.
  • New core rewrite rule for cache and update modules ("TRUNCATE TABLE" SQL commands).
  • Fixed an error during setup that causes install.php not use the values of "Site Name" and "Administrator username" fields. The default values were used instead.

Drupal-SQLite-6.14-1.4, 2009-10-04

  • Drupal official version 6.14
  • New query rewriting system: it allows Drupal-SQLite to rewrite SQL queries just before their execution, without the needing to patch (core) modules.
    Rewrite rules are contained into two new files:
    • database.sqlite.core-patches.inc
      this file is mantained by CoolSoft and will include rewrite rules for core modules and for widely used ones ;) (like devel)
    • database.sqlite.user-patches.inc (optional)
      here you could add rewrite rules for all other modules
  • Drupal DB functions "db_add_unique_key" and "db_remove_unique_key" are now supported.
  • Workaround for SQLite not returning short column names for queries with JOIN or GROUP BY clauses.
  • Added support for SQL function STDDEV (thanks again Dmitri)

Drupal-SQLite-6.13-1.3, 2009-08-06

  • Fixed a bug in _db_query function which caused multiple/nested queries to fail.

Drupal-SQLite-6.13-1.2, 2009-07-15

  • Bug fixing and code cleanup in SQLite table schema management functions: db_column_exists, db_create_table_sql, _db_create_index_sql,  _db_alterTable, _db_introspectSchema.
    Thanks to Dmitri Schamschurko for his great help and feedback.
  • CCK module (cck-6.4-2.4) now works with Drupal-SQLite.

Drupal-SQLite-6.13-1.1, 2009-07-02

  • Drupal official version 6.13, see here for detailed changes

Drupal-SQLite-6.12-1.1, 2009-05-14

  • Drupal official version 6.12

Drupal-SQLite-6.11-1.1.1, 2009-05-09

This is only a repackage of the previous archive version, due to missing folders in drupal-sqlite-6.11-1.1.zip file.
Missing folders were:

  • /modules/color/images
  • /sites
  • /themes/garland/images

I'm sorry for that <:)

Drupal-SQLite-6.11-1.1, 2009-05-05

Drupal-SQLite-6.10-1.0, 2009-03-21

  • Drupal official version 6.10
  • First public release

Download

Drupal-SQLite è presente su SourceForge all'indirizzo:
Get Drupal-SQLite at SourceForge.net. Fast, secure and Free Open Source software downloads http://sourceforge.net/projects/drupal-sqlite/

Le versioni di sviluppo sono accessbili tramite SVN, sempre su SourceForge, con il comando:
svn co https://drupal-sqlite.svn.sourceforge.net/svnroot/drupal-sqlite/trunk drupal-sqlite

drupal-sqlite-6.25-1.5.tar.gz
Descrizione Fully patched version (compressed TAR archive)
Release date 2012-Feb-29 Dimensione 1,082,929 bytes
MD5 6bec33f490823b60e928e6a7900a5b16
SHA1 db7c79203c0ab277356863cbd551646ecefaf7fb
SHA256 63f4c6710cc3fd87458862a879520935c4087365cb181838943f876f28593caa
Open virus check report
drupal-sqlite-6.25-1.5.zip
Descrizione Fully patched version (compressed ZIP archive)
Release date 2012-Feb-29 Dimensione 1,280,368 bytes
MD5 ab988f79fcc70682c111fedcd06c598d
SHA1 080b96b249ae57924feff73741b816c42a1bc07d
SHA256 1df6ccd3bb4fc69cc638ecdd1dffaf090dead3d48e0bb30359051db01d9939df
Open virus check report
drupal-sqlite-6.25-1.5.diff
Descrizione Patch file for Drupal sources
Release date 2012-Feb-29 Dimensione 72,496 bytes
MD5 6fff775f01125f3a206a32b99e4b9447
SHA1 944fe43f9f9e0376d2c5714525bc9f41b8ec62da
SHA256 7d61d8c6aaa832b5fa19013216c62c0b0d45b59deda14b3cf174e577a3e545e1
Open virus check report
sqlitetools-6.x-1.1.tar.gz
Descrizione sqlitetools module (compressed TAR archive)
Release date 2009-Maggio-05 Dimensione 54,803 bytes
MD5 5f6ef9d960a8e3d8a7e39ea8034c64cb
SHA1 1f5244d040a8cad02d95cde7389b918ab6887640
SHA256 67fddb3e965fb62a887e7da697ae6f6e79d1d3668f8b4fb99eb48afb62d8e804
Open virus check report
sqlitetools-6.x-1.1.zip
Descrizione sqlitetools module (compressed ZIP archive)
Release date 2009-Maggio-05 Dimensione 56,937 bytes
MD5 92b61dad1c29e4700526435c90bcb04f
SHA1 7eb1867f2f8cc4692e20e6ef558f087fd2cfe459
SHA256 9dffc2fe97d18d63614dd6659866de471b1f9528a94d1c514ddd957373aa77c6
Open virus check report
Installazione_Drupal-SQLite_su_Altervista.pdf
Descrizione Istruzioni per linstallazione su www.altervista.org
Release date 2009-Lug-16 Dimensione 173,765 bytes
MD5 fcad99e64318d1826917fe1f2c3ad779
SHA1 b3a0c82ca37399ee09d6d508963564beedfb1da4
SHA256 5d6d36cdd580a10957c17fa66108635f372dc4c77aeaa444a7426999f63279cd
Open virus check report

Commenti

Pagine

Lo so, capisco.
Purtroppo però, da parte mia non posso fare un gran chè: lo strato database di Drupal-SQLite per SQLite è pressochè completo. Il problema è che alcuni moduli (tra cui View) fanno ampio uso di query customizzate per il database correntemente in uso.

Gli sviluppatori di questi moduli ovviamente testano il loro codice solo sui DB ufficialmente supportati, quindi MySQL e PostgreSQL (come spiego nella scheda).

Le soluzioni possibili sono:

  1. convincere gli sviluppatori di View a scrivere codice anche per SQLite (quasi impossibile)
  2. fare un fork del modulo e modificarselo a mano (difficile e complicata da manutenere, dato che si dovrebbe mantenerla allineata alla versione ufficiale di View)

La situazione cambierà in futuro con Drupal 7, dove SQLite sarà supportato ufficialmente.

I'm getting errors with RealName module (http://drupal.org/project/realname). When I go to 'Recalculate names' tab and click 'Rebuild names', I'm getting this:

  • warning: PDO::prepare() [pdo.prepare]: SQLSTATE[HY000]: General error: 1 near "TRUNCATE": syntax error in /var/www/minuteware.net/htdocs/includes/database.sqlite.inc on line 218.
  • user warning: near "TRUNCATE": syntax error
    query: TRUNCATE realname in /var/www/minuteware.net/htdocs/sites/all/modules/realname/realname.admin.inc on line 482.

Seems to be just a warning, the recalculation seems to work fine. Could you please shed some more light onto this warning message.

That's because TRUNCATE is not a supported keyword in SQLite (see here).

If you look file database.sqlite.core-patches.inc, there's a core patch (applied to all queries) that changes TRUNCATE TABLE xxx to DELETE FROM xxx.

That said, your problem is that RealName use the short (and worst) TRUNCATE xxx command form instead of TRUNCATE TABLE xxx, so the patch will not happen.

Now you can:

  1. add your own patch to a file named database.sqlite.user-patches.inc (using database.sqlite.user-patches.sample as starting point)
  2. ask RealName developers to use the correct TRUNCATE TABLE xxx command form

 

  • warning: PDO::prepare() [pdo.prepare]: SQLSTATE[HY000]: General error: 1 no such table: interwiki in /includes/database.sqlite.inc on line 218.
  • user warning: no such table: interwiki
    query: SELECT iw_prefix, iw_url, iw_rel, iw_local from interwiki in /modules/interwiki/interwiki.module on line 476.

I like what you have done, and thank you for putting effort into this. I am not much of a developer and I have never dealt with sqlite much. when installing the interwiki module (and I am aware the 6.x version is a development module) the download, extracting, and enabling seems to work, but when i go to admin/settings/interwiki iget the error listed above. I did some investigation and found line 218 in the database.sqlite.inc and it looks like this:

$last_result = $stmt = $active_db->prepare($query);

and line 476 in interwiki.module looks like this:

$result = db_query("SELECT iw_prefix, iw_url, iw_rel, iw_local from {interwiki}");

I am not entirely sure what I am looking at or what can be done (if anything) to get this to function with drupal-sqlite. I would appreciate any sugestions you might have.
 

Well, it seems a simple "case" issue: look at interwiki.install file, line 5.

You'll find a switch statement, (badly) written to consider only MYSQL and not other DBs.
That's why the required interwiki table won't get created.

switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':     
      $result = db_query("
        CREATE TABLE {interwiki} (
          iw_prefix char(32) NOT NULL default '',
          iw_url char(127) NOT NULL default '',
          iw_local tinyint(1) NOT NULL default '0',
          iw_rel char(32) NOT NULL default '',
          UNIQUE KEY iw_prefix (iw_prefix)
        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");

The bad thing of that code is no errors are thrown at all (Postgree DB users will get into troubles as well).

Change "mysql" to "sqlite" (or add a new "sqlite" case) and redo module installation.

Ho installato la versione d6.19 su uno spazio altervista aperto di recente.
Tale spazio prevede automaticamente il php5.
Quando faccio l'update dopo aver carcato un modulo vengono segnalati una serie di errori.

Tale problema non esiste su un vecchio spazio sempre su altervista che richiede la scelta del php5
cosa devo fare?
grazie

> vengono segnalati una serie di errori

Posta gli errori che ottieni, così gli diamo un'occhiata...

ecco parte dei messaggi di errore
warningPDOStatement::execute() [pdostatement.execute]: SQLSTATE[HY000]: General error6 database table is locked in /membri/gtechallengercup/includes/database.sqlite.inc on line 241.
user warning

queryUPDATE system SET info 'a:10:{s:4:"name";s:10:"Aggregator";s:11:"description";s:57:"Aggregates syndicated content (RSS, RDF, and Atom feeds).";s:7:"package";s:15:"Core - optional";s:7:"version";s:4:"6.19";s:4:"core";s:3:"6.x";s:7:"project";s:6:"drupal";s:9:"datestamp";s:10:"1281559292";s:12:"dependencies";a:0:{}s:10:"dependents";a:0:{}s:3:"php";s:5:"4.3.5";}'name 'aggregator'filename 'modules/aggregator/aggregator.module'bootstrap 0 WHERE filename 'modules/aggregator/aggregator.module' in /membri/gtechallengercup/includes/module.inc on line 141. 

ho reperito il dato da una segnalazione fatta al forum di altervista (ora ho cancellato il sito per provare una nuova installazione)
cmq seguendo le istruzioni sul manuale e scenado il fine phpinfo.php risulta il sqlite library 3.3.6 (e non 3.3.7 come indicato nella guida)
grazie

Vedo che sul tuo sito stai provando Drupal7, che ha il supporto a SQLite integrato.

So che il destino di Drupal-SQLite è segnato (lo sapevo già dal principio) e quindi ti chiedo se puoi farmi sapere i tuoi risultati di installazione di D7, sia positivi che negativi.

Grazie

l'installazione di drupal con sqlite si blocca: richiede la versione del db 3.3.7. non so come fare. ho chiesto aiuto sul forum di drupalitalia ma non sono ancora riuscito a risolvere il problema.
cosa intendevi sul destino segnato di  sqlite?
hai idea di come risolvere i problemi riscontrati dnell'installazione di d6.19 sqlite? (non ho avuto problemi con l'installazione in un vecchio spazio di altervista ove di defoult c'era php=4)
grAZIE

Io vedo che Altervista (almeno sul mio sito) fornisce SQLite v.3.3.7, quindi i requisiti dovrebbero essere soddisfatti.

Prova a segare tutti file, .htaccess compreso, magari accedendo via FTP.
Poi riabilita il PHP5. Se ancora non funziona prova a mandarmi via mail l'output di phpinfo (vedi nell'articolo le istruzioni per farlo).

niente da fare.

PECL Module version: (bundled) 1.0.1 $Id: pdo_sqlite.3.x: (bundled) 1.0.1 $Id: pdo_sqlite.c 293036 2010-01-03 09:23:27Z sebastian $
SQLite Library: 3.3.6

ho riportato in sintesi in php.info perché non riesco a fare il copia e incolla
ciao

Salve, ho installato l'attuale versione di DrupalSqlite sul server http:// www .cremespalmabilialcioccolato .it , da ieri è disponibile la versione 6.20 di Drupal.
Quando uscirà l'aggiornamento anche per DrupalSqlite ?

Grazie.

L'aggiornamento è appena uscito... :)

Hi all,

I'd migrate my site data db from mysql to sqlite db.

But I'm not able to migrate DB.

 

Do you know a good way to do it loseless (losing no data)?

Thank you

Sorry, I'm not aware of any opensource tool to do such conversion.

You could try to export your MySQL to test (ie. with phpMyAdmin export function), edit it with some sort of search/replace with a text editor (like emacs), then reimport in SQLite db.

You could even try one of the available Drupal plugins that provide DB backup functionality; choose one (if any) that will export your data in a DB-independent form: export from Drupal-MySql site then reimport into Drupal-SQLite... just a suggestion ;)

Hi,

 

I am trying Drupal with sqlite (6.20-1.5 Drupal 6.20) on windows XP based XAMPP installation. Everything is working soothly, but I found a few errors in core search module -

------------------------------------------------------------------------------------------------------------

1. While Re-Indexing the site and selecting manual :

    * warning: PDO::prepare() [pdo.prepare]: SQLSTATE[HY000]: General error: 1 no such function: CHAR_LENGTH in /includes/database.sqlite.inc on line 218.
    * user warning: no such function: CHAR_LENGTH
      query: SELECT DISTINCT cart_id FROM uc_cart_products WHERE changed <= 1297478616 AND CHAR_LENGTH(cart_id) > 8 in /profiles/uberdrupal/modules/ubercart/uc_cart/uc_cart.module on line 279.
    * warning: PDO::prepare() [pdo.prepare]: SQLSTATE[HY000]: General error: 1 no such function: CHAR_LENGTH in /includes/database.sqlite.inc on line 218.
    * user warning: no such function: CHAR_LENGTH
      query: SELECT DISTINCT cart_id FROM uc_cart_products WHERE changed <= 1265957016 AND CHAR_LENGTH(cart_id) <= 8 in /profiles/uberdrupal/modules/ubercart/uc_cart/uc_cart.module on line 286.

------------------------------------------------------------------------------------------------------------

2. While performing actual search :

warning: PDO::prepare() [pdo.prepare]: SQLSTATE[HY000]: General error: 1 misuse of aggregate function MAX() in /includes/database.sqlite.inc on line 218.
user warning: misuse of aggregate function MAX()
query: SELECT COUNT(*) FROM (SELECT i.type, i.sid, 5 * (3.71410944608 * SUM(i.score * t.count)) + 5 * POW(2, (GREATEST(MAX(n.created), MAX(n.changed), COALESCE(MAX(c.last_comment_timestamp), 0)) - 1297338101) * 6.43e-8) + 5 * (2.0 - 2.0 / (1.0 + MAX(c.comment_count) * 1)) AS score FROM search_index i INNER JOIN search_total t ON i.word = t.word INNER JOIN node n ON n.nid = i.sid LEFT JOIN node_comment_statistics c ON c.nid = i.sid WHERE n.status = 1 AND (i.word = 'this') AND i.type = 'node' GROUP BY i.type, i.sid HAVING COUNT(*) >= 1) n1 in /modules/search/search.module on line 958.
warning: PDO::prepare() [pdo.prepare]: SQLSTATE[HY000]: General error: 1 misuse of aggregate function MAX() in /includes/database.sqlite.inc on line 218.
user warning: misuse of aggregate function MAX()
query: SELECT i.type, i.sid, 5 * (3.71410944608 * SUM(i.score * t.count)) + 5 * POW(2, (GREATEST(MAX(n.created), MAX(n.changed), COALESCE(MAX(c.last_comment_timestamp), 0)) - 1297338101) * 6.43e-8) + 5 * (2.0 - 2.0 / (1.0 + MAX(c.comment_count) * 1)) AS score FROM search_index i INNER JOIN search_total t ON i.word = t.word INNER JOIN node n ON n.nid = i.sid LEFT JOIN node_comment_statistics c ON c.nid = i.sid WHERE n.status = 1 AND (i.word = 'this') AND i.type = 'node' GROUP BY i.type, i.sid HAVING COUNT(*) >= 1 ORDER BY score DESC LIMIT 10 OFFSET 0 in /modules/search/search.module on line 958.

------------------------------------------------------------------------------------------------------------

 

Can anyone suggest if this is a bug, or am I doing something wrong? If this works, I would like to use this package (Drupal with SQLITE) on my live site.

Thanks for your detailed feedback.

I'll take a look ASAP.

Claudio

Both errors were fixed in latest SVN version.

If you are used to SVN, then update to the latest trunk version here:
https://drupal-sqlite.svn.sourceforge.net/svnroot/drupal-sqlite/trunk

Otherwise you can download the full archive here:
http://drupal-sqlite.svn.sourceforge.net/viewvc/drupal-sqlite/trunk/?view=tar
(it's a .tar.gz compressed archive, if you're on Windows open it with 7-Zip)

Hi Coolsoft,

Thanks for fixing the errors - that was real fast :-).

I tried the new version in my local setup (XAMPP under Windows - sqlite version 3.6.20, php version 5.2.8). The status is as follows:

1. The installation was successful except the following two warnings (at the end of this list).

2. If I ignore the warnings and continue with configuring the site, no more errors are reported.

3. The search is also working correctly

However, I do not know if these warnings are serious for production sites.

-------------------------------------------------------------------------------------

The Installation Warnings are:

# warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[23000]: Integrity constraint violation: 19 blocks.pages may not be NULL in C:\xampplite\htdocs\includes\database.sqlite.inc on line 243.
# user warning:
query: INSERT INTO blocks (module, delta, theme, status, weight, region, custom, throttle, visibility, title, cache) VALUES ('menu', 'primary-links', 'acquia_prosper', 1, -5, 'footer', 0, 0, 0, '', 1) in C:\xampplite\htdocs\includes\common.inc on line 3538.

-------------------------------------------------------------------------------------

Well, this warning is not related to Drupal-SQLite but to an additional module/theme trying to run a malformed query.

In fact it tries to insert a record into the "blocks" table without providing a value for the "pages" column, which hasn't a default value:

INSERT INTO blocks
(module, delta, theme, status, weight, region, custom, throttle, visibility, title, cache)
VALUES
('menu', 'primary-links', 'acquia_prosper', 1, -5, 'footer', 0, 0, 0, '', 1)

The guilty should be the "acquia-prosper" theme, as I can read from the reported SQL command.
You should report them the error.

Anyway, as for SQLite database engine, this should not be a problem: it will add the record using '' (empty string) as default value.

You could also test "blocks" table content with a SQLite database manager (I suggest SQLite Manager firefox plugin for this).

Thanks .. I will investigate it further (with my rather limited PHP skills :-) ) and post my findings here if they are worth mentionable.

As I said earlier, I am planning to use this on a live site if everything  works out well - and now I feel confident that it will.

You have done a great service to Drupal community (although Drupal 7 has built-in support for sqlite, I still would like to stay with 6.x for quite some time)

Anche a me da errore quando cerco qualcosa nel sito (su altervista con PDO v3.3.7)

e mi dice "La ricerca non ha prodotto risultati"

  • warning: PDO::prepare() [pdo.prepare]: SQLSTATE[HY000]: General error: 1 misuse of aggregate function MAX() in /membri/niko2f/sga/includes/database.sqlite.inc on line 218.
  • user warning: misuse of aggregate function MAX()
    query: SELECT COUNT(*) FROM (SELECT i.type, i.sid, 5 * (3.6712070738161 * SUM(i.score * t.count)) + 5 * POW(2, (GREATEST(MAX(n.created), MAX(n.changed), COALESCE(MAX(c.last_comment_timestamp), 0)) - 1356031083) * 6.43e-8) + 5 * (2.0 - 2.0 / (1.0 + MAX(c.comment_count) * 0.33333333333333)) + 5 * (2.0 - 2.0 / (1.0 + MAX(nc.totalcount) * 1)) AS score FROM search_index i INNER JOIN search_total t ON i.word = t.word INNER JOIN node n ON n.nid = i.sid LEFT JOIN node_comment_statistics c ON c.nid = i.sid LEFT JOIN node_counter nc ON nc.nid = i.sid WHERE n.status = 1 AND (i.word = 'sicurezza') AND i.type = 'node' GROUP BY i.type, i.sid HAVING COUNT(*) >= 1) n1 in /membri/niko2f/sga/modules/search/search.module on line 958.
  • warning: PDO::prepare() [pdo.prepare]: SQLSTATE[HY000]: General error: 1 misuse of aggregate function MAX() in /membri/niko2f/sga/includes/database.sqlite.inc on line 218.
  • user warning: misuse of aggregate function MAX()
    query: SELECT i.type, i.sid, 5 * (3.6712070738161 * SUM(i.score * t.count)) + 5 * POW(2, (GREATEST(MAX(n.created), MAX(n.changed), COALESCE(MAX(c.last_comment_timestamp), 0)) - 1356031083) * 6.43e-8) + 5 * (2.0 - 2.0 / (1.0 + MAX(c.comment_count) * 0.33333333333333)) + 5 * (2.0 - 2.0 / (1.0 + MAX(nc.totalcount) * 1)) AS score FROM search_index i INNER JOIN search_total t ON i.word = t.word INNER JOIN node n ON n.nid = i.sid LEFT JOIN node_comment_statistics c ON c.nid = i.sid LEFT JOIN node_counter nc ON nc.nid = i.sid WHERE n.status = 1 AND (i.word = 'sicurezza') AND i.type = 'node' GROUP BY i.type, i.sid HAVING COUNT(*) >= 1 ORDER BY score DESC LIMIT 10 OFFSET 0 in /membri/niko2f/sga/modules/search/search.module on line 958.

 

Ciao, devo dire che ha proprio una gran compatibilità con i moduli che ho provato ! :)

Ti volevo chiedere su come fare l'update da drupal-sqlite a drupal7, che vorrei effettivamente fare, quando Altervista aggiornerà SQLite al 3.3.7 dal 3.3.6 che mi da!

Grazie!

Non ho ancora affrontato l'argomento, ma c'è ancora tempo per pensarci.
Drupal 7 è ancora troppo giovane e non offre la vastità di temi e moduli disponibili per Drupal 6, che rimarrà attivo per diverso tempo.

Drupal dovrebbe avere una procedura di upgrade, che però considera solo MySQL e PostgreeSQL (che erano supportati nella 6).
La mia intenzione è quella di modificare lo script di upgrade originale per renderlo compatibile con Drupal-SQLite.

Stay tuned...

PS: chiamando il PHPInfo() sul mio sito mi da la versione 3.3.7 di SQLite.

Ciao, complimenti per l'articolo, davvero utile e interessante.

Volevo chiedere:

ma su altervista è possibile installare drupal 7 in modalità sqlite?

se si, esiste una guida da scaricare?

 

grazie

fab

Personalmente non ho ancora provato, ma lo farò presto e riporterò i risultati.

Grazie da ora

:)

Confermo che Drupal SQLite funziona correttamente anche su Altervista.

Hi guys, I installed the latest version of Drupal Sqlite and I was working to create my website. Now I meet a problem: to create some pages I need to use the "views" module and in particular the view called "blog archive". When I enable this view from the administration panel everything seems to be OK, but if I open the page containing the view I receive the error messages listed below: please, can anyone help me to solve them?

warning: PDO::prepare() [pdo.prepare]: SQLSTATE[HY000]: General error: 1 near "AS": syntax error in /web/htdocs/www.titengodocchio.it/home/includes/database.sqlite.inc on line 218. user warning: near "AS": syntax error query: SELECT COUNT(*) FROM (SELECT AS created_year_month, COUNT(node.nid) AS num_records FROM node node WHERE node.status <> 0 GROUP BY created_year_month ORDER BY created_year_month DESC ) count_alias in /web/htdocs/www.titengodocchio.it/home/sites/all/modules/views/includes/view.inc on line 745.

warning: PDO::prepare() [pdo.prepare]: SQLSTATE[HY000]: General error: 1 near "AS": syntax error in /web/htdocs/www.titengodocchio.it/home/includes/database.sqlite.inc on line 218. user warning: near "AS": syntax error query: SELECT AS created_year_month, COUNT(node.nid) AS num_records FROM node node WHERE node.status <> 0 GROUP BY created_year_month ORDER BY created_year_month DESC LIMIT 30 OFFSET 0 in /web/htdocs/www.titengodocchio.it/home/sites/all/modules/views/includes/view.inc on line 771.

PS: Sorry for the mystakes I did writing this comments, I am Italian.
I hope you could understand my English!

Pagine