Open Source Training Seminar FreePBX Paid Support

Ticket #1773 (closed Bugs: fixed)

Opened 2 years ago

Last modified 1 year ago

miscdest module does not install it's tables on sqlite

Reported by: diego_iastrubni Assigned to: diego_iastrubni
Priority: minor Milestone: 2.2
Component: Other Module Version: 2.2.1
Keywords: sqlite Cc:
Confirmation: SVN Revision (if applicable):
Backend Engine: All Backend Engine Version:

Description

The misc-destinations module is not working when the DB engine is sqlite3 (and 2). The reason, is that install.sql is not suited for those sql engines.

As I learned from ticket:1768, the best way is to remove the install.sql into install.php and detect the sql engine. The solution, shuold be clearing the install.sql file (see ticket:1772), and install.php should contain this code:

<?php

global $db;
global $amp_conf;

$autoincrement = (($amp_conf["AMPDBENGINE"] == "sqlite") || ($amp_conf["AMPDBENGINE"] == "sqlite3")) ? "AUTOINCREMENT":"AUTO_INCREMENT";

$sql = "CREATE TABLE IF NOT EXISTS miscdests (
	id INTEGER NOT NULL PRIMARY KEY $autoincrement,
	description VARCHAR( 100 ) NOT NULL ,
	destdial VARCHAR( 100 ) NOT NULL
)";

$check = $db->query($sql);
if(DB::IsError($check)) {
	die("Can not create miscdests table\n");
}

?>

While we are reviewing this module... the unsintall code is just wrong. We need to test if the table is installed, and not if is not installed.

This is the correct code for the uninstall.sql:

DROP TABLE IF EXISTS miscdests;

Remember sqlite2 does not like backticks, sqlite3 does like them, but on the branch we need to support sqlite2 as well. On the trunk (freePBX 2.3), sqlite2 is deprecated. See ticket:1727.

Change History

02/18/07 03:14:40 changed by vgster

  • priority changed from major to minor.

05/05/07 22:34:37 changed by diego_iastrubni

  • status changed from new to assigned.

should be fixed by changeset:3964

if i hear no complains in the next few days - i close it

05/07/07 21:40:49 changed by diego_iastrubni

module has been published as changeset:3970

05/29/07 20:42:44 changed by diego_iastrubni

  • status changed from assigned to closed.
  • resolution set to fixed.

closing now

Donate



Support
Download
Develop
Forums
News
Documentation
Paid Support
About

Paid Ads