1: <?php
2:
3: /**
4: * Picon Framework
5: * http://code.google.com/p/picon-framework/
6: *
7: * Copyright (C) 2011-2012 Martin Cassidy <martin.cassidy@webquub.com>
8:
9: * Picon Framework is free software: you can redistribute it and/or modify
10: * it under the terms of the GNU General Public License as published by
11: * the Free Software Foundation, either version 3 of the License, or
12: * (at your option) any later version.
13:
14: * Picon Framework is distributed in the hope that it will be useful,
15: * but WITHOUT ANY WARRANTY; without even the implied warranty of
16: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17: * General Public License for more details.
18:
19: * You should have received a copy of the GNU General Public License
20: * along with Picon Framework. If not, see <http://www.gnu.org/licenses/>.
21: * */
22:
23: namespace picon;
24:
25: /**
26: * A database driver implements internally the PHP functions and methods
27: * required when working with a particular DBMS or PHP extension
28: *
29: * All errors within a driver should be thrown as exceptions for handling
30: * by the class using the driver
31: *
32: * @author Martin Cassidy
33: * @package database/driver
34: */
35: interface DatabaseDriver
36: {
37: /**
38: * Establish a connection with given settings
39: * @return resource the connection
40: */
41: function connect($host, $username, $password, $database, $port = null);
42:
43: /**
44: * Disconnect the given connection
45: */
46: function dissconnect($connection);
47:
48: /**
49: * Run a query on the connection
50: */
51: function query($sql, $connection);
52:
53: /**
54: * Get a result set iterator for the result reference
55: * generated by query()
56: */
57: function resultSetObject($resultResource, $className = null);
58:
59: /**
60: * Get the number of rows affected by the last query
61: */
62: function getAffectedRows($connection);
63:
64: function getInsertedId($connection);
65:
66: /**
67: * Get a result set iterator containing an array for the result reference
68: */
69: function resultSetArray($resultResource);
70:
71: function countRows($resultResource);
72:
73: function countColumns($resultResource);
74: }
75:
76: ?>
77: