Skip to content

Commit f7dd3f2

Browse files
authored
Merge pull request #5380 from kenjis/fix-docs-query_builder.rst
docs: fix getCompiledInsert() explanation in query_builder.rst
2 parents e90d0c4 + 0f3ce86 commit f7dd3f2

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

user_guide_src/source/database/query_builder.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -886,25 +886,23 @@ Example::
886886
'date' => 'My date',
887887
];
888888

889-
$sql = $builder->set($data)->getCompiledInsert('mytable');
889+
$sql = $builder->set($data)->getCompiledInsert();
890890
echo $sql;
891891

892892
// Produces string: INSERT INTO mytable (`title`, `name`, `date`) VALUES ('My title', 'My name', 'My date')
893893

894-
The second parameter enables you to set whether or not the query builder query
894+
The first parameter enables you to set whether or not the query builder query
895895
will be reset (by default it will be--just like ``$builder->insert()``)::
896896

897-
echo $builder->set('title', 'My Title')->getCompiledInsert('mytable', false);
897+
echo $builder->set('title', 'My Title')->getCompiledInsert(false);
898898

899899
// Produces string: INSERT INTO mytable (`title`) VALUES ('My Title')
900900

901901
echo $builder->set('content', 'My Content')->getCompiledInsert();
902902

903903
// Produces string: INSERT INTO mytable (`title`, `content`) VALUES ('My Title', 'My Content')
904904

905-
The key thing to notice in the above example is that the second query did not
906-
utilize ``$builder->from()`` nor did it pass a table name into the first
907-
parameter. The reason this worked is that the query has not been executed
905+
The reason the second query worked is that the query has not been executed
908906
using ``$builder->insert()`` which resets values or reset directly using
909907
``$builder->resetQuery()``.
910908

0 commit comments

Comments
 (0)