Passed
Push — master ( f17b13...8bf1e0 )
by Radu
01:33
created

AbstractDatabase::lastInsertId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace WebServCo\Framework\Database;
3
4
abstract class AbstractDatabase extends \WebServCo\Framework\AbstractLibrary
5
{
6
    protected $db;
7
    protected $stmt;
8
    protected $lastInsertId;
9
    protected $rows;
10
11
    /**
12
     * Get last inserted Id.
13
     *
14
     * https://dev.mysql.com/doc/refman/5.5/en/information-functions.html#function_last-insert-id
15
     * If you insert multiple rows using a single INSERT statement,
16
     * LAST_INSERT_ID() returns the value generated for the first inserted row only.
17
     * The reason for this is to make it possible to reproduce easily the same
18
     * INSERT statement against some other server.
19
     */
20
    public function lastInsertId()
21
    {
22
        return (int) $this->lastInsertId;
23
    }
24
}
25