Loading...
 
Skip to main content

SQL error with SQLite db engine on Orphan Pages

Status
Closed
Subject
SQL error with SQLite db engine on Orphan Pages
Version
1.9.x
Category
  • Error
Feature
Database independence (Non-Mysql, ADOdb Postgres, Oracle, etc)
Resolution status
Out of Date
Submitted by
ScottMac
Volunteered to solve
ScottMac
Lastmod by
Kissaki
Rating
(0)
Description

Within lib/stats/statslib.php there is a missing space between an identifier and the WHERE token, for SQLite ADOdb strips out the backtick resulting in an SQL error.

After grepping the code I can see that there are a few places that are going to cause this error.

lib/stats/statslib.php
$query_cant = "select count(*) from `tiki_pages` tp left join `tiki_links` tl on tp.`pageName` = tl.`toPage` left join `tiki_structures` ts on tp.`page_id`= ts.`page_id`where tl.`toPage` IS NULL and `ts`.page_id IS NULL";
$query = "select `pageName`, `hits`, `page_size` as `len` ,`lastModif`, `user`, `ip`, `comment`, `version`, `flag` from `tiki_pages` tp left join `tiki_links` tl on tp.`pageName` = tl.`toPage` left join `tiki_structures` ts on tp.`page_id`= ts.`page_id`where tl.`toPage` IS NULL and `ts`.page_id IS NULL $mid order by ".$this->convert_sortmode($sort_mode);

lib/faqs/faqlib.php
$query = "delete from `tiki_faqs`where `title`=?";

lib/charts/chartlib.php
$query = "delete from `tiki_charts_votes`where `user`=? and `itemId`=?";

lib/admin/adminlib.php
$query = "delete from `tiki_dsn`where `name`=? and `dsn`=?";
$query = "delete from `users_permissions`where `permName`=?";
$query = "delete from `tiki_tags`where `tagName`=? and `pageName`=?";

Solution

Add a space between each backtick and WHERE token.



Please upgrade to a recent version of tiki.
If the problem persists, please add a new tracker item.

Importance
4
Priority
20
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
1485
Created
Tuesday 15 January, 2008 11:54:31 UTC
by Unknown
LastModif
Saturday 08 August, 2009 19:59:23 UTC


Show PHP error messages