Merged revisions 3431-3432 via svnmerge from

svn+ssh://danydb@svn/svn/phpcompta/branches/rel510

........
  r3431 | danydb | 2010-07-05 19:56:48 +0200 (Mon, 05 Jul 2010) | 2 lines
  
  the plugin can check the version of phpcompta
........
  r3432 | danydb | 2010-07-05 19:57:34 +0200 (Mon, 05 Jul 2010) | 2 lines
  
  Update : check the version for plugin , new global variable $version_phpcompta
........
This commit is contained in:
Dany De Bontridder 2010-07-05 18:05:41 +00:00
parent 84b7d254a7
commit 4253bedcf5
3 changed files with 28 additions and 2 deletions

View file

@ -423,14 +423,29 @@ de données");
return true;
}
/*!\brief test if a table exist
*\param $p_name table name
*\param $schema name of the schema default public
* \return true if a table exist otherwise false
*/
function exist_table($p_name) {
$r=$this->count_sql("select tablename from pg_tables where tablename=lower($1)", array($p_name));
function exist_table($p_name,$p_schema='public') {
$r=$this->count_sql("select table_name from information_schema.tables where table_schema=$1 and table_name=lower($2)", array($p_schema,$p_name));
if ( $r==0)
return false;
return true;
}
/**
* Check if a column exists in a table
* @param $col : column name
* @param $table :table name
* @param $schema :schema name, default public
*@return true or false
*/
function exist_column($col,$table,$schema) {
$r=$this->get_value('select count(*) from information_schema.columns where table_name=lower($1) and column_name=lower($2) and table_schema=lower($3)',
array($col,$table,$schema));
if ( $r > 0 ) return true;
return false;
}
/**
*@brief check if the large object exists
*@param $p_oid of the large object

View file

@ -246,6 +246,14 @@ ex_id=>''
$a=$cn->get_array($sql,array($_SESSION['g_user']));
return $a;
}
static function check_version($i) {
global $version_phpcompta;
if ( ! isset ($version_phpcompta) || $version_phpcompta < $i ) {
alert('Cette extension ne fonctionne pas sur cett version de PhpCompta'.
' Veuillez mettre votre programme a jour');
exit();
}
}
/*!\brief test this class
*/
static function test_me() {

View file

@ -25,6 +25,9 @@
*/
require_once ('config.inc.php');
require_once('constant.security.php');
// SVNVERSION
global $version_phpcompta;
$version_phpcompta=3428;
define ("DBVERSION",85);
define ("DBVERSIONREPO",12);