private function get_statement($query, $params = []) {
		if (!$this->connected) {
			$this->connect();
		}

		if (Config::$query_log) {
			$query_log = [$query, $params];
			$this->query_log[] = $query_log;
		}

		if (Config::$query_counter) {
			$this->query_counter++;
		}

		$statement = new Statement($this->database, $query);

		if (count($params) == 0) {
			return $statement;
		}

		$refs = [];
		$types = '';
		foreach ($params as $key => $param) {
			if (is_bool($param)) {
				if ($param == true) {
					$param = 1;
					$params[$key] = 1;
				} else {
					$param = 0;
					$params[$key] = 0;
				}
			}

			switch (true) {
				case is_integer($param):
					$types .= 'i';
					break;
				case is_double($param):
					$types .= 'd';
					break;
				case is_null($param):
				case is_string($param):
					$types .= 's';
					break;
				case is_bool($param):
				case is_array($param):
				case is_object($param):
				case is_resource($param):
					throw new \Exception('Unacceptable type used for bind_param.');
				default:
					throw new \Exception('Unknown type used for bind_param.');
			}

			$refs[$key] = &$params[$key];
		}

		array_unshift($refs, $types);
		call_user_func_array([$statement, 'bind_param'], $refs);
		return $statement;
	}