Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:118872 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 35201 invoked from network); 23 Oct 2022 23:48:02 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 23 Oct 2022 23:48:02 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 598351804A9 for ; Sun, 23 Oct 2022 16:48:01 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS16276 91.121.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from mail.kd2.org (citrouille.kd2.org [91.121.181.110]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sun, 23 Oct 2022 16:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=bohwaz.net; s=mail; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID: Subject:To:From:Date:Sender:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=oOyLnu89cFfgcJRsONzqO5SOpZpUYDywUSRmyGvcyv4=; b=NY5/CsC8BtZwhAeR0V8/iASuIx zpf1ZVyF6pLQRObwjTeMqa66DnyXzWkKvmtLLln0pLIObeFwgl3u3ki/K5hBuQWvVmm9j8xXYc7DG O8x1uZN9yX4WY52RexuS5SMlHrONEr2F4P6ECaNvPReCtDYb9/AILBhaAJOjj4dNn/NU=; Received: from 233.107.23.93.rev.sfr.net ([93.23.107.233] helo=platypus) by mail.kd2.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1omkhC-0061Xr-BS for internals@lists.php.net; Mon, 24 Oct 2022 01:47:58 +0200 Date: Mon, 24 Oct 2022 01:47:51 +0200 To: internals@lists.php.net Message-ID: <20221024014751.155ca5ef@platypus> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) X-Face: #"dGtXaYpS9,C:d{FJZ<@4|;AL[R;I`|\;HN}zkw(rmBsu$)Dhed/z8e%U@Ra@JQ;,Nx?Xopxa+:gb?}efqG\/7TnBPHBRjU^g}$;rL4"jYrE#M^%*(?;Qb{HHbOf"q}bnOjU.'SEL:||\2*swZ>NN9pe(pnejy{ijk9%/8session('test_table'); /* same as: $session = new SQLite3Session($db); $session->attach('test_table); */ $db->query('INSERT INTO test_table VALUES (42);'); $changeset = session->getChangeset(); file_put_contents('change.set', (string) $changeset); unset($changeset, $session); // ... $changeset = SQLite3Changeset::load(file_get_contents('change.set')); $operations = [ SQLite3::INSERT => 'INSERT', SQLite3::UPDATE => 'UPDATE', SQLite3::DELETE => 'DELETE', ]; foreach ($changeset->iterate() as $change) { printf("%s on table '%s':\nOLD: %s\nNEW: %s\nPK: %s\n\n", $operations[$change['operation']], $change['table'], json_encode($change['old'], JSON_PRETTY_PRINT), json_encode($change['new'], JSON_PRETTY_PRINT), json_encode($change['pk'], JSON_PRETTY_PRINT) ); } $changeset->invert(); $changeset->apply($db); == Stub: == (string), // table name 'operation' => (int), // operation type 'old' => (array), // Old column values 'new' => (array), // New column values 'pk' => (array), // List of PK columns */ public function iterate(): iterator {} /** @tentative-return-type */ public function apply(SQLite3 $db, ?callable $table_filter_callback = null, ?callable $conflict_callback = null): void {} /** @tentative-return-type */ public function concat(SQLite3Changeset $changeset): void {} /** @tentative-return-type */ public function invert(): void {} }