PHP Velho Oeste 2024

TokyoTyrantQuery::current

(PECL tokyo_tyrant >= 0.1.0)

TokyoTyrantQuery::currentRetourne l'élément courant

Description

public TokyoTyrantQuery::current ( void ) : array

Retourne l'élément courant. Fait partie de l'interface Iterator.

Liste de paramètres

Cette fonction ne contient aucun paramètre.

Valeurs de retour

Retourne la ligne courante.

Exemples

Exemple #1 Exemple avec TokyoTyrantQuery iterator

<?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" => "foobar 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");

/* Parcours les résultats */
foreach ($query as $key => $value) {
    echo 
"pk: $key, columns: "count($value) ,"\n";
}
?>

L'exemple ci-dessus va afficher quelque chose de similaire à :

pk: 1, columns: 2
pk: 4, columns: 2

Voir aussi

add a note add a note

User Contributed Notes

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