DBIExtension.int.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <?php
  2. /**
  3. * Contract for every database extension supported by phpMyAdmin
  4. *
  5. * @package PhpMyAdmin-DBI
  6. */
  7. if (! defined('PHPMYADMIN')) {
  8. exit;
  9. }
  10. /**
  11. * Contract for every database extension supported by phpMyAdmin
  12. *
  13. * @package PhpMyAdmin-DBI
  14. */
  15. interface PMA_DBI_Extension
  16. {
  17. /**
  18. * connects to the database server
  19. *
  20. * @param string $user user name
  21. * @param string $password user password
  22. * @param bool $is_controluser whether this is a control user connection
  23. * @param array $server host/port/socket/persistent
  24. * @param bool $auxiliary_connection (when true, don't go back to login if
  25. * connection fails)
  26. *
  27. * @return mixed false on error or a connection object on success
  28. */
  29. public function connect(
  30. $user, $password, $is_controluser = false, $server = null,
  31. $auxiliary_connection = false
  32. );
  33. /**
  34. * selects given database
  35. *
  36. * @param string $dbname database name to select
  37. * @param object $link connection object
  38. *
  39. * @return boolean
  40. */
  41. public function selectDb($dbname, $link = null);
  42. /**
  43. * runs a query and returns the result
  44. *
  45. * @param string $query query to execute
  46. * @param object $link connection object
  47. * @param int $options query options
  48. *
  49. * @return object|bool result
  50. */
  51. public function realQuery($query, $link, $options);
  52. /**
  53. * Run the multi query and output the results
  54. *
  55. * @param object $link connection object
  56. * @param string $query multi query statement to execute
  57. *
  58. * @return result collection | boolean(false)
  59. */
  60. public function realMultiQuery($link, $query);
  61. /**
  62. * returns array of rows with associative and numeric keys from $result
  63. *
  64. * @param object $result result set identifier
  65. *
  66. * @return array
  67. */
  68. public function fetchArray($result);
  69. /**
  70. * returns array of rows with associative keys from $result
  71. *
  72. * @param object $result result set identifier
  73. *
  74. * @return array
  75. */
  76. public function fetchAssoc($result);
  77. /**
  78. * returns array of rows with numeric keys from $result
  79. *
  80. * @param object $result result set identifier
  81. *
  82. * @return array
  83. */
  84. public function fetchRow($result);
  85. /**
  86. * Adjusts the result pointer to an arbitrary row in the result
  87. *
  88. * @param object $result database result
  89. * @param integer $offset offset to seek
  90. *
  91. * @return bool true on success, false on failure
  92. */
  93. public function dataSeek($result, $offset);
  94. /**
  95. * Frees memory associated with the result
  96. *
  97. * @param object $result database result
  98. *
  99. * @return void
  100. */
  101. public function freeResult($result);
  102. /**
  103. * Check if there are any more query results from a multi query
  104. *
  105. * @param object $link the connection object
  106. *
  107. * @return bool true or false
  108. */
  109. public function moreResults($link = null);
  110. /**
  111. * Prepare next result from multi_query
  112. *
  113. * @param object $link the connection object
  114. *
  115. * @return bool true or false
  116. */
  117. public function nextResult($link = null);
  118. /**
  119. * Store the result returned from multi query
  120. *
  121. * @return mixed false when empty results / result set when not empty
  122. */
  123. public function storeResult();
  124. /**
  125. * Returns a string representing the type of connection used
  126. *
  127. * @param object $link mysql link
  128. *
  129. * @return string type of connection used
  130. */
  131. public function getHostInfo($link = null);
  132. /**
  133. * Returns the version of the MySQL protocol used
  134. *
  135. * @param object $link mysql link
  136. *
  137. * @return integer version of the MySQL protocol used
  138. */
  139. public function getProtoInfo($link = null);
  140. /**
  141. * returns a string that represents the client library version
  142. *
  143. * @return string MySQL client library version
  144. */
  145. public function getClientInfo();
  146. /**
  147. * returns last error message or false if no errors occurred
  148. *
  149. * @param object $link connection link
  150. *
  151. * @return string|bool $error or false
  152. */
  153. public function getError($link = null);
  154. /**
  155. * returns the number of rows returned by last query
  156. *
  157. * @param object $result result set identifier
  158. *
  159. * @return string|int
  160. */
  161. public function numRows($result);
  162. /**
  163. * returns last inserted auto_increment id for given $link
  164. * or $GLOBALS['userlink']
  165. *
  166. * @param object $link the connection object
  167. *
  168. * @return string|int
  169. */
  170. public function insertId($link = null);
  171. /**
  172. * returns the number of rows affected by last query
  173. *
  174. * @param object $link the connection object
  175. * @param bool $get_from_cache whether to retrieve from cache
  176. *
  177. * @return string|int
  178. */
  179. public function affectedRows($link = null, $get_from_cache = true);
  180. /**
  181. * returns metainfo for fields in $result
  182. *
  183. * @param object $result result set identifier
  184. *
  185. * @return array meta info for fields in $result
  186. */
  187. public function getFieldsMeta($result);
  188. /**
  189. * return number of fields in given $result
  190. *
  191. * @param object $result result set identifier
  192. *
  193. * @return int field count
  194. */
  195. public function numFields($result);
  196. /**
  197. * returns the length of the given field $i in $result
  198. *
  199. * @param object $result result set identifier
  200. * @param int $i field
  201. *
  202. * @return int length of field
  203. */
  204. public function fieldLen($result, $i);
  205. /**
  206. * returns name of $i. field in $result
  207. *
  208. * @param object $result result set identifier
  209. * @param int $i field
  210. *
  211. * @return string name of $i. field in $result
  212. */
  213. public function fieldName($result, $i);
  214. /**
  215. * returns concatenated string of human readable field flags
  216. *
  217. * @param object $result result set identifier
  218. * @param int $i field
  219. *
  220. * @return string field flags
  221. */
  222. public function fieldFlags($result, $i);
  223. }
  224. ?>