1: <?php
2:
3: namespace Himedia\Padocc\DB;
4:
5: interface DBAdapterInterface
6: {
7: /**
8: * Returns content of specified column of the first row of query's result.
9: *
10: * @param string $sQuery Query to execute.
11: * @param int $iColumnNumber 0-indexed number of the column you wish to retrieve from the row.
12: * If no value is supplied, PDOStatement::fetchColumn() fetches the first column.
13: * @return string content of specified column of the first row of query's result
14: */
15: public function fetchColumn($sQuery, $iColumnNumber = 0);
16:
17: /**
18: * Fetches the first row of of the specified SQL statement.
19: * The row is an array indexed by column name.
20: * If a result set row contains multiple columns with the same name,
21: * then returns only a single value per column name.
22: *
23: * @param string $sQuery Statement to execute.
24: * @return array returns the first row of of the specified SQL statement.
25: */
26: public function fetchRow($sQuery);
27:
28: /**
29: * Returns an array containing all of the result set rows of the specified SQL statement.
30: * Each row is an array indexed by column name.
31: * If a result set row contains multiple columns with the same name,
32: * then returns only a single value per column name.
33: *
34: * @param string $sQuery Statement to execute.
35: * @return array returns an array containing
36: * all of the remaining rows in the result set. The array represents each
37: * row as an array of column values.
38: */
39: public function fetchAll($sQuery);
40:
41: /**
42: * Executes the specified SQL statement, returning a result set as a PDOStatement object.
43: *
44: * @param string $sQuery Statement to execute.
45: * @return \PDOStatement a PDOStatement object
46: * @throws \PDOException on error
47: */
48: public function query($sQuery);
49:
50: /**
51: * Execute an SQL statement and return the number of affected rows.
52: *
53: * @param string $sQuery The SQL statement to prepare and execute.
54: * @throws \PDOException on error
55: * @return int the number of rows that were modified
56: * or deleted by the SQL statement. If no rows were affected returns 0.
57: */
58: public function exec($sQuery);
59:
60: /**
61: * Prepares a statement for execution and returns a statement object.
62: *
63: * Emulated prepared statements does not communicate with the database server
64: * so prepare() does not check the statement.
65: *
66: * @param string $sQuery SQL statement
67: * @throws \PDOException if error
68: * @return \PDOStatement a PDOStatement object.
69: */
70: public function prepare($sQuery);
71:
72: public function executePreparedStatement(\PDOStatement $oStatement, array $aValues);
73:
74: /**
75: * Returns the ID of the last inserted row or sequence value.
76: *
77: * @param string $sSequenceName [optional] Name of the sequence object from which the ID should be returned.
78: * @return string If a sequence name was not specified returns a
79: * string representing the row ID of the last row that was inserted into
80: * the database, else returns a string representing the last value retrieved from the specified sequence
81: * object.
82: */
83: public function lastInsertId($sSequenceName = null);
84:
85: /**
86: * Quotes a string for use in a query.
87: *
88: * @param string $sValue The string to be quoted.
89: * @param int $iType [optional] Provides a data type hint for drivers that have alternate quoting styles.
90: * @return string a quoted string that is theoretically safe to pass into an
91: * SQL statement.
92: *
93: * Returns <b>FALSE</b> if the driver does not support quoting in
94: * this way.
95: */
96: public function quote($sValue, $iType = \PDO::PARAM_STR);
97:
98: /**
99: * Initiates a transaction.
100: *
101: * @return bool TRUE on success or FALSE on failure.
102: */
103: public function beginTransaction();
104:
105: /**
106: * Rolls back a transaction.
107: *
108: * @return bool TRUE on success or FALSE on failure.
109: */
110: public function rollBack();
111:
112: /**
113: * Commits a transaction.
114: *
115: * @return bool TRUE on success or FALSE on failure.
116: */
117: public function commit();
118:
119: public function formatValue($mValue);
120: }
121: