Completed
Push — 9.0-dev ( 007112...d6cf5f )
by Radu
01:33
created

AbstractDatabase   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 1
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A lastInsertId() 0 4 1
1
<?php
2
namespace WebServCo\Framework;
3
4
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
    public function __construct($config)
16
    {
17
        parent::__construct($config);
18
    }
19
    
20
    /**
21
     * Get last inserted Id.
22
     *
23
     * https://dev.mysql.com/doc/refman/5.5/en/information-functions.html#function_last-insert-id
24
     * If you insert multiple rows using a single INSERT statement,
25
     * LAST_INSERT_ID() returns the value generated for the first inserted row only.
26
     * The reason for this is to make it possible to reproduce easily the same
27
     * INSERT statement against some other server.
28
     */
29
    public function lastInsertId()
30
    {
31
        return (int) $this->lastInsertId;
32
    }
33
}
34