Ajout fonctions
This commit is contained in:
parent
8a9b763ee0
commit
076f001017
@ -1,6 +1,6 @@
|
|||||||
<?PHP
|
<?PHP
|
||||||
/* Copyright (C) 2001 Fabien Seisen <seisen@linuxfr.org>
|
/* Copyright (C) 2001 Fabien Seisen <seisen@linuxfr.org>
|
||||||
* Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
* Copyright (C) 2002-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* $Source$
|
* $Source$
|
||||||
@ -24,14 +24,9 @@
|
|||||||
class DoliDb {
|
class DoliDb {
|
||||||
var $db, $results, $ok;
|
var $db, $results, $ok;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Function DoliDb($type = 'mysql', $host = '', $user = '', $pass = '', $name = '')
|
Function DoliDb($type = 'mysql', $host = '', $user = '', $pass = '', $name = '')
|
||||||
{
|
{
|
||||||
|
|
||||||
// print "Name DB : $host, $user, $pass, $name<br>";
|
// print "Name DB : $host, $user, $pass, $name<br>";
|
||||||
|
|
||||||
|
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
if ($host == '')
|
if ($host == '')
|
||||||
@ -54,23 +49,32 @@ class DoliDb {
|
|||||||
$name = $conf->db->name;
|
$name = $conf->db->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->db = $this->connect($host, $user, $pass);
|
$this->db = $this->connect($host, $user, $pass);
|
||||||
|
|
||||||
if (! $this->db)
|
if ($this->db)
|
||||||
|
{
|
||||||
|
$this->connected = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
print "Db->Db() raté<br>\n";
|
print "Db->Db() raté<br>\n";
|
||||||
$this->ok = 0;
|
$this->connected = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = $this->select_db($name);
|
$ret = $this->select_db($name);
|
||||||
|
|
||||||
$this->ok = 1;
|
if ($ret == 1)
|
||||||
|
{
|
||||||
|
$this->database_selected = 1;
|
||||||
|
$this->ok = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->database_selected = 0;
|
||||||
|
$this->ok = 0;
|
||||||
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
|
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
@ -87,6 +91,20 @@ class DoliDb {
|
|||||||
$this->db = mysql_connect($host, $login, $passwd);
|
$this->db = mysql_connect($host, $login, $passwd);
|
||||||
return $this->db;
|
return $this->db;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
Function create_db($database)
|
||||||
|
{
|
||||||
|
if (mysql_create_db ($database, $this->db))
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user