New: Function plimit of databases drivers accept -1 as value (it means

default value set into conf->liste_limit).
This commit is contained in:
Laurent Destailleur 2013-02-25 12:51:38 +01:00
parent 1224e79ee3
commit 2dc4b91521
6 changed files with 31 additions and 30 deletions

View File

@ -28,7 +28,8 @@ For developers:
- Renamed some database fields, code variables and parameters from french to english. - Renamed some database fields, code variables and parameters from french to english.
- First change to manage margins on contracts. - First change to manage margins on contracts.
- Add hook getFormMail. - Add hook getFormMail.
- Function plimit of databases drivers accept -1 as value (it means default value set
into conf->liste_limit).
For translators: For translators:
- Update language files. - Update language files.

View File

@ -499,16 +499,16 @@ class DoliDBMssql
/** /**
* Define limits of request * Define limits and offset of request
* *
* @param int $limit nombre maximum de lignes retournees * @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
* @param int $offset numero de la ligne a partir de laquelle recuperer les ligne * @param int $offset Numero of line from where starting fetch
* @return string chaine exprimant la syntax sql de la limite * @return string String with SQL syntax to add a limit and offset
*/ */
function plimit($limit=0,$offset=0) function plimit($limit=0,$offset=0)
{ {
global $conf; global $conf;
if (! $limit) $limit=$conf->liste_limit; if ($limit < 0) $limit=$conf->liste_limit;
if ($offset > 0) return " LIMIT $offset,$limit "; if ($offset > 0) return " LIMIT $offset,$limit ";
else return " LIMIT $limit "; else return " LIMIT $limit ";
} }

View File

@ -479,16 +479,16 @@ class DoliDBMysql
/** /**
* Define limits of request * Define limits and offset of request
* *
* @param int $limit nombre maximum de lignes retournees * @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
* @param int $offset numero de la ligne a partir de laquelle recuperer les ligne * @param int $offset Numero of line from where starting fetch
* @return string chaine exprimant la syntax sql de la limite * @return string String with SQL syntax to add a limit and offset
*/ */
function plimit($limit=0,$offset=0) function plimit($limit=0,$offset=0)
{ {
global $conf; global $conf;
if (! $limit) $limit=$conf->liste_limit; if ($limit < 0) $limit=$conf->liste_limit;
if ($offset > 0) return " LIMIT $offset,$limit "; if ($offset > 0) return " LIMIT $offset,$limit ";
else return " LIMIT $limit "; else return " LIMIT $limit ";
} }

View File

@ -481,16 +481,16 @@ class DoliDBMysqli
/** /**
* Defini les limites de la requete * Define limits and offset of request
* *
* @param int $limit nombre maximum de lignes retournees * @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
* @param int $offset numero de la ligne a partir de laquelle recuperer les ligne * @param int $offset Numero of line from where starting fetch
* @return string chaine exprimant la syntax sql de la limite * @return string String with SQL syntax to add a limit and offset
*/ */
function plimit($limit=0,$offset=0) function plimit($limit=0,$offset=0)
{ {
global $conf; global $conf;
if (! $limit) $limit=$conf->liste_limit; if ($limit < 0) $limit=$conf->liste_limit;
if ($offset > 0) return " LIMIT $offset,$limit "; if ($offset > 0) return " LIMIT $offset,$limit ";
else return " LIMIT $limit "; else return " LIMIT $limit ";
} }

View File

@ -691,16 +691,16 @@ class DoliDBPgsql
/** /**
* Defini les limites de la requete * Define limits and offset of request
* *
* @param int $limit nombre maximum de lignes retournees * @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
* @param int $offset numero de la ligne a partir de laquelle recuperer les lignes * @param int $offset Numero of line from where starting fetch
* @return string chaine exprimant la syntax sql de la limite * @return string String with SQL syntax to add a limit and offset
*/ */
function plimit($limit=0,$offset=0) function plimit($limit=0,$offset=0)
{ {
global $conf; global $conf;
if (! $limit) $limit=$conf->liste_limit; if ($limit < 0) $limit=$conf->liste_limit;
if ($offset > 0) return " LIMIT ".$limit." OFFSET ".$offset." "; if ($offset > 0) return " LIMIT ".$limit." OFFSET ".$offset." ";
else return " LIMIT $limit "; else return " LIMIT $limit ";
} }

View File

@ -620,16 +620,16 @@ class DoliDBSqlite
/** /**
* Define limits of request * Define limits and offset of request
* *
* @param int $limit nombre maximum de lignes retournees * @param int $limit Maximum number of lines returned (-1=conf->liste_limit, 0=no limit)
* @param int $offset numero de la ligne a partir de laquelle recuperer les ligne * @param int $offset Numero of line from where starting fetch
* @return string chaine exprimant la syntax sql de la limite * @return string String with SQL syntax to add a limit and offset
*/ */
function plimit($limit=0,$offset=0) function plimit($limit=0,$offset=0)
{ {
global $conf; global $conf;
if (! $limit) $limit=$conf->liste_limit; if ($limit < 0) $limit=$conf->liste_limit;
if ($offset > 0) return " LIMIT $offset,$limit "; if ($offset > 0) return " LIMIT $offset,$limit ";
else return " LIMIT $limit "; else return " LIMIT $limit ";
} }