PHP Velho Oeste 2024

TokyoTyrantQuery::count

(No version information available, might only be in Git)

TokyoTyrantQuery::countCompte les enregistrements

Description

public TokyoTyrantQuery::count ( void ) : int

Retourne le nombre d'enregistrements qu'une requête retourne.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

Retourne le nombre d'enregistrements qu'une requête retourne, et lance une exception TokyoTyrantException si une erreur survient.

Exemples

Exemple #1 Exemple avec TokyoTyrantQuery::count()

<?php
/* Connexion à une base de données table */
$tt = new TokyoTyrantTable("localhost"1979);

/* Ajout de quelques lignes */
$tt->put(null, array("column1" => "some data""column2" => "something here"));
$tt->put(null, array("column1" => "more data""column2" => "best data this far"));
$tt->put(null, array("column1" => "again data""column3" => "not here"));
$tt->put(null, array("column45" => "random data""column2" => "something along the lines"));
$tt->put(null, array("column21" => "test data""column2" => "generating.."));
$tt->put(null, array("column1" => "foobar data""column2" => "value here"));

/* Récupère un nouvel objet de requête */
$query $tt->getQuery();

/* Ajoute une condition de recherche */
$query->addCond("column2"TokyoTyrant::RDBQC_STROR"something");

/* Compte les résultats */
var_dump($query->count());
?>

L'exemple ci-dessus va afficher :

int(2)

Voir aussi

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top