Does insert() always select the inserted data?

netteman
Member | 128
+
0
-

Hi,

this code runs two queries. Is there a way to get rid off the select query? Thanks :)

<?php

namespace App\Presenters;


class HomepagePresenter extends BasePresenter
{

	/** @var \Nette\Database\Context @inject */
	public $database;

	public function renderDefault()
	{
		$this->database->table('test')
			->insert(['article' => 'New article']);
	}

}
?>

INSERT INTO test (article) VALUES (‘New article’)

SELECT * FROM test WHERE (id = ‘2’)

database:
	dsn: 'mysql:host=127.0.0.1;dbname=test'
	user:
	password:
	options:
		lazy: yes

Last edited by netteman (2020-03-07 17:53)