This repository has been archived by the owner on Dec 27, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDatabase.php
112 lines (98 loc) · 2.02 KB
/
Database.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php
/**
* Database.php
*
* Author: Larry Li <larryli@qq.com>
*/
namespace larryli\ipv4;
/**
* Class Database
* @package larryli\ipv4\query
*/
abstract class Database extends Object
{
/**
* test table is exists
*
* @param string $table
* @return bool
*/
abstract public function tableExists($table);
/**
* create divisions table
*
* @param string $table
*/
abstract public function createDivisionsTable($table);
/**
* create index table
*
* @param string $table
*/
abstract public function createIndexTable($table);
/**
* clean table
*
* @param string $table
*/
abstract public function cleanTable($table);
/**
* drop table
*
* @param string $table
*/
abstract public function dropTable($table);
/**
* insert division data to table
*
* @param string $table
* @param array $data
*/
abstract public function insertDivisions($table, $data);
/**
* insert division data to table
*
* @param string $table
* @param array $data
*/
abstract public function insertIndexes($table, $data);
/**
* count table data
*
* @param $table
* @return int
*/
abstract public function count($table);
/**
* insert or select page size
*
* @param $table
* @return int
*/
abstract public function size($table);
/**
* get division data by id
*
* @param string $table
* @param integer $id
* @return mixed
*/
abstract public function getDivision($table, $id);
/**
* get index data by ip integer
*
* @param string $table
* @param integer $ip
* @return mixed
*/
abstract public function getIndex($table, $ip);
/**
* gets index data
*
* @param string $table
* @param integer $start
* @param integer $size
* @return mixed
*/
abstract public function getIndexes($table, $start, $size);
}