Skip to content

Commit

Permalink
Docs: Added Return LastIs and Row Count id the Docs Code
Browse files Browse the repository at this point in the history
  • Loading branch information
DioxideHydrogen committed Aug 19, 2021
1 parent b1e1b22 commit c908bff
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ $h = new \ClanCats\Hydrahon\Builder('mysql', function($query, $queryString, $que
{
return $statement->fetchAll(\PDO::FETCH_ASSOC);
}
// when the query is a instance of a insert return the last inserted id
elseif($query instanceof \ClanCats\Hydrahon\Query\Sql\Insert)
{
return $connection->lastInsertId();
}
// when the query is not a instance of insert or fetchable then
// return the number os rows affected
else
{
return $statement->rowCount();
}
});
```

Expand Down
11 changes: 11 additions & 0 deletions docs/12__Implementation/05_MySQL_PDO_Implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ $h = new \ClanCats\Hydrahon\Builder('mysql', function($query, $queryString, $que
{
return $statement->fetchAll(\PDO::FETCH_ASSOC);
}
// when the query is a instance of a insert return the last inserted id
elseif($query instanceof \ClanCats\Hydrahon\Query\Sql\Insert)
{
return $connection->lastInsertId();
}
// when the query is not a instance of insert or fetchable then
// return the number os rows affected
else
{
return $statement->rowCount();
}
});
```

Expand Down

0 comments on commit c908bff

Please sign in to comment.