Skip to content

Commit 5f811ba

Browse files
committed
updated docs
1 parent 2b0018b commit 5f811ba

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

user_guide_src/source/database/query_builder.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,22 @@ The first parameter is an object.
622622

623623
.. note:: All values are escaped automatically producing safer queries.
624624

625+
**$builder->ignore()**
626+
627+
Generates an insert ignore string based on the data you supply, and runs the
628+
query. So if an entry with the same primary key already exists, the query won't be inserted.
629+
You can optionally pass an **boolean** to the function. Here is an example using the array of the above example::
630+
631+
$data = [
632+
'title' => 'My title',
633+
'name' => 'My Name',
634+
'date' => 'My date'
635+
];
636+
637+
$builder->ignore(true)->insert($data);
638+
// Produces: INSERT OR IGNORE INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')
639+
640+
625641
**$builder->getCompiledInsert()**
626642

627643
Compiles the insertion query just like $builder->insert() but does not

0 commit comments

Comments
 (0)