CollectionModify::bind

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

CollectionModify::bindBind value to query placeholder

Beschreibung

public mysql_xdevapi\CollectionModify::bind(array $placeholder_values): mysql_xdevapi\CollectionModify

Bind a parameter to the placeholder in the search condition of the modify operation.

The placeholder has the form of :NAME where ':' is a common prefix that must always exists before any NAME where NAME is the name of the placeholder. The bind method accepts a list of placeholders if multiple entities have to be substituted in the search condition of the modify operation.

Parameter-Liste

placeholder_values

Placeholder values to substitute in the search condition. Multiple values are allowed and have to be passed as an array of mappings PLACEHOLDER_NAME->PLACEHOLDER_VALUE.

Rückgabewerte

A CollectionModify object that can be used to execute the command, or to add additional operations.

Beispiele

Beispiel #1 mysql_xdevapi\CollectionModify::bind() example

<?php
$session 
mysql_xdevapi\getSession("mysqlx://user:password@localhost");
$session->sql("DROP DATABASE IF EXISTS addressbook")->execute();
$session->sql("CREATE DATABASE addressbook")->execute();

$schema     $session->getSchema("addressbook");
$collection $schema->createCollection("people");

$result $collection
  
->add(
  
'{"name":   "Bernie",
    "traits": ["Friend", "Brother", "Human"]}'

  ->
execute();

$collection
  
->modify("name = :name")
  ->
bind(['name' => 'Bernie'])
  ->
arrayAppend('traits''Happy')
  ->
execute();

$result $collection
  
->find()
  ->
execute();

print_r($result->fetchAll());
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

Array
(
    [0] => Array
        (
            [_id] => 00005b6b53610000000000000110
            [name] => Bernie
            [traits] => Array
                (
                    [0] => Friend
                    [1] => Brother
                    [2] => Human
                    [3] => Happy
                )
        )
)

Hier Kannst Du einen Kommentar verfassen


Bitte gib mindestens 10 Zeichen ein.
Wird geladen... Bitte warte.
* Pflichtangabe
Es sind noch keine Kommentare vorhanden.

PHP cURL-Tutorial: Verwendung von cURL zum Durchführen von HTTP-Anfragen

cURL ist eine leistungsstarke PHP-Erweiterung, die es Ihnen ermöglicht, mit verschiedenen Servern über verschiedene Protokolle wie HTTP, HTTPS, FTP und mehr zu kommunizieren. ...

TheMax

Autor : TheMax
Kategorie: PHP-Tutorials

Midjourney Tutorial - Anleitung für Anfänger

Über Midjourney, dem Tool zur Erstellung digitaler Bilder mithilfe von künstlicher Intelligenz, gibt es ein informatives Video mit dem Titel "Midjourney Tutorial auf Deutsch - Anleitung für Anfänger" ...

Mike94

Autor : Mike94
Kategorie: KI Tutorials

Grundlagen von Views in MySQL

Views in einer MySQL-Datenbank bieten die Möglichkeit, eine virtuelle Tabelle basierend auf dem Ergebnis einer SQL-Abfrage zu erstellen. ...

admin

Autor : admin
Kategorie: mySQL-Tutorials

Tutorial veröffentlichen

Tutorial veröffentlichen

Teile Dein Wissen mit anderen Entwicklern weltweit

Du bist Profi in deinem Bereich und möchtest dein Wissen teilen, dann melde dich jetzt an und teile es mit unserer PHP-Community

mehr erfahren

Tutorial veröffentlichen

Warning: Undefined variabl

Your article presents comprehensive and comprehensible information. I gained knowledge from this article that I had previously lacked. While I gen ...

Geschrieben von poppy12 am 30.05.2024 09:58:23
Forum: PHP Developer Forum
PHP 8.3.3 - App kann auf dem PC nicht ausgeführt werden

Many thanks for the valuable information you provide. In the future, I hope you will continue to provide everyone with as many excellent postings ...

Geschrieben von poppy12 am 30.05.2024 09:56:42
Forum: PHP Developer Forum
Schleifenproblem für MYSQL mit gleichen INPUT Feldnamen

This one-of-a-kind game has sparked a lot of attention. In poppy playtime (https://poppy-playtime.io), you must visit the Playtime toy factory. Th ...

Geschrieben von poppy12 am 30.05.2024 09:54:26
Forum: PHP Developer Forum
Seite neu Laden

Thank you very much for the excellent information you provided. In the future, I hope you will continue to provide everyone with as many fantastic ...

Geschrieben von dordle2 am 30.05.2024 09:52:03
Forum: Fragen/Vorschläge zum Forum