DeutschEnglish

Submenu

 - - - By CrazyStat - - -

4. October 2012

PDO / sqlite: database table is locked

Filed under: DBMS,PHP,phpLiteAdmin — Tags: , , , , , , , — Christopher Kramer @ 22:06

At the moment I am working again on phpliteadmin, a  php-based web GUI for database administration of sqlite databases. While debugging, I stumbled across a problem that only occurred with the PDO extension (not with SQLiteDatabase or SQLite3). I got the following error message while trying to drop a table:

HY000 / 6 / database table is locked

By the way, you can use PDO::errorInfo() to get these error messages. So as the error correctly explains, the table I tried to drop seemed to be in use. PDO documentation for PDO::query() also explains the problem (even though DROP TABLE statements are fired using PDO::exec()):

If you do not fetch all of the data in a result set before issuing your next call to PDO::query(), your call may fail. Call PDOStatement::closeCursor() to release the database resources associated with the PDOStatement object before issuing your next call to PDO::query().

So I hunted for the open cursor on a resultset of the table in question and could not find any. Finally, I found the SQL statement which still had an open cursor:

SELECT * FROM sqlite_master

Thinking about this, it is obvious: When querying sqlite_master, you request information about database tables. If one of the table gets altered or dropped, this might change the data listed in the resultset on which I still have a cursor.

Maybe this is a special case as usually you do not query sqlite_master a lot. But in case you do, this might be useful information.

To solve the problem, as the manual says, simply release the cursor using PDOStatement::closeCursor() before dropping/altering tables.

Recommendation

Try my Open Source PHP visitor analytics script CrazyStat.

2. December 2011

CrazyStat 1.71 changes & features

Filed under: CrazyStat — Tags: , , , , , — Christopher Kramer @ 21:24

As promised, some more news about what’s new in upcoming version 1.71 of my PHP visitor analytics script CrazyStat:

  • New language: Danish language file (as already announced)
  • New feature: Average and total visting time analysed (hits module)
  • New feature: The files in the files-module can now be linked to the page counted
  • New logo: CrazyStat has a new logo thanks to Kartoffelpfluecker
  • Privacy improved: Reworked anonymous IPs. Now “anonymous IPs” look like normal ones and keep the first two octets. This way, the visitor’s country can be detected by IP, but the IP is still anonymous as the last two octets can not be reworked. Now this is turned on by default.
  • New privacy feature: Optionally, CrazyStat now respects the “Do-Not-Track” header that some browsers send if the user tells it to. When this is turned on, hits by those users will not be logged at all. Note that strictly speaking, CrazyStat never “tracks” users (does not use cookies etc.) and therefore by turning this on, you respect your users’s privacy even more than they asked for.
  • Browser detection: new browsers included in the keywords file (all those new Firefox-versions…), IE8 and IE9 now correctly detected in compatibility mode.
    Note that this is already available for CrazyStat 1.70 from the download page
  • PHP4 support removed. CrazyStat no longer comes with workarounds for old PHP4 installations, so PHP5.1 is required. Please update to PHP5, as PHP4 is insecure
  • Language-cookie “lang” renamed into “CrazyStat_lang” to avoid collisions with other scripts
  • Decimal separators now language-specific
  • Fixed a bug that caused weird ordering of days in some months
  • Lots of smaller bug fixes like invalid XHTML and PHP notice messages

Please let me know your opinion about the changes. I know it’s not a lot of great new features but more a maintenance update.

30. November 2011

CrazyStat 1.71 will speak Danish

Filed under: CrazyStat — Tags: , , — Christopher Kramer @ 14:19

As you might know, as of version 1.70, CrazyStat is a multi-language script. Originally, CrazyStat was available in German only. But in 1.70, I translated the interface and documentation into English to make CrazyStat available to a broader audience. Soon after I published the first release Candidate of CrazyStat 1.70, somebody (plaise.nl) voluntarily translated CrazyStat into Dutch. So when I released CrazyStat 1.70 final, CrazyStat included language files for German, English and Dutch.

Now Liza Overgaard sent me her translation of CrazyStat into Danish. She did not only translate the user interface, but also the readme file and even plans to translate the FAQ and config-documentation.

So upcoming CrazyStat 1.71 will include a Danish language file and documentation. Thanks a lot to all translators for their work that helps to spread CrazyStat.

If you speak some language that is not yet supported by CrazyStat, it would be great if you could translate CrazyStat into your language. It only takes a few hours as CrazyStat does not have much text on the user interface. Of course your work will be honoured by mentioning you in the changelog of CrazyStat and in the news. I will even link to your website if you want, which will lead visitors to your site and create a lot of backlinks.

Please contact me, if you are interested in translating CrazyStat. I also need somebody who supports the Dutch translation as plaise.nl stopped translating open-source software and I need a couple of small texts translated that are new in 1.71.

Thanks everybody for using CrazyStat. Especially to all translators.

More news about the upcoming version of the analytics script CrazyStat 1.71 will be published here and on twitter soon. Stay tuned.

« Newer Posts