New: Start to work on sqlite driver
This commit is contained in:
parent
a8057bc475
commit
5e1fa4fef5
@ -693,11 +693,13 @@ class DoliDBMssql
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Recupere l'id genere par le dernier INSERT.
|
* Get last ID after an insert INSERT
|
||||||
\param tab Nom de la table concernee par l'insert. Ne sert pas sous mssql mais requis pour compatibilite avec Postgresql
|
*
|
||||||
\return int id
|
* @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
|
||||||
|
* @param string $fieldid Field name
|
||||||
|
* @return int Id of row
|
||||||
*/
|
*/
|
||||||
function last_insert_id($tab)
|
function last_insert_id($tab,$fieldid='rowid')
|
||||||
{
|
{
|
||||||
$res = $this->query("SELECT @@IDENTITY as id");
|
$res = $this->query("SELECT @@IDENTITY as id");
|
||||||
if ($data = $this->fetch_array($res))
|
if ($data = $this->fetch_array($res))
|
||||||
|
|||||||
@ -675,11 +675,13 @@ class DoliDBMysql
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Recupere l'id genere par le dernier INSERT.
|
* Get last ID after an insert INSERT
|
||||||
\param tab Nom de la table concernee par l'insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
|
*
|
||||||
\return int id
|
* @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
|
||||||
|
* @param string $fieldid Field name
|
||||||
|
* @return int Id of row
|
||||||
*/
|
*/
|
||||||
function last_insert_id($tab)
|
function last_insert_id($tab,$fieldid='rowid')
|
||||||
{
|
{
|
||||||
return mysql_insert_id($this->db);
|
return mysql_insert_id($this->db);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -687,12 +687,13 @@ class DoliDBMysqli
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recupere l'id genere par le dernier INSERT.
|
* Get last ID after an insert INSERT
|
||||||
*
|
*
|
||||||
* @param tab Nom de la table concernee par l'insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
|
* @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
|
||||||
* @return int id
|
* @param string $fieldid Field name
|
||||||
|
* @return int Id of row
|
||||||
*/
|
*/
|
||||||
function last_insert_id($tab)
|
function last_insert_id($tab,$fieldid='rowid')
|
||||||
{
|
{
|
||||||
return mysqli_insert_id($this->db);
|
return mysqli_insert_id($this->db);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -850,8 +850,9 @@ class DoliDBPgsql
|
|||||||
/**
|
/**
|
||||||
* Get last ID after an insert INSERT
|
* Get last ID after an insert INSERT
|
||||||
*
|
*
|
||||||
* @param tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
|
* @param string $tab Table name concerned by insert. Ne sert pas sous MySql mais requis pour compatibilite avec Postgresql
|
||||||
* @return int id
|
* @param string $fieldid Field name
|
||||||
|
* @return int Id of row
|
||||||
*/
|
*/
|
||||||
function last_insert_id($tab,$fieldid='rowid')
|
function last_insert_id($tab,$fieldid='rowid')
|
||||||
{
|
{
|
||||||
|
|||||||
1177
htdocs/core/db/sqlite.class.php
Normal file
1177
htdocs/core/db/sqlite.class.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -239,6 +239,18 @@ if (! empty($force_install_message))
|
|||||||
<h3><?php echo $langs->trans("DolibarrDatabase"); ?></h3>
|
<h3><?php echo $langs->trans("DolibarrDatabase"); ?></h3>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td class="label" valign="top"><b> <?php echo $langs->trans("DatabaseName"); ?>
|
||||||
|
</b></td>
|
||||||
|
|
||||||
|
<td class="label" valign="top"><input type="text" id="db_name"
|
||||||
|
name="db_name"
|
||||||
|
value="<?php echo (! empty($dolibarr_main_db_name))?$dolibarr_main_db_name:($force_install_database?$force_install_database:'dolibarr'); ?>"></td>
|
||||||
|
<td class="comment"><?php echo $langs->trans("DatabaseName"); ?></td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if (!isset($dolibarr_main_db_host))
|
if (!isset($dolibarr_main_db_host))
|
||||||
{
|
{
|
||||||
@ -273,20 +285,17 @@ if (! empty($force_install_message))
|
|||||||
|
|
||||||
// Version min of database
|
// Version min of database
|
||||||
$versionbasemin=$class::$versionmin;
|
$versionbasemin=$class::$versionmin;
|
||||||
// var_dump($xxx);
|
|
||||||
// $versionbasemin=array();
|
|
||||||
if ($type=='mysql') { $testfunction='mysql_connect'; }
|
|
||||||
if ($type=='mysqli') { $testfunction='mysqli_connect'; }
|
|
||||||
if ($type=='pgsql') { $testfunction='pg_connect'; }
|
|
||||||
if ($type=='mssql') { $testfunction='mssql_connect'; }
|
|
||||||
|
|
||||||
// Rem
|
|
||||||
$note='('.$class::$label.' >= '.versiontostring($versionbasemin).')';
|
$note='('.$class::$label.' >= '.versiontostring($versionbasemin).')';
|
||||||
|
|
||||||
// Switch to mysql if mysqli is not present
|
// Switch to mysql if mysqli is not present
|
||||||
if ($defaultype=='mysqli' && !function_exists('mysqli_connect')) $defaultype = 'mysql';
|
if ($defaultype=='mysqli' && !function_exists('mysqli_connect')) $defaultype = 'mysql';
|
||||||
|
|
||||||
// Show line into list
|
// Show line into list
|
||||||
|
if ($type=='mysql') { $testfunction='mysql_connect'; }
|
||||||
|
if ($type=='mysqli') { $testfunction='mysqli_connect'; }
|
||||||
|
if ($type=='pgsql') { $testfunction='pg_connect'; }
|
||||||
|
if ($type=='mssql') { $testfunction='mssql_connect'; }
|
||||||
|
if ($type=='sqlite') { $testfunction='notyetready'; }
|
||||||
$option.='<option value="'.$type.'"'.($defaultype == $type?' selected="selected"':'');
|
$option.='<option value="'.$type.'"'.($defaultype == $type?' selected="selected"':'');
|
||||||
if (! function_exists($testfunction)) $option.=' disabled="disabled"';
|
if (! function_exists($testfunction)) $option.=' disabled="disabled"';
|
||||||
$option.='>';
|
$option.='>';
|
||||||
@ -340,18 +349,8 @@ if (! empty($force_install_message))
|
|||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td class="label" valign="top"><b> <?php echo $langs->trans("DatabaseName"); ?>
|
<td class="label" valign="top"><?php echo $langs->trans("DatabasePrefix"); ?>
|
||||||
</b></td>
|
</td>
|
||||||
|
|
||||||
<td class="label" valign="top"><input type="text" id="db_name"
|
|
||||||
name="db_name"
|
|
||||||
value="<?php echo (! empty($dolibarr_main_db_name))?$dolibarr_main_db_name:($force_install_database?$force_install_database:'dolibarr'); ?>"></td>
|
|
||||||
<td class="comment"><?php echo $langs->trans("DatabaseName"); ?></td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
<td class="label" valign="top"><b> <?php echo $langs->trans("DatabasePrefix"); ?>
|
|
||||||
</b></td>
|
|
||||||
|
|
||||||
<td class="label" valign="top"><input type="text" id="db_prefix"
|
<td class="label" valign="top"><input type="text" id="db_prefix"
|
||||||
name="db_prefix"
|
name="db_prefix"
|
||||||
@ -442,6 +441,12 @@ if (! empty($force_install_message))
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
|
|
||||||
|
jQuery("#db_type").change(function() {
|
||||||
|
if (jQuery("#db_type").val()=='sqlite') { jQuery(".hidesqlite").hide(); }
|
||||||
|
else { jQuery(".hidesqlite").show(); }
|
||||||
|
});
|
||||||
|
|
||||||
function init_needroot()
|
function init_needroot()
|
||||||
{
|
{
|
||||||
/*alert(jQuery("#db_create_database").attr("checked")); */
|
/*alert(jQuery("#db_create_database").attr("checked")); */
|
||||||
@ -454,6 +459,7 @@ jQuery(document).ready(function() {
|
|||||||
jQuery(".needroot").attr('disabled','disabled');
|
jQuery(".needroot").attr('disabled','disabled');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
init_needroot();
|
init_needroot();
|
||||||
jQuery("#db_create_database").click(function() {
|
jQuery("#db_create_database").click(function() {
|
||||||
init_needroot();
|
init_needroot();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user