Passed
Push — master ( 78312e...d7519e )
by Radu
01:19
created

AbstractDatabase   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A lastInsertId() 0 3 1
1
<?php
2
namespace WebServCo\Framework;
3
4
abstract class AbstractDatabase extends \WebServCo\Framework\AbstractLibrary
5
{
6
    const QUERY_TYPE_INSERT = 'INSERT';
7
    const QUERY_TYPE_INSERT_IGNORE = 'INSERT IGNORE';
8
    const QUERY_TYPE_REPLACE = 'REPLACE';
9
    
10
    protected $db;
11
    protected $stmt;
12
    protected $lastInsertId;
13
    protected $rows;
14
    
15
    /**
16
     * Get last inserted Id.
17
     *
18
     * https://dev.mysql.com/doc/refman/5.5/en/information-functions.html#function_last-insert-id
19
     * If you insert multiple rows using a single INSERT statement,
20
     * LAST_INSERT_ID() returns the value generated for the first inserted row only.
21
     * The reason for this is to make it possible to reproduce easily the same
22
     * INSERT statement against some other server.
23
     */
24
    public function lastInsertId()
25
    {
26
        return (int) $this->lastInsertId;
27
    }
28
}
29