1<?php 2 3namespace Illuminate\Database; 4 5use Closure; 6 7interface ConnectionInterface 8{ 9 /** 10 * Begin a fluent query against a database table. 11 * 12 * @param string $table 13 * @return \Illuminate\Database\Query\Builder 14 */ 15 public function table($table); 16 17 /** 18 * Get a new raw query expression. 19 * 20 * @param mixed $value 21 * @return \Illuminate\Database\Query\Expression 22 */ 23 public function raw($value); 24 25 /** 26 * Run a select statement and return a single result. 27 * 28 * @param string $query 29 * @param array $bindings 30 * @param bool $useReadPdo 31 * @return mixed 32 */ 33 public function selectOne($query, $bindings = [], $useReadPdo = true); 34 35 /** 36 * Run a select statement against the database. 37 * 38 * @param string $query 39 * @param array $bindings 40 * @param bool $useReadPdo 41 * @return array 42 */ 43 public function select($query, $bindings = [], $useReadPdo = true); 44 45 /** 46 * Run a select statement against the database and returns a generator. 47 * 48 * @param string $query 49 * @param array $bindings 50 * @param bool $useReadPdo 51 * @return \Generator 52 */ 53 public function cursor($query, $bindings = [], $useReadPdo = true); 54 55 /** 56 * Run an insert statement against the database. 57 * 58 * @param string $query 59 * @param array $bindings 60 * @return bool 61 */ 62 public function insert($query, $bindings = []); 63 64 /** 65 * Run an update statement against the database. 66 * 67 * @param string $query 68 * @param array $bindings 69 * @return int 70 */ 71 public function update($query, $bindings = []); 72 73 /** 74 * Run a delete statement against the database. 75 * 76 * @param string $query 77 * @param array $bindings 78 * @return int 79 */ 80 public function delete($query, $bindings = []); 81 82 /** 83 * Execute an SQL statement and return the boolean result. 84 * 85 * @param string $query 86 * @param array $bindings 87 * @return bool 88 */ 89 public function statement($query, $bindings = []); 90 91 /** 92 * Run an SQL statement and get the number of rows affected. 93 * 94 * @param string $query 95 * @param array $bindings 96 * @return int 97 */ 98 public function affectingStatement($query, $bindings = []); 99 100 /** 101 * Run a raw, unprepared query against the PDO connection. 102 * 103 * @param string $query 104 * @return bool 105 */ 106 public function unprepared($query); 107 108 /** 109 * Prepare the query bindings for execution. 110 * 111 * @param array $bindings 112 * @return array 113 */ 114 public function prepareBindings(array $bindings); 115 116 /** 117 * Execute a Closure within a transaction. 118 * 119 * @param \Closure $callback 120 * @param int $attempts 121 * @return mixed 122 * 123 * @throws \Throwable 124 */ 125 public function transaction(Closure $callback, $attempts = 1); 126 127 /** 128 * Start a new database transaction. 129 * 130 * @return void 131 */ 132 public function beginTransaction(); 133 134 /** 135 * Commit the active database transaction. 136 * 137 * @return void 138 */ 139 public function commit(); 140 141 /** 142 * Rollback the active database transaction. 143 * 144 * @return void 145 */ 146 public function rollBack(); 147 148 /** 149 * Get the number of active transactions. 150 * 151 * @return int 152 */ 153 public function transactionLevel(); 154 155 /** 156 * Execute the given callback in "dry run" mode. 157 * 158 * @param \Closure $callback 159 * @return array 160 */ 161 public function pretend(Closure $callback); 162} 163