diff --git a/api/0.6.0/DB.html b/api/0.6.0/DB.html new file mode 100644 index 0000000..8c5dbaf --- /dev/null +++ b/api/0.6.0/DB.html @@ -0,0 +1,778 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = ""; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">module</span> DB + +</h1> + + + + + + <h2>Overview</h2> + + <p>The DB module is a unified interface for database access. +Individual database systems are supported by specific database driver shards.</p> + +<p>Available drivers include:</p> + +<ul><li><a href="https://github.com/crystal-lang/crystal-sqlite3" target="_blank">crystal-lang/crystal-sqlite3</a> for SQLite</li><li><a href="https://github.com/crystal-lang/crystal-mysql" target="_blank">crystal-lang/crystal-mysql</a> for MySQL and MariaDB</li><li><a href="https://github.com/will/crystal-pg" target="_blank">will/crystal-pg</a> for PostgreSQL</li><li><a href="https://github.com/kaukas/crystal-cassandra" target="_blank">kaukas/crystal-cassandra</a> for Cassandra</li></ul> + +<p>For basic instructions on implementing a new database driver, check <code><a href="DB/Driver.html">Driver</a></code> and the existing drivers.</p> + +<p>DB manages a connection pool. The connection pool can be configured by query parameters to the +connection <code>URI</code> as described in <code><a href="DB/Database.html">Database</a></code>.</p> + +<h3>Usage</h3> + +<p>Assuming <code>crystal-sqlite3</code> is included a SQLite3 database can be opened with <code><a href="DB.html#open(uri:URI%7CString)-class-method">#open</a></code>.</p> + +<pre><code>db <span class="o">=</span> <span class="t">DB</span>.open <span class="s">"sqlite3:./path/to/db/file.db"</span> +db.close</code></pre> + +<p>If a block is given to <code><a href="DB.html#open(uri:URI%7CString)-class-method">#open</a></code> the database is closed automatically</p> + +<pre><code><span class="t">DB</span>.open <span class="s">"sqlite3:./file.db"</span> <span class="k">do</span> <span class="o">|</span>db<span class="o">|</span> + <span class="c"># work with db</span> +<span class="k">end</span> <span class="c"># db is closed</span></code></pre> + +<p>In the code above <code>db</code> is a <code><a href="DB/Database.html">Database</a></code>. Methods available for querying it are described in <code><a href="DB/QueryMethods.html">QueryMethods</a></code>.</p> + +<p>Three kind of statements can be performed:</p> + +<ol><li><code>Database#exec</code> waits no response from the database.</li><li><code>Database#scalar</code> reads a single value of the response.</li><li><code>Database#query</code> returns a ResultSet that allows iteration over the rows in the response and column information.</li></ol> + +<p>All of the above methods allows parametrised query. Either positional or named arguments.</p> + +<p>Check a full working version:</p> + +<p>The following example uses SQLite where <code>?</code> indicates the arguments. If PostgreSQL is used <code>$1</code>, <code>$2</code>, etc. should be used. <code>crystal-db</code> does not interpret the statements.</p> + +<pre><code><span class="k">require</span> <span class="s">"db"</span> +<span class="k">require</span> <span class="s">"sqlite3"</span> + +<span class="t">DB</span>.open <span class="s">"sqlite3:./file.db"</span> <span class="k">do</span> <span class="o">|</span>db<span class="o">|</span> + <span class="c"># When using the pg driver, use $1, $2, etc. instead of ?</span> + db.exec <span class="s">"create table contacts (name text, age integer)"</span> + db.exec <span class="s">"insert into contacts values (?, ?)"</span>, <span class="s">"John Doe"</span>, <span class="n">30</span> + + args <span class="o">=</span> <span class="o">[]</span> <span class="k">of</span> <span class="t">DB</span><span class="t">::</span><span class="t">Any</span> + args <span class="o"><<</span> <span class="s">"Sarah"</span> + args <span class="o"><<</span> <span class="n">33</span> + db.exec <span class="s">"insert into contacts values (?, ?)"</span>, args + + puts <span class="s">"max age:"</span> + puts db.scalar <span class="s">"select max(age) from contacts"</span> <span class="c"># => 33</span> + + puts <span class="s">"contacts:"</span> + db.query <span class="s">"select name, age from contacts order by age desc"</span> <span class="k">do</span> <span class="o">|</span>rs<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span>rs.column_name(<span class="n">0</span>)<span class="i">}</span><span class="s"> (</span><span class="i">#{</span>rs.column_name(<span class="n">1</span>)<span class="i">}</span><span class="s">)"</span> + <span class="c"># => name (age)</span> + rs.each <span class="k">do</span> + puts <span class="s">"</span><span class="i">#{</span>rs.read(<span class="t">String</span>)<span class="i">}</span><span class="s"> (</span><span class="i">#{</span>rs.read(<span class="t">Int32</span>)<span class="i">}</span><span class="s">)"</span> + <span class="c"># => Sarah (33)</span> + <span class="c"># => John Doe (30)</span> + <span class="k">end</span> + <span class="k">end</span> +<span class="k">end</span></code></pre> + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L77" target="_blank"> + db.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L3" target="_blank"> + db/pool.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/string_key_cache.cr#L1" target="_blank"> + db/string_key_cache.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L1" target="_blank"> + db/query_methods.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L1" target="_blank"> + db/session_methods.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/disposable.cr#L1" target="_blank"> + db/disposable.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/driver.cr#L1" target="_blank"> + db/driver.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L1" target="_blank"> + db/statement.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/begin_transaction.cr#L1" target="_blank"> + db/begin_transaction.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr#L1" target="_blank"> + db/connection_context.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr#L1" target="_blank"> + db/connection.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L1" target="_blank"> + db/transaction.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L1" target="_blank"> + db/pool_statement.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L4" target="_blank"> + db/database.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_prepared_statement.cr#L1" target="_blank"> + db/pool_prepared_statement.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_unprepared_statement.cr#L1" target="_blank"> + db/pool_unprepared_statement.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L1" target="_blank"> + db/result_set.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr#L1" target="_blank"> + db/error.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/mapping.cr#L1" target="_blank"> + db/mapping.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L9" target="_blank"> + spec.cr + </a> + + <br/> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/version.cr#L1" target="_blank"> + db/version.cr + </a> + + <br/> + + + + + + <h2>Constant Summary</h2> + + <dl> + + <dt class="entry-const" id="TYPES"> + <strong>TYPES</strong> = <code>[<span class="t">Nil</span>, <span class="t">String</span>, <span class="t">Bool</span>, <span class="t">Int32</span>, <span class="t">Int64</span>, <span class="t">Float32</span>, <span class="t">Float64</span>, <span class="t">Time</span>, <span class="t">Bytes</span>]</code> + </dt> + + <dd class="entry-const-doc"> + <p>Types supported to interface with database driver. +These can be used in any <code><a href="DB/ResultSet.html#read(**types:Class)-instance-method">ResultSet#read</a></code> or any <code>Database#query</code> related +method to be used as query parameters</p> + </dd> + + + <dt class="entry-const" id="VERSION"> + <strong>VERSION</strong> = <code><span class="s">"0.6.0"</span></code> + </dt> + + + </dl> + + + + + + <h2>Class Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#connect(uri:URI%7CString)-class-method" class="signature"><strong>.connect</strong>(uri : URI | String)</a> + + <div class="summary"><p>Opens a connection using the specified <em>uri</em>.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#connect(uri:URI%7CString,&block)-class-method" class="signature"><strong>.connect</strong>(uri : URI | String, &block)</a> + + <div class="summary"><p>Opens a connection using the specified <em>uri</em>.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#open(uri:URI%7CString)-class-method" class="signature"><strong>.open</strong>(uri : URI | String)</a> + + <div class="summary"><p>Creates a <code><a href="DB/Database.html">Database</a></code> pool and opens initial connection(s) as specified in the connection <em>uri</em>.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#open(uri:URI%7CString,&block)-class-method" class="signature"><strong>.open</strong>(uri : URI | String, &block)</a> + + <div class="summary"><p>Same as <code><a href="DB.html#open(uri:URI%7CString)-class-method">#open</a></code> but the database is yielded and closed automatically at the end of the block.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#register_driver(driver_name,driver_class:Driver.class)-class-method" class="signature"><strong>.register_driver</strong>(driver_name, driver_class : <span class="t">Driver</span>.<span class="k">class</span>)</a> + + <div class="summary"><p>Registers a driver class for a given <em>driver_name</em>.</p></div> + + </li> + + </ul> + + + + + + <h2>Macro Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#mapping(properties,strict=true)-macro" class="signature"><strong>mapping</strong>(properties, strict = <span class="n">true</span>)</a> + + <div class="summary"><p>The <code><a href="DB.html#mapping(**properties)-macro">DB.mapping</a></code> macro defines how an object is built from a <code><a href="DB/ResultSet.html">ResultSet</a></code>.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#mapping(**properties)-macro" class="signature"><strong>mapping</strong>(**properties)</a> + + </li> + + </ul> + + + +<div class="methods-inherited"> + +</div> + + + + + <h2>Class Method Detail</h2> + + <div class="entry-detail" id="connect(uri:URI|String)-class-method"> + <div class="signature"> + + def self.<strong>connect</strong>(uri : URI | String) + + <a class="method-permalink" href="#connect(uri:URI%7CString)-class-method">#</a> + </div> + + <div class="doc"><p>Opens a connection using the specified <em>uri</em>. +The scheme of the <em>uri</em> determines the driver to use. +Returned connection must be closed by <code>Connection#close</code>. +If a block is used the connection is yielded and closed automatically.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L133" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="connect(uri:URI|String,&block)-class-method"> + <div class="signature"> + + def self.<strong>connect</strong>(uri : URI | String, &block) + + <a class="method-permalink" href="#connect(uri:URI%7CString,&block)-class-method">#</a> + </div> + + <div class="doc"><p>Opens a connection using the specified <em>uri</em>. +The scheme of the <em>uri</em> determines the driver to use. +Returned connection must be closed by <code>Connection#close</code>. +If a block is used the connection is yielded and closed automatically.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L138" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="open(uri:URI|String)-class-method"> + <div class="signature"> + + def self.<strong>open</strong>(uri : URI | String) + + <a class="method-permalink" href="#open(uri:URI%7CString)-class-method">#</a> + </div> + + <div class="doc"><p>Creates a <code><a href="DB/Database.html">Database</a></code> pool and opens initial connection(s) as specified in the connection <em>uri</em>. +Use <code><a href="DB.html#connect(uri:URI%7CString)-class-method">DB#connect</a></code> to open a single connection.</p> + +<p>The scheme of the <em>uri</em> determines the driver to use. +Connection parameters such as hostname, user, database name, etc. are specified according +to each database driver's specific format.</p> + +<p>The returned database must be closed by <code><a href="DB/Database.html#close-instance-method">Database#close</a></code>.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L115" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="open(uri:URI|String,&block)-class-method"> + <div class="signature"> + + def self.<strong>open</strong>(uri : URI | String, &block) + + <a class="method-permalink" href="#open(uri:URI%7CString,&block)-class-method">#</a> + </div> + + <div class="doc"><p>Same as <code><a href="DB.html#open(uri:URI%7CString)-class-method">#open</a></code> but the database is yielded and closed automatically at the end of the block.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L120" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="register_driver(driver_name,driver_class:Driver.class)-class-method"> + <div class="signature"> + + def self.<strong>register_driver</strong>(driver_name, driver_class : <span class="t">Driver</span>.<span class="k">class</span>) + + <a class="method-permalink" href="#register_driver(driver_name,driver_class:Driver.class)-class-method">#</a> + </div> + + <div class="doc"><p>Registers a driver class for a given <em>driver_name</em>. +Should be called by drivers implementors only.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L99" target="_blank">View source</a>] + + </div> + </div> + + + + + + + <h2>Macro Detail</h2> + + <div class="entry-detail" id="mapping(properties,strict=true)-macro"> + <div class="signature"> + + macro <strong>mapping</strong>(properties, strict = <span class="n">true</span>) + + <a class="method-permalink" href="#mapping(properties,strict=true)-macro">#</a> + </div> + + <div class="doc"><p>The <code><a href="DB.html#mapping(**properties)-macro">DB.mapping</a></code> macro defines how an object is built from a <code><a href="DB/ResultSet.html">ResultSet</a></code>.</p> + +<p>It takes hash literal as argument, in which attributes and types are defined. +Once defined, <code><a href="DB/ResultSet.html#read(type:DB::Mappable.class)-instance-method">ResultSet#read(t)</a></code> populates properties of the class from the +<code><a href="DB/ResultSet.html">ResultSet</a></code>.</p> + +<pre><code class="language-crystal"><span class="k">require</span> <span class="s">"db"</span> + +<span class="k">class</span> <span class="t">Employee</span> + <span class="t">DB</span>.mapping({ + title: <span class="t">String</span>, + name: <span class="t">String</span>, + }) +<span class="k">end</span> + +employees <span class="o">=</span> <span class="t">Employee</span>.from_rs(db.query(<span class="s">"SELECT title, name FROM employees"</span>)) +employees[<span class="n">0</span>].title <span class="c"># => "Manager"</span> +employees[<span class="n">0</span>].name <span class="c"># => "John"</span></code></pre> + +<p>Attributes not mapped with <code><a href="DB.html#mapping(**properties)-macro">DB.mapping</a></code> are not defined as properties. +Also, missing attributes raise a <code><a href="DB/MappingException.html">DB::MappingException</a></code>.</p> + +<p>You can also define attributes for each property.</p> + +<pre><code class="language-crystal"><span class="k">class</span> <span class="t">Employee</span> + <span class="t">DB</span>.mapping({ + title: <span class="t">String</span>, + name: { + <span class="k">type</span>: <span class="t">String</span>, + nilable: <span class="n">true</span>, + key: <span class="s">"firstname"</span>, + }, + }) +<span class="k">end</span></code></pre> + +<p>Available attributes:</p> + +<ul><li><em>type</em> (required) defines its type. In the example above, <em>title: String</em> is a shortcut to <em>title: {type: String}</em>.</li><li><em>nilable</em> defines if a property can be a <code>Nil</code>.</li><li><strong>default</strong>: value to use if the property is missing in the result set, or if it's <code>null</code> and <code>nilable</code> was not set to <code>true</code>. If the default value creates a new instance of an object (for example <code>[1, 2, 3]</code> or <code>SomeObject.new</code>), a different instance will be used each time a row is parsed.</li><li><em>key</em> defines which column to read from a <code><a href="DB/ResultSet.html">ResultSet</a></code>. It defaults to the name of the property.</li><li><em>converter</em> takes an alternate type for parsing. It requires a <code>#from_rs</code> method in that class, and returns an instance of the given type.</li></ul> + +<p>The mapping also automatically defines Crystal properties (getters and setters) for each +of the keys. It doesn't define a constructor accepting those arguments, but you can provide +an overload.</p> + +<p>The macro basically defines a constructor accepting a <code><a href="DB/ResultSet.html">ResultSet</a></code> that reads from +it and initializes this type's instance variables.</p> + +<p>This macro also declares instance variables of the types given in the mapping.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/mapping.cr#L60" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="mapping(**properties)-macro"> + <div class="signature"> + + macro <strong>mapping</strong>(**properties) + + <a class="method-permalink" href="#mapping(**properties)-macro">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/mapping.cr#L151" target="_blank">View source</a>] + + </div> + </div> + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/Any.html b/api/0.6.0/DB/Any.html new file mode 100644 index 0000000..de7fdb9 --- /dev/null +++ b/api/0.6.0/DB/Any.html @@ -0,0 +1,304 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::Any - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">alias</span> DB::Any + +</h1> + + + + + + + + <h2>Alias Definition</h2> + <code>Bool | Float32 | Float64 | Int32 | Int64 | Slice(UInt8) | String | Time | Nil</code> + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L84" target="_blank"> + db.cr + </a> + + <br/> + + + + + + + + + + + + + + +<div class="methods-inherited"> + +</div> + + + + + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/BeginTransaction.html b/api/0.6.0/DB/BeginTransaction.html new file mode 100644 index 0000000..7b084f3 --- /dev/null +++ b/api/0.6.0/DB/BeginTransaction.html @@ -0,0 +1,375 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::BeginTransaction - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">module</span> DB::BeginTransaction + +</h1> + + + + + + + + + + + + + + + + <h2>Direct including types</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/Connection.html">DB::Connection</a></li> + + <li class="other-type"><a href="../DB/Transaction.html">DB::Transaction</a></li> + + </ul> + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/begin_transaction.cr#L2" target="_blank"> + db/begin_transaction.cr + </a> + + <br/> + + + + + + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#begin_transaction:Transaction-instance-method" class="signature"><strong>#begin_transaction</strong> : Transaction</a> + + <div class="summary"><p>Creates a transaction from the current context.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#transaction(&block)-instance-method" class="signature"><strong>#transaction</strong>(&block)</a> + + <div class="summary"><p>yields a transaction from the current context.</p></div> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + +</div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="begin_transaction:Transaction-instance-method"> + <div class="signature"> + abstract + def <strong>begin_transaction</strong> : <a href="../DB/Transaction.html">Transaction</a> + + <a class="method-permalink" href="#begin_transaction:Transaction-instance-method">#</a> + </div> + + <div class="doc"><p>Creates a transaction from the current context. +If is expected that either <code><a href="../DB/Transaction.html#commit-instance-method">Transaction#commit</a></code> or <code><a href="../DB/Transaction.html#rollback-instance-method">Transaction#rollback</a></code> +are called explicitly to release the context.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/begin_transaction.cr#L6" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="transaction(&block)-instance-method"> + <div class="signature"> + + def <strong>transaction</strong>(&block) + + <a class="method-permalink" href="#transaction(&block)-instance-method">#</a> + </div> + + <div class="doc"><p>yields a transaction from the current context. +Query the database through <code><a href="../DB/Transaction.html#connection:Connection-instance-method">Transaction#connection</a></code> object. +If an exception is thrown within the block a rollback is performed. +The exception thrown is bubbled unless it is a <code><a href="../DB/Rollback.html">DB::Rollback</a></code>. +From the yielded object <code><a href="../DB/Transaction.html#commit-instance-method">Transaction#commit</a></code> or <code><a href="../DB/Transaction.html#rollback-instance-method">Transaction#rollback</a></code> +can be called explicitly.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/begin_transaction.cr#L14" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/Connection.html b/api/0.6.0/DB/Connection.html new file mode 100644 index 0000000..4bd7648 --- /dev/null +++ b/api/0.6.0/DB/Connection.html @@ -0,0 +1,602 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::Connection - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">abstract class</span> DB::Connection + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/Connection.html">DB::Connection</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>Database driver implementors must subclass <code><a href="../DB/Connection.html">Connection</a></code>.</p> + +<p>Represents one active connection to a database.</p> + +<p>Users should never instantiate a <code><a href="../DB/Connection.html">Connection</a></code> manually. Use <code><a href="../DB.html#open(uri:URI%7CString)-class-method">DB#open</a></code> or <code>Database#connection</code>.</p> + +<p>Refer to <code><a href="../DB/QueryMethods.html">QueryMethods</a></code> for documentation about querying the database through this connection.</p> + +<h3>Note to implementors</h3> + +<p>The connection must be initialized in <code>#initialize</code> and closed in <code>#do_close</code>.</p> + +<p>Override <code>#build_prepared_statement</code> method in order to return a prepared <code><a href="../DB/Statement.html">Statement</a></code> to allow querying. +Override <code>#build_unprepared_statement</code> method in order to return a unprepared <code><a href="../DB/Statement.html">Statement</a></code> to allow querying. +See also <code><a href="../DB/Statement.html">Statement</a></code> to define how the statements are executed.</p> + +<p>If at any give moment the connection is lost a DB::ConnectionLost should be raised. This will +allow the connection pool to try to reconnect or use another connection if available.</p> + + + + + + <h2>Included Modules</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/BeginTransaction.html">DB::BeginTransaction</a></li> + + <li class="other-type"><a href="../DB/Disposable.html">DB::Disposable</a></li> + + <li class="other-type"><a href="../DB/SessionMethods.html">DB::SessionMethods</a>(<a href="../DB/Connection.html">DB::Connection</a>, <a href="../DB/Statement.html">DB::Statement</a>)</li> + + </ul> + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr#L21" target="_blank"> + db/connection.cr + </a> + + <br/> + + + + + + + <h2>Constructors</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new(context:ConnectionContext)-class-method" class="signature"><strong>.new</strong>(context : ConnectionContext)</a> + + </li> + + </ul> + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#begin_transaction:Transaction-instance-method" class="signature"><strong>#begin_transaction</strong> : Transaction</a> + + </li> + + <li class="entry-summary"> + <a href="#prepared_statements?:Bool-instance-method" class="signature"><strong>#prepared_statements?</strong> : Bool</a> + + </li> + + <li class="entry-summary"> + <a href="#release-instance-method" class="signature"><strong>#release</strong></a> + + <div class="summary"><p>return this connection to the pool managed by the database.</p></div> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + <h3>Instance methods inherited from module <code><a href="../DB/BeginTransaction.html">DB::BeginTransaction</a></code></h3> + + + <a href="../DB/BeginTransaction.html#begin_transaction:Transaction-instance-method" class="tooltip"> + <span>begin_transaction : Transaction</span> + begin_transaction</a>, + + + <a href="../DB/BeginTransaction.html#transaction(&block)-instance-method" class="tooltip"> + <span>transaction(&block)</span> + transaction</a> + + + + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/SessionMethods.html">DB::SessionMethods</a>(<a href="../DB/Connection.html">DB::Connection</a>, <a href="../DB/Statement.html">DB::Statement</a>)</code></h3> + + + <a href="../DB/SessionMethods.html#build(query):Stmt-instance-method" class="tooltip"> + <span>build(query) : Stmt</span> + build</a>, + + + <a href="../DB/SessionMethods.html#build_unprepared_statement(query):Stmt-instance-method" class="tooltip"> + <span>build_unprepared_statement(query) : Stmt</span> + build_unprepared_statement</a>, + + + <a href="../DB/SessionMethods.html#fetch_or_build_prepared_statement(query):Stmt-instance-method" class="tooltip"> + <span>fetch_or_build_prepared_statement(query) : Stmt</span> + fetch_or_build_prepared_statement</a>, + + + <a href="../DB/SessionMethods.html#prepared(query)-instance-method" class="tooltip"> + <span>prepared(query)<br/>prepared</span> + prepared</a>, + + + <a href="../DB/SessionMethods.html#prepared_statements?:Bool-instance-method" class="tooltip"> + <span>prepared_statements? : Bool</span> + prepared_statements?</a>, + + + <a href="../DB/SessionMethods.html#unprepared(query)-instance-method" class="tooltip"> + <span>unprepared(query)<br/>unprepared</span> + unprepared</a> + + + + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/QueryMethods.html">DB::QueryMethods</a>(<a href="../DB/Statement.html">DB::Statement</a>)</code></h3> + + + <a href="../DB/QueryMethods.html#exec(query,*args)-instance-method" class="tooltip"> + <span>exec(query, *args)</span> + exec</a>, + + + <a href="../DB/QueryMethods.html#query(query,*args)-instance-method" class="tooltip"> + <span>query(query, *args)<br/>query(query, *args, &block)</span> + query</a>, + + + <a href="../DB/QueryMethods.html#query_all(query,*args,astype:Class)-instance-method" class="tooltip"> + <span>query_all(query, *args, as type : Class)<br/>query_all(query, *args, as types : NamedTuple)<br/>query_all(query, *args, &block : ResultSet -> U) : Array(U) forall U<br/>query_all(query, *args, as types : Tuple)</span> + query_all</a>, + + + <a href="../DB/QueryMethods.html#query_each(query,*args,&block)-instance-method" class="tooltip"> + <span>query_each(query, *args, &block)</span> + query_each</a>, + + + <a href="../DB/QueryMethods.html#query_one(query,*args,&block:ResultSet-%3EU):UforallU-instance-method" class="tooltip"> + <span>query_one(query, *args, &block : ResultSet -> U) : U forall U<br/>query_one(query, *args, as types : Tuple)<br/>query_one(query, *args, as types : NamedTuple)<br/>query_one(query, *args, as type : Class)</span> + query_one</a>, + + + <a href="../DB/QueryMethods.html#query_one?(query,*args,astype:Class)-instance-method" class="tooltip"> + <span>query_one?(query, *args, as type : Class)<br/>query_one?(query, *args, as types : NamedTuple)<br/>query_one?(query, *args, as types : Tuple)<br/>query_one?(query, *args, &block : ResultSet -> U) : U? forall U</span> + query_one?</a>, + + + <a href="../DB/QueryMethods.html#scalar(query,*args)-instance-method" class="tooltip"> + <span>scalar(query, *args)</span> + scalar</a> + + + + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/Disposable.html">DB::Disposable</a></code></h3> + + + <a href="../DB/Disposable.html#close-instance-method" class="tooltip"> + <span>close</span> + close</a>, + + + <a href="../DB/Disposable.html#closed?-instance-method" class="tooltip"> + <span>closed?</span> + closed?</a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Constructor Detail</h2> + + <div class="entry-detail" id="new(context:ConnectionContext)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(context : <a href="../DB/ConnectionContext.html">ConnectionContext</a>) + + <a class="method-permalink" href="#new(context:ConnectionContext)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr#L34" target="_blank">View source</a>] + + </div> + </div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="begin_transaction:Transaction-instance-method"> + <div class="signature"> + + def <strong>begin_transaction</strong> : <a href="../DB/Transaction.html">Transaction</a> + + <a class="method-permalink" href="#begin_transaction:Transaction-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr#L49" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="prepared_statements?:Bool-instance-method"> + <div class="signature"> + + def <strong>prepared_statements?</strong> : Bool + + <a class="method-permalink" href="#prepared_statements?:Bool-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr#L32" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="release-instance-method"> + <div class="signature"> + + def <strong>release</strong> + + <a class="method-permalink" href="#release-instance-method">#</a> + </div> + + <div class="doc"><p>return this connection to the pool +managed by the database. Should be used +only if the connection was obtained by <code><a href="../DB/Database.html#checkout-instance-method">Database#checkout</a></code>.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr#L77" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/ConnectionContext.html b/api/0.6.0/DB/ConnectionContext.html new file mode 100644 index 0000000..f3c2786 --- /dev/null +++ b/api/0.6.0/DB/ConnectionContext.html @@ -0,0 +1,418 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::ConnectionContext - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">module</span> DB::ConnectionContext + +</h1> + + + + + + + + + + + + + + + + <h2>Direct including types</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/Database.html">DB::Database</a></li> + + </ul> + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr#L2" target="_blank"> + db/connection_context.cr + </a> + + <br/> + + + + + + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#discard(connection:Connection)-instance-method" class="signature"><strong>#discard</strong>(connection : Connection)</a> + + <div class="summary"><p>Indicates that the <em>connection</em> was permanently closed and should not be used in the future.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#prepared_statements?:Bool-instance-method" class="signature"><strong>#prepared_statements?</strong> : Bool</a> + + <div class="summary"><p>Return whether the statements should be prepared by default</p></div> + + </li> + + <li class="entry-summary"> + <a href="#release(connection:Connection)-instance-method" class="signature"><strong>#release</strong>(connection : Connection)</a> + + <div class="summary"><p>Indicates that the <em>connection</em> is no longer needed and can be reused in the future.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#uri:URI-instance-method" class="signature"><strong>#uri</strong> : URI</a> + + <div class="summary"><p>Returns the uri with the connection settings to the database</p></div> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + +</div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="discard(connection:Connection)-instance-method"> + <div class="signature"> + abstract + def <strong>discard</strong>(connection : <a href="../DB/Connection.html">Connection</a>) + + <a class="method-permalink" href="#discard(connection:Connection)-instance-method">#</a> + </div> + + <div class="doc"><p>Indicates that the <em>connection</em> was permanently closed +and should not be used in the future.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr#L11" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="prepared_statements?:Bool-instance-method"> + <div class="signature"> + abstract + def <strong>prepared_statements?</strong> : Bool + + <a class="method-permalink" href="#prepared_statements?:Bool-instance-method">#</a> + </div> + + <div class="doc"><p>Return whether the statements should be prepared by default</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr#L7" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="release(connection:Connection)-instance-method"> + <div class="signature"> + abstract + def <strong>release</strong>(connection : <a href="../DB/Connection.html">Connection</a>) + + <a class="method-permalink" href="#release(connection:Connection)-instance-method">#</a> + </div> + + <div class="doc"><p>Indicates that the <em>connection</em> is no longer needed +and can be reused in the future.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr#L15" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="uri:URI-instance-method"> + <div class="signature"> + abstract + def <strong>uri</strong> : URI + + <a class="method-permalink" href="#uri:URI-instance-method">#</a> + </div> + + <div class="doc"><p>Returns the uri with the connection settings to the database</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr#L4" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/ConnectionLost.html b/api/0.6.0/DB/ConnectionLost.html new file mode 100644 index 0000000..52dfbb5 --- /dev/null +++ b/api/0.6.0/DB/ConnectionLost.html @@ -0,0 +1,407 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::ConnectionLost - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::ConnectionLost + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/ConnectionLost.html">DB::ConnectionLost</a></li><li class="superclass"><a href="../DB/Error.html">DB::Error</a></li><li class="superclass">Exception</li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>Raised when an established connection is lost +probably due to socket/network issues. +It is used by the connection pool retry logic.</p> + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr#L17" target="_blank"> + db/error.cr + </a> + + <br/> + + + + + + + <h2>Constructors</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new(connection)-class-method" class="signature"><strong>.new</strong>(connection)</a> + + </li> + + </ul> + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#connection:Connection-instance-method" class="signature"><strong>#connection</strong> : Connection</a> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Constructor Detail</h2> + + <div class="entry-detail" id="new(connection)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(connection) + + <a class="method-permalink" href="#new(connection)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr#L20" target="_blank">View source</a>] + + </div> + </div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="connection:Connection-instance-method"> + <div class="signature"> + + def <strong>connection</strong> : <a href="../DB/Connection.html">Connection</a> + + <a class="method-permalink" href="#connection:Connection-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr#L20" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/ConnectionRefused.html b/api/0.6.0/DB/ConnectionRefused.html new file mode 100644 index 0000000..c59b9b7 --- /dev/null +++ b/api/0.6.0/DB/ConnectionRefused.html @@ -0,0 +1,349 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::ConnectionRefused - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::ConnectionRefused + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/ConnectionRefused.html">DB::ConnectionRefused</a></li><li class="superclass"><a href="../DB/Error.html">DB::Error</a></li><li class="superclass">Exception</li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>Raised when a connection is unable to be established +probably due to socket/network or configuration issues. +It is used by the connection pool retry logic.</p> + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr#L27" target="_blank"> + db/error.cr + </a> + + <br/> + + + + + + + + + + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + + + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/Database.html b/api/0.6.0/DB/Database.html new file mode 100644 index 0000000..c7a8929 --- /dev/null +++ b/api/0.6.0/DB/Database.html @@ -0,0 +1,661 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::Database - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::Database + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/Database.html">DB::Database</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>Acts as an entry point for database access. +Connections are managed by a pool. +Use <code><a href="../DB.html#open(uri:URI%7CString)-class-method">DB#open</a></code> to create a <code><a href="../DB/Database.html">Database</a></code> instance.</p> + +<p>Refer to <code><a href="../DB/QueryMethods.html">QueryMethods</a></code> and <code><a href="../DB/SessionMethods.html">SessionMethods</a></code> for documentation about querying the database.</p> + +<h2>Database URI</h2> + +<p>Connection parameters are configured in a URI. The format is specified by the individual +database drivers. See the <a href="https://crystal-lang.org/reference/database/" target="_blank">reference book</a> for examples.</p> + +<p>The connection pool can be configured from URI parameters:</p> + +<ul><li><code>initial_pool_size</code> (default 1)</li><li><code>max_pool_size</code> (default 0 = unlimited)</li><li><code>max_idle_pool_size</code> (default 1)</li><li><code>checkout_timeout</code> (default 5.0)</li><li><code>retry_attempts</code> (default 1)</li><li><code>retry_delay</code> (in seconds, default 1.0)</li></ul></ul> + +<p>When querying a database, prepared statements are used by default. +This can be changed from the <code>prepared_statements</code> URI parameter:</p> + +<ul><li><code>prepared_statements</code> (true, or false, default true)</li></ul></ul> + + + + + + <h2>Included Modules</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/ConnectionContext.html">DB::ConnectionContext</a></li> + + <li class="other-type"><a href="../DB/SessionMethods.html">DB::SessionMethods</a>(<a href="../DB/Database.html">DB::Database</a>, <a href="../DB/PoolStatement.html">DB::PoolStatement</a>)</li> + + </ul> + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L30" target="_blank"> + db/database.cr + </a> + + <br/> + + + + + + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#checkout-instance-method" class="signature"><strong>#checkout</strong></a> + + <div class="summary"><p>returns a connection from the pool the returned connection must be returned to the pool by explictly calling <code><a href="../DB/Connection.html#release-instance-method">Connection#release</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#close-instance-method" class="signature"><strong>#close</strong></a> + + <div class="summary"><p>Closes all connection to the database.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#prepared_statements?:Bool-instance-method" class="signature"><strong>#prepared_statements?</strong> : Bool</a> + + </li> + + <li class="entry-summary"> + <a href="#setup_connection(&proc:Connection-%3ENil)-instance-method" class="signature"><strong>#setup_connection</strong>(&proc : Connection -> Nil)</a> + + </li> + + <li class="entry-summary"> + <a href="#transaction(&block)-instance-method" class="signature"><strong>#transaction</strong>(&block)</a> + + <div class="summary"><p>yields a <code><a href="../DB/Transaction.html">Transaction</a></code> from a connection of the pool Refer to <code><a href="../DB/BeginTransaction.html#transaction(&block)-instance-method">BeginTransaction#transaction</a></code> for documentation.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#uri:URI-instance-method" class="signature"><strong>#uri</strong> : URI</a> + + <div class="summary"><p>Returns the uri with the connection settings to the database</p></div> + + </li> + + <li class="entry-summary"> + <a href="#using_connection(&block)-instance-method" class="signature"><strong>#using_connection</strong>(&block)</a> + + <div class="summary"><p>yields a connection from the pool the connection is returned to the pool when the block ends</p></div> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + <h3>Instance methods inherited from module <code><a href="../DB/ConnectionContext.html">DB::ConnectionContext</a></code></h3> + + + <a href="../DB/ConnectionContext.html#discard(connection:Connection)-instance-method" class="tooltip"> + <span>discard(connection : Connection)</span> + discard</a>, + + + <a href="../DB/ConnectionContext.html#prepared_statements?:Bool-instance-method" class="tooltip"> + <span>prepared_statements? : Bool</span> + prepared_statements?</a>, + + + <a href="../DB/ConnectionContext.html#release(connection:Connection)-instance-method" class="tooltip"> + <span>release(connection : Connection)</span> + release</a>, + + + <a href="../DB/ConnectionContext.html#uri:URI-instance-method" class="tooltip"> + <span>uri : URI</span> + uri</a> + + + + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/SessionMethods.html">DB::SessionMethods</a>(<a href="../DB/Database.html">DB::Database</a>, <a href="../DB/PoolStatement.html">DB::PoolStatement</a>)</code></h3> + + + <a href="../DB/SessionMethods.html#build(query):Stmt-instance-method" class="tooltip"> + <span>build(query) : Stmt</span> + build</a>, + + + <a href="../DB/SessionMethods.html#build_unprepared_statement(query):Stmt-instance-method" class="tooltip"> + <span>build_unprepared_statement(query) : Stmt</span> + build_unprepared_statement</a>, + + + <a href="../DB/SessionMethods.html#fetch_or_build_prepared_statement(query):Stmt-instance-method" class="tooltip"> + <span>fetch_or_build_prepared_statement(query) : Stmt</span> + fetch_or_build_prepared_statement</a>, + + + <a href="../DB/SessionMethods.html#prepared(query)-instance-method" class="tooltip"> + <span>prepared(query)<br/>prepared</span> + prepared</a>, + + + <a href="../DB/SessionMethods.html#prepared_statements?:Bool-instance-method" class="tooltip"> + <span>prepared_statements? : Bool</span> + prepared_statements?</a>, + + + <a href="../DB/SessionMethods.html#unprepared(query)-instance-method" class="tooltip"> + <span>unprepared(query)<br/>unprepared</span> + unprepared</a> + + + + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/QueryMethods.html">DB::QueryMethods</a>(<a href="../DB/PoolStatement.html">DB::PoolStatement</a>)</code></h3> + + + <a href="../DB/QueryMethods.html#exec(query,*args)-instance-method" class="tooltip"> + <span>exec(query, *args)</span> + exec</a>, + + + <a href="../DB/QueryMethods.html#query(query,*args)-instance-method" class="tooltip"> + <span>query(query, *args)<br/>query(query, *args, &block)</span> + query</a>, + + + <a href="../DB/QueryMethods.html#query_all(query,*args,astype:Class)-instance-method" class="tooltip"> + <span>query_all(query, *args, as type : Class)<br/>query_all(query, *args, as types : NamedTuple)<br/>query_all(query, *args, &block : ResultSet -> U) : Array(U) forall U<br/>query_all(query, *args, as types : Tuple)</span> + query_all</a>, + + + <a href="../DB/QueryMethods.html#query_each(query,*args,&block)-instance-method" class="tooltip"> + <span>query_each(query, *args, &block)</span> + query_each</a>, + + + <a href="../DB/QueryMethods.html#query_one(query,*args,&block:ResultSet-%3EU):UforallU-instance-method" class="tooltip"> + <span>query_one(query, *args, &block : ResultSet -> U) : U forall U<br/>query_one(query, *args, as types : Tuple)<br/>query_one(query, *args, as types : NamedTuple)<br/>query_one(query, *args, as type : Class)</span> + query_one</a>, + + + <a href="../DB/QueryMethods.html#query_one?(query,*args,astype:Class)-instance-method" class="tooltip"> + <span>query_one?(query, *args, as type : Class)<br/>query_one?(query, *args, as types : NamedTuple)<br/>query_one?(query, *args, as types : Tuple)<br/>query_one?(query, *args, &block : ResultSet -> U) : U? forall U</span> + query_one?</a>, + + + <a href="../DB/QueryMethods.html#scalar(query,*args)-instance-method" class="tooltip"> + <span>scalar(query, *args)</span> + scalar</a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="checkout-instance-method"> + <div class="signature"> + + def <strong>checkout</strong> + + <a class="method-permalink" href="#checkout-instance-method">#</a> + </div> + + <div class="doc"><p>returns a connection from the pool +the returned connection must be returned +to the pool by explictly calling <code><a href="../DB/Connection.html#release-instance-method">Connection#release</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L123" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="close-instance-method"> + <div class="signature"> + + def <strong>close</strong> + + <a class="method-permalink" href="#close-instance-method">#</a> + </div> + + <div class="doc"><p>Closes all connection to the database.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L71" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="prepared_statements?:Bool-instance-method"> + <div class="signature"> + + def <strong>prepared_statements?</strong> : Bool + + <a class="method-permalink" href="#prepared_statements?:Bool-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L44" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="setup_connection(&proc:Connection->Nil)-instance-method"> + <div class="signature"> + + def <strong>setup_connection</strong>(&proc : <a href="../DB/Connection.html">Connection</a> -> Nil) + + <a class="method-permalink" href="#setup_connection(&proc:Connection-%3ENil)-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L63" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="transaction(&block)-instance-method"> + <div class="signature"> + + def <strong>transaction</strong>(&block) + + <a class="method-permalink" href="#transaction(&block)-instance-method">#</a> + </div> + + <div class="doc"><p>yields a <code><a href="../DB/Transaction.html">Transaction</a></code> from a connection of the pool +Refer to <code><a href="../DB/BeginTransaction.html#transaction(&block)-instance-method">BeginTransaction#transaction</a></code> for documentation.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L131" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="uri:URI-instance-method"> + <div class="signature"> + + def <strong>uri</strong> : URI + + <a class="method-permalink" href="#uri:URI-instance-method">#</a> + </div> + + <div class="doc"><p>Returns the uri with the connection settings to the database</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L42" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="using_connection(&block)-instance-method"> + <div class="signature"> + + def <strong>using_connection</strong>(&block) + + <a class="method-permalink" href="#using_connection(&block)-instance-method">#</a> + </div> + + <div class="doc"><p>yields a connection from the pool +the connection is returned to the pool +when the block ends</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L111" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/Disposable.html b/api/0.6.0/DB/Disposable.html new file mode 100644 index 0000000..11a2d2f --- /dev/null +++ b/api/0.6.0/DB/Disposable.html @@ -0,0 +1,376 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::Disposable - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">module</span> DB::Disposable + +</h1> + + + + + + <h2>Overview</h2> + + <p>Generic module to encapsulate disposable db resources.</p> + + + + + + + + + + + + <h2>Direct including types</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/Connection.html">DB::Connection</a></li> + + <li class="other-type"><a href="../DB/ResultSet.html">DB::ResultSet</a></li> + + <li class="other-type"><a href="../DB/StatementMethods.html">DB::StatementMethods</a></li> + + <li class="other-type"><a href="../DB/Transaction.html">DB::Transaction</a></li> + + </ul> + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/disposable.cr#L3" target="_blank"> + db/disposable.cr + </a> + + <br/> + + + + + + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#close-instance-method" class="signature"><strong>#close</strong></a> + + <div class="summary"><p>Closes this object.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#closed?-instance-method" class="signature"><strong>#closed?</strong></a> + + <div class="summary"><p>Returns <code>true</code> if this object is closed.</p></div> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + +</div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="close-instance-method"> + <div class="signature"> + + def <strong>close</strong> + + <a class="method-permalink" href="#close-instance-method">#</a> + </div> + + <div class="doc"><p>Closes this object.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/disposable.cr#L9" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="closed?-instance-method"> + <div class="signature"> + + def <strong>closed?</strong> + + <a class="method-permalink" href="#closed?-instance-method">#</a> + </div> + + <div class="doc"><p>Returns <code>true</code> if this object is closed. See <code><a href="../DB/Disposable.html#close-instance-method">#close</a></code>.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/disposable.cr#L16" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/Driver.html b/api/0.6.0/DB/Driver.html new file mode 100644 index 0000000..731630e --- /dev/null +++ b/api/0.6.0/DB/Driver.html @@ -0,0 +1,398 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::Driver - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">abstract class</span> DB::Driver + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/Driver.html">DB::Driver</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>Database driver implementors must subclass <code><a href="../DB/Driver.html">Driver</a></code>, +register with a driver_name using <code><a href="../DB.html#register_driver(driver_name,driver_class:Driver.class)-class-method">DB#register_driver</a></code> and +override the factory method <code><a href="../DB/Driver.html#build_connection(context:ConnectionContext):Connection-instance-method">#build_connection</a></code>.</p> + +<pre><code><span class="k">require</span> <span class="s">"db"</span> + +<span class="k">class</span> <span class="t">FakeDriver</span> <span class="o"><</span> <span class="t">DB</span><span class="t">::</span><span class="t">Driver</span> + <span class="k">def</span> <span class="m">build_connection</span>(context : <span class="t">DB</span><span class="t">::</span><span class="t">ConnectionContext</span>) + <span class="t">FakeConnection</span>.<span class="k">new</span> context + <span class="k">end</span> +<span class="k">end</span> + +<span class="t">DB</span>.register_driver <span class="s">"fake"</span>, <span class="t">FakeDriver</span></code></pre> + +<p>Access to this fake datbase will be available with</p> + +<pre><code><span class="t">DB</span>.open <span class="s">"fake://..."</span> <span class="k">do</span> <span class="o">|</span>db<span class="o">|</span> + <span class="c"># ... use db ...</span> +<span class="k">end</span></code></pre> + +<p>Refer to <code><a href="../DB/Connection.html">Connection</a></code>, <code><a href="../DB/Statement.html">Statement</a></code> and <code><a href="../DB/ResultSet.html">ResultSet</a></code> for further +driver implementation instructions.</p> + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/driver.cr#L28" target="_blank"> + db/driver.cr + </a> + + <br/> + + + + + + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#build_connection(context:ConnectionContext):Connection-instance-method" class="signature"><strong>#build_connection</strong>(context : ConnectionContext) : Connection</a> + + </li> + + <li class="entry-summary"> + <a href="#connection_pool_options(params:HTTP::Params)-instance-method" class="signature"><strong>#connection_pool_options</strong>(params : HTTP::Params)</a> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + +</div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="build_connection(context:ConnectionContext):Connection-instance-method"> + <div class="signature"> + abstract + def <strong>build_connection</strong>(context : <a href="../DB/ConnectionContext.html">ConnectionContext</a>) : <a href="../DB/Connection.html">Connection</a> + + <a class="method-permalink" href="#build_connection(context:ConnectionContext):Connection-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/driver.cr#L29" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="connection_pool_options(params:HTTP::Params)-instance-method"> + <div class="signature"> + + def <strong>connection_pool_options</strong>(params : HTTP::Params) + + <a class="method-permalink" href="#connection_pool_options(params:HTTP::Params)-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/driver.cr#L31" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/DriverSpecs.html b/api/0.6.0/DB/DriverSpecs.html new file mode 100644 index 0000000..68309ba --- /dev/null +++ b/api/0.6.0/DB/DriverSpecs.html @@ -0,0 +1,815 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::DriverSpecs(DBAnyType) - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::DriverSpecs(DBAnyType) + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/DriverSpecs.html">DB::DriverSpecs(DBAnyType)</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>Helper class to ensure behaviour of custom drivers</p> + +<pre><code><span class="k">require</span> <span class="s">"db/spec"</span> + +<span class="t">DB</span><span class="t">::</span><span class="t">DriverSpecs</span>(<span class="t">DB</span><span class="t">::</span><span class="t">Any</span>).run <span class="k">do</span> + <span class="c"># How to connect to database</span> + connection_string <span class="s">"scheme://database_url"</span> + + <span class="c"># Clean up database if needed using before/after callbacks</span> + before <span class="k">do</span> + <span class="c"># ...</span> + <span class="k">end</span> + + after <span class="k">do</span> + <span class="c"># ...</span> + <span class="k">end</span> + + <span class="c"># Sample values that will be stored, retrieved across many specs</span> + sample_value <span class="s">"hello"</span>, <span class="s">"varchar(25)"</span>, <span class="s">"'hello'"</span> + + it <span class="s">"custom spec with a db initialized"</span> <span class="k">do</span> <span class="o">|</span>db<span class="o">|</span> + <span class="c"># assert something using *db*</span> + <span class="k">end</span> + + <span class="c"># Configure the appropiate syntax for different commands needed to run the specs</span> + binding_syntax <span class="k">do</span> <span class="o">|</span>index<span class="o">|</span> + <span class="s">"?"</span> + <span class="k">end</span> + + create_table_1column_syntax <span class="k">do</span> <span class="o">|</span>table_name, col1<span class="o">|</span> + <span class="s">"create table </span><span class="i">#{</span>table_name<span class="i">}</span><span class="s"> (</span><span class="i">#{</span>col1.name<span class="i">}</span><span class="s"> </span><span class="i">#{</span>col1.sql_type<span class="i">}</span><span class="s"> </span><span class="i">#{</span>col1.null ? <span class="s">"NULL"</span> : <span class="s">"NOT NULL"</span><span class="i">}</span><span class="s">)"</span> + <span class="k">end</span> +<span class="k">end</span></code></pre> + +<p>The following methods needs to be called to configure the appropiate syntax +for different commands and allow all the specs to run: <code><a href="../DB/DriverSpecs.html#binding_syntax(&binding_syntax:Proc(Int32,String))-instance-method">#binding_syntax</a></code>, <code><a href="../DB/DriverSpecs.html#create_table_1column_syntax(&create_table_1column_syntax:Proc(String,ColumnDef,String))-instance-method">#create_table_1column_syntax</a></code>, +<code><a href="../DB/DriverSpecs.html#create_table_2columns_syntax(&create_table_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method">#create_table_2columns_syntax</a></code>, <code><a href="../DB/DriverSpecs.html#select_1column_syntax(&select_1column_syntax:Proc(String,ColumnDef,String))-instance-method">#select_1column_syntax</a></code>, <code><a href="../DB/DriverSpecs.html#select_2columns_syntax(&select_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method">#select_2columns_syntax</a></code>, <code><a href="../DB/DriverSpecs.html#select_count_syntax(&select_count_syntax:Proc(String,String))-instance-method">#select_count_syntax</a></code>, +<code><a href="../DB/DriverSpecs.html#select_scalar_syntax(&select_scalar_syntax:Proc(String,String?,String))-instance-method">#select_scalar_syntax</a></code>, <code><a href="../DB/DriverSpecs.html#insert_1column_syntax(&insert_1column_syntax:Proc(String,ColumnDef,String,String))-instance-method">#insert_1column_syntax</a></code>, <code><a href="../DB/DriverSpecs.html#insert_2columns_syntax(&insert_2columns_syntax:Proc(String,ColumnDef,String,ColumnDef,String,String))-instance-method">#insert_2columns_syntax</a></code>, <code><a href="../DB/DriverSpecs.html#drop_table_if_exists_syntax(&drop_table_if_exists_syntax:Proc(String,String))-instance-method">#drop_table_if_exists_syntax</a></code>.</p> + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L51" target="_blank"> + spec.cr + </a> + + <br/> + + + + + + + + + <h2>Class Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#run(description="asadb",&block)-class-method" class="signature"><strong>.run</strong>(description = <span class="s">"as a db"</span>, &block)</a> + + </li> + + </ul> + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#after(&after:-%3ENil)-instance-method" class="signature"><strong>#after</strong>(&after : -> Nil)</a> + + </li> + + <li class="entry-summary"> + <a href="#before(&before:-%3ENil)-instance-method" class="signature"><strong>#before</strong>(&before : -> Nil)</a> + + </li> + + <li class="entry-summary"> + <a href="#binding_syntax(&binding_syntax:Proc(Int32,String))-instance-method" class="signature"><strong>#binding_syntax</strong>(&binding_syntax : Proc(Int32, String))</a> + + </li> + + <li class="entry-summary"> + <a href="#connection_string(connection_string:String)-instance-method" class="signature"><strong>#connection_string</strong>(connection_string : String)</a> + + </li> + + <li class="entry-summary"> + <a href="#create_table_1column_syntax(&create_table_1column_syntax:Proc(String,ColumnDef,String))-instance-method" class="signature"><strong>#create_table_1column_syntax</strong>(&create_table_1column_syntax : Proc(String, ColumnDef, String))</a> + + </li> + + <li class="entry-summary"> + <a href="#create_table_2columns_syntax(&create_table_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method" class="signature"><strong>#create_table_2columns_syntax</strong>(&create_table_2columns_syntax : Proc(String, ColumnDef, ColumnDef, String))</a> + + </li> + + <li class="entry-summary"> + <a href="#drop_table_if_exists_syntax(&drop_table_if_exists_syntax:Proc(String,String))-instance-method" class="signature"><strong>#drop_table_if_exists_syntax</strong>(&drop_table_if_exists_syntax : Proc(String, String))</a> + + </li> + + <li class="entry-summary"> + <a href="#encode_null(encode_null:String)-instance-method" class="signature"><strong>#encode_null</strong>(encode_null : String)</a> + + </li> + + <li class="entry-summary"> + <a href="#insert_1column_syntax(&insert_1column_syntax:Proc(String,ColumnDef,String,String))-instance-method" class="signature"><strong>#insert_1column_syntax</strong>(&insert_1column_syntax : Proc(String, ColumnDef, String, String))</a> + + </li> + + <li class="entry-summary"> + <a href="#insert_2columns_syntax(&insert_2columns_syntax:Proc(String,ColumnDef,String,ColumnDef,String,String))-instance-method" class="signature"><strong>#insert_2columns_syntax</strong>(&insert_2columns_syntax : Proc(String, ColumnDef, String, ColumnDef, String, String))</a> + + </li> + + <li class="entry-summary"> + <a href="#it(description="assert",prepared=:default,file=__FILE__,line=__LINE__,end_line=__END_LINE__,&block:DB::Database-%3E)-instance-method" class="signature"><strong>#it</strong>(description = <span class="s">"assert"</span>, prepared = <span class="n">:default</span>, file = __FILE__, line = __LINE__, end_line = __END_LINE__, &block : DB::Database -> )</a> + + </li> + + <li class="entry-summary"> + <a href="#its-instance-method" class="signature"><strong>#its</strong></a> + + </li> + + <li class="entry-summary"> + <a href="#sample_value(value,sql_type,value_encoded,*,type_safe_value=true)-instance-method" class="signature"><strong>#sample_value</strong>(value, sql_type, value_encoded, *, type_safe_value = <span class="n">true</span>)</a> + + <div class="summary"><p>Use <em>value</em> as sample value that should be stored in columns of type <em>sql_type</em>.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#select_1column_syntax(&select_1column_syntax:Proc(String,ColumnDef,String))-instance-method" class="signature"><strong>#select_1column_syntax</strong>(&select_1column_syntax : Proc(String, ColumnDef, String))</a> + + </li> + + <li class="entry-summary"> + <a href="#select_2columns_syntax(&select_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method" class="signature"><strong>#select_2columns_syntax</strong>(&select_2columns_syntax : Proc(String, ColumnDef, ColumnDef, String))</a> + + </li> + + <li class="entry-summary"> + <a href="#select_count_syntax(&select_count_syntax:Proc(String,String))-instance-method" class="signature"><strong>#select_count_syntax</strong>(&select_count_syntax : Proc(String, String))</a> + + </li> + + <li class="entry-summary"> + <a href="#select_scalar_syntax(&select_scalar_syntax:Proc(String,String?,String))-instance-method" class="signature"><strong>#select_scalar_syntax</strong>(&select_scalar_syntax : Proc(String, String?, String))</a> + + </li> + + <li class="entry-summary"> + <a href="#support_prepared(support_prepared:Bool)-instance-method" class="signature"><strong>#support_prepared</strong>(support_prepared : Bool)</a> + + <div class="summary"><p>Allow specs that uses prepared statements (default <code>true</code>)</p></div> + + </li> + + <li class="entry-summary"> + <a href="#support_unprepared(support_unprepared:Bool)-instance-method" class="signature"><strong>#support_unprepared</strong>(support_unprepared : Bool)</a> + + <div class="summary"><p>Allow specs that uses unprepared statements (default <code>true</code>)</p></div> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + +</div> + + + + + <h2>Class Method Detail</h2> + + <div class="entry-detail" id="run(description=&quot;asadb&quot;,&block)-class-method"> + <div class="signature"> + + def self.<strong>run</strong>(description = <span class="s">"as a db"</span>, &block) + + <a class="method-permalink" href="#run(description="asadb",&block)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L469" target="_blank">View source</a>] + + </div> + </div> + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="after(&after:->Nil)-instance-method"> + <div class="signature"> + + def <strong>after</strong>(&after : -> Nil) + + <a class="method-permalink" href="#after(&after:-%3ENil)-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L63" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="before(&before:->Nil)-instance-method"> + <div class="signature"> + + def <strong>before</strong>(&before : -> Nil) + + <a class="method-permalink" href="#before(&before:-%3ENil)-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L60" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="binding_syntax(&binding_syntax:Proc(Int32,String))-instance-method"> + <div class="signature"> + + def <strong>binding_syntax</strong>(&binding_syntax : Proc(Int32, String)) + + <a class="method-permalink" href="#binding_syntax(&binding_syntax:Proc(Int32,String))-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L110" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="connection_string(connection_string:String)-instance-method"> + <div class="signature"> + + def <strong>connection_string</strong>(connection_string : String) + + <a class="method-permalink" href="#connection_string(connection_string:String)-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L109" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="create_table_1column_syntax(&create_table_1column_syntax:Proc(String,ColumnDef,String))-instance-method"> + <div class="signature"> + + def <strong>create_table_1column_syntax</strong>(&create_table_1column_syntax : Proc(String, <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a>, String)) + + <a class="method-permalink" href="#create_table_1column_syntax(&create_table_1column_syntax:Proc(String,ColumnDef,String))-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L112" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="create_table_2columns_syntax(&create_table_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method"> + <div class="signature"> + + def <strong>create_table_2columns_syntax</strong>(&create_table_2columns_syntax : Proc(String, <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a>, <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a>, String)) + + <a class="method-permalink" href="#create_table_2columns_syntax(&create_table_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L113" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="drop_table_if_exists_syntax(&drop_table_if_exists_syntax:Proc(String,String))-instance-method"> + <div class="signature"> + + def <strong>drop_table_if_exists_syntax</strong>(&drop_table_if_exists_syntax : Proc(String, String)) + + <a class="method-permalink" href="#drop_table_if_exists_syntax(&drop_table_if_exists_syntax:Proc(String,String))-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L119" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="encode_null(encode_null:String)-instance-method"> + <div class="signature"> + + def <strong>encode_null</strong>(encode_null : String) + + <a class="method-permalink" href="#encode_null(encode_null:String)-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L66" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="insert_1column_syntax(&insert_1column_syntax:Proc(String,ColumnDef,String,String))-instance-method"> + <div class="signature"> + + def <strong>insert_1column_syntax</strong>(&insert_1column_syntax : Proc(String, <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a>, String, String)) + + <a class="method-permalink" href="#insert_1column_syntax(&insert_1column_syntax:Proc(String,ColumnDef,String,String))-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L114" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="insert_2columns_syntax(&insert_2columns_syntax:Proc(String,ColumnDef,String,ColumnDef,String,String))-instance-method"> + <div class="signature"> + + def <strong>insert_2columns_syntax</strong>(&insert_2columns_syntax : Proc(String, <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a>, String, <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a>, String, String)) + + <a class="method-permalink" href="#insert_2columns_syntax(&insert_2columns_syntax:Proc(String,ColumnDef,String,ColumnDef,String,String))-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L115" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="it(description=&quot;assert&quot;,prepared=:default,file=__FILE__,line=__LINE__,end_line=__END_LINE__,&block:DB::Database->)-instance-method"> + <div class="signature"> + + def <strong>it</strong>(description = <span class="s">"assert"</span>, prepared = <span class="n">:default</span>, file = __FILE__, line = __LINE__, end_line = __END_LINE__, &block : <a href="../DB/Database.html">DB::Database</a> -> ) + + <a class="method-permalink" href="#it(description="assert",prepared=:default,file=__FILE__,line=__LINE__,end_line=__END_LINE__,&block:DB::Database-%3E)-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L125" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="its-instance-method"> + <div class="signature"> + + def <strong>its</strong> + + <a class="method-permalink" href="#its-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L125" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="sample_value(value,sql_type,value_encoded,*,type_safe_value=true)-instance-method"> + <div class="signature"> + + def <strong>sample_value</strong>(value, sql_type, value_encoded, *, type_safe_value = <span class="n">true</span>) + + <a class="method-permalink" href="#sample_value(value,sql_type,value_encoded,*,type_safe_value=true)-instance-method">#</a> + </div> + + <div class="doc"><p>Use <em>value</em> as sample value that should be stored in columns of type <em>sql_type</em>. +<em>value_encoded</em> is driver specific expression that should generate that value in the database. +<em>type_safe_value</em> indicates whether <em>value_encoded</em> is expected to generate the <em>value</em> even without +been stored in a table (default <code>true</code>).</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L139" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="select_1column_syntax(&select_1column_syntax:Proc(String,ColumnDef,String))-instance-method"> + <div class="signature"> + + def <strong>select_1column_syntax</strong>(&select_1column_syntax : Proc(String, <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a>, String)) + + <a class="method-permalink" href="#select_1column_syntax(&select_1column_syntax:Proc(String,ColumnDef,String))-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L116" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="select_2columns_syntax(&select_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method"> + <div class="signature"> + + def <strong>select_2columns_syntax</strong>(&select_2columns_syntax : Proc(String, <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a>, <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a>, String)) + + <a class="method-permalink" href="#select_2columns_syntax(&select_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L117" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="select_count_syntax(&select_count_syntax:Proc(String,String))-instance-method"> + <div class="signature"> + + def <strong>select_count_syntax</strong>(&select_count_syntax : Proc(String, String)) + + <a class="method-permalink" href="#select_count_syntax(&select_count_syntax:Proc(String,String))-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L118" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="select_scalar_syntax(&select_scalar_syntax:Proc(String,String?,String))-instance-method"> + <div class="signature"> + + def <strong>select_scalar_syntax</strong>(&select_scalar_syntax : Proc(String, String?, String)) + + <a class="method-permalink" href="#select_scalar_syntax(&select_scalar_syntax:Proc(String,String?,String))-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L111" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="support_prepared(support_prepared:Bool)-instance-method"> + <div class="signature"> + + def <strong>support_prepared</strong>(support_prepared : Bool) + + <a class="method-permalink" href="#support_prepared(support_prepared:Bool)-instance-method">#</a> + </div> + + <div class="doc"><p>Allow specs that uses prepared statements (default <code>true</code>)</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L70" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="support_unprepared(support_unprepared:Bool)-instance-method"> + <div class="signature"> + + def <strong>support_unprepared</strong>(support_unprepared : Bool) + + <a class="method-permalink" href="#support_unprepared(support_unprepared:Bool)-instance-method">#</a> + </div> + + <div class="doc"><p>Allow specs that uses unprepared statements (default <code>true</code>)</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L79" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/DriverSpecs/ColumnDef.html b/api/0.6.0/DB/DriverSpecs/ColumnDef.html new file mode 100644 index 0000000..c96172f --- /dev/null +++ b/api/0.6.0/DB/DriverSpecs/ColumnDef.html @@ -0,0 +1,469 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::DriverSpecs::ColumnDef - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../../DB/Driver.html">Driver</a> + + </li> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">struct</span> DB::DriverSpecs::ColumnDef + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../../DB/DriverSpecs/ColumnDef.html">DB::DriverSpecs::ColumnDef</a></li><li class="superclass">Struct</li><li class="superclass">Value</li><li class="superclass">Object</li></ul> + + + + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L52" target="_blank"> + spec.cr + </a> + + <br/> + + + + + + + <h2>Constructors</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new(name:String,sql_type:String,null:Bool)-class-method" class="signature"><strong>.new</strong>(name : String, sql_type : String, null : Bool)</a> + + </li> + + </ul> + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#clone-instance-method" class="signature"><strong>#clone</strong></a> + + </li> + + <li class="entry-summary"> + <a href="#copy_with(name_name=@name,sql_type_sql_type=@sql_type,null_null=@null)-instance-method" class="signature"><strong>#copy_with</strong>(name _name = @name, sql_type _sql_type = @sql_type, null _null = @null)</a> + + </li> + + <li class="entry-summary"> + <a href="#name:String-instance-method" class="signature"><strong>#name</strong> : String</a> + + </li> + + <li class="entry-summary"> + <a href="#null:Bool-instance-method" class="signature"><strong>#null</strong> : Bool</a> + + </li> + + <li class="entry-summary"> + <a href="#sql_type:String-instance-method" class="signature"><strong>#sql_type</strong> : String</a> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Constructor Detail</h2> + + <div class="entry-detail" id="new(name:String,sql_type:String,null:Bool)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(name : String, sql_type : String, null : Bool) + + <a class="method-permalink" href="#new(name:String,sql_type:String,null:Bool)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L52" target="_blank">View source</a>] + + </div> + </div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="clone-instance-method"> + <div class="signature"> + + def <strong>clone</strong> + + <a class="method-permalink" href="#clone-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L52" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="copy_with(name_name=@name,sql_type_sql_type=@sql_type,null_null=@null)-instance-method"> + <div class="signature"> + + def <strong>copy_with</strong>(name _name = @name, sql_type _sql_type = @sql_type, null _null = @null) + + <a class="method-permalink" href="#copy_with(name_name=@name,sql_type_sql_type=@sql_type,null_null=@null)-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L52" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="name:String-instance-method"> + <div class="signature"> + + def <strong>name</strong> : String + + <a class="method-permalink" href="#name:String-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="null:Bool-instance-method"> + <div class="signature"> + + def <strong>null</strong> : Bool + + <a class="method-permalink" href="#null:Bool-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="sql_type:String-instance-method"> + <div class="signature"> + + def <strong>sql_type</strong> : String + + <a class="method-permalink" href="#sql_type:String-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/Error.html b/api/0.6.0/DB/Error.html new file mode 100644 index 0000000..10063c2 --- /dev/null +++ b/api/0.6.0/DB/Error.html @@ -0,0 +1,350 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::Error - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::Error + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/Error.html">DB::Error</a></li><li class="superclass">Exception</li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + + + + + + + + + <h2>Direct Known Subclasses</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/ConnectionLost.html">DB::ConnectionLost</a></li> + + <li class="other-type"><a href="../DB/ConnectionRefused.html">DB::ConnectionRefused</a></li> + + <li class="other-type"><a href="../DB/MappingException.html">DB::MappingException</a></li> + + <li class="other-type"><a href="../DB/PoolRetryAttemptsExceeded.html">DB::PoolRetryAttemptsExceeded</a></li> + + <li class="other-type"><a href="../DB/PoolTimeout.html">DB::PoolTimeout</a></li> + + <li class="other-type"><a href="../DB/Rollback.html">DB::Rollback</a></li> + + </ul> + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr#L2" target="_blank"> + db/error.cr + </a> + + <br/> + + + + + + + + + + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + + + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/ExecResult.html b/api/0.6.0/DB/ExecResult.html new file mode 100644 index 0000000..b785453 --- /dev/null +++ b/api/0.6.0/DB/ExecResult.html @@ -0,0 +1,454 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::ExecResult - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">struct</span> DB::ExecResult + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/ExecResult.html">DB::ExecResult</a></li><li class="superclass">Struct</li><li class="superclass">Value</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>Result of a <code>#exec</code> statement.</p> + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L89" target="_blank"> + db.cr + </a> + + <br/> + + + + + + + <h2>Constructors</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new(rows_affected:Int64,last_insert_id:Int64)-class-method" class="signature"><strong>.new</strong>(rows_affected : Int64, last_insert_id : Int64)</a> + + </li> + + </ul> + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#clone-instance-method" class="signature"><strong>#clone</strong></a> + + </li> + + <li class="entry-summary"> + <a href="#copy_with(rows_affected_rows_affected=@rows_affected,last_insert_id_last_insert_id=@last_insert_id)-instance-method" class="signature"><strong>#copy_with</strong>(rows_affected _rows_affected = @rows_affected, last_insert_id _last_insert_id = @last_insert_id)</a> + + </li> + + <li class="entry-summary"> + <a href="#last_insert_id:Int64-instance-method" class="signature"><strong>#last_insert_id</strong> : Int64</a> + + </li> + + <li class="entry-summary"> + <a href="#rows_affected:Int64-instance-method" class="signature"><strong>#rows_affected</strong> : Int64</a> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Constructor Detail</h2> + + <div class="entry-detail" id="new(rows_affected:Int64,last_insert_id:Int64)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(rows_affected : Int64, last_insert_id : Int64) + + <a class="method-permalink" href="#new(rows_affected:Int64,last_insert_id:Int64)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L89" target="_blank">View source</a>] + + </div> + </div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="clone-instance-method"> + <div class="signature"> + + def <strong>clone</strong> + + <a class="method-permalink" href="#clone-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L89" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="copy_with(rows_affected_rows_affected=@rows_affected,last_insert_id_last_insert_id=@last_insert_id)-instance-method"> + <div class="signature"> + + def <strong>copy_with</strong>(rows_affected _rows_affected = @rows_affected, last_insert_id _last_insert_id = @last_insert_id) + + <a class="method-permalink" href="#copy_with(rows_affected_rows_affected=@rows_affected,last_insert_id_last_insert_id=@last_insert_id)-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L89" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="last_insert_id:Int64-instance-method"> + <div class="signature"> + + def <strong>last_insert_id</strong> : Int64 + + <a class="method-permalink" href="#last_insert_id:Int64-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + <div class="entry-detail" id="rows_affected:Int64-instance-method"> + <div class="signature"> + + def <strong>rows_affected</strong> : Int64 + + <a class="method-permalink" href="#rows_affected:Int64-instance-method">#</a> + </div> + + <br/> + <div> + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/Mappable.html b/api/0.6.0/DB/Mappable.html new file mode 100644 index 0000000..dea7965 --- /dev/null +++ b/api/0.6.0/DB/Mappable.html @@ -0,0 +1,305 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::Mappable - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">module</span> DB::Mappable + +</h1> + + + + + + <h2>Overview</h2> + + <p>Empty module used for marking a class as supporting DB:Mapping</p> + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/mapping.cr#L3" target="_blank"> + db/mapping.cr + </a> + + <br/> + + + + + + + + + + + + + + +<div class="methods-inherited"> + +</div> + + + + + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/MappingException.html b/api/0.6.0/DB/MappingException.html new file mode 100644 index 0000000..ebf0c05 --- /dev/null +++ b/api/0.6.0/DB/MappingException.html @@ -0,0 +1,343 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::MappingException - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::MappingException + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/MappingException.html">DB::MappingException</a></li><li class="superclass"><a href="../DB/Error.html">DB::Error</a></li><li class="superclass">Exception</li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr#L5" target="_blank"> + db/error.cr + </a> + + <br/> + + + + + + + + + + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + + + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/Pool.html b/api/0.6.0/DB/Pool.html new file mode 100644 index 0000000..cc29796 --- /dev/null +++ b/api/0.6.0/DB/Pool.html @@ -0,0 +1,455 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::Pool(T) - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::Pool(T) + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/Pool.html">DB::Pool(T)</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L4" target="_blank"> + db/pool.cr + </a> + + <br/> + + + + + + + <h2>Constructors</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new(initial_pool_size=1,max_pool_size=0,max_idle_pool_size=1,checkout_timeout=5.0,retry_attempts=1,retry_delay=0.2,&factory:-%3ET)-class-method" class="signature"><strong>.new</strong>(initial_pool_size = <span class="n">1</span>, max_pool_size = <span class="n">0</span>, max_idle_pool_size = <span class="n">1</span>, checkout_timeout = <span class="n">5.0</span>, retry_attempts = <span class="n">1</span>, retry_delay = <span class="n">0.2</span>, &factory : -> T)</a> + + </li> + + </ul> + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#checkout:T-instance-method" class="signature"><strong>#checkout</strong> : T</a> + + </li> + + <li class="entry-summary"> + <a href="#checkout_some(candidates:Enumerable(WeakRef(T))):::Tuple(T,Bool)-instance-method" class="signature"><strong>#checkout_some</strong>(candidates : Enumerable(WeakRef(T))) : ::Tuple(T, Bool)</a> + + <div class="summary"><p><code></code>` selected, is_candidate = pool.checkout_some(candidates) <code></code>` <code>selected</code> be a resource from the <code>candidates</code> list and <code>is_candidate</code> == <code>true</code> or <code>selected</code> will be a new resource and <code>is_candidate</code> == <code>false</code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#close:Nil-instance-method" class="signature"><strong>#close</strong> : Nil</a> + + <div class="summary"><p>close all resources in the pool</p></div> + + </li> + + <li class="entry-summary"> + <a href="#release(resource:T):Nil-instance-method" class="signature"><strong>#release</strong>(resource : T) : Nil</a> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Constructor Detail</h2> + + <div class="entry-detail" id="new(initial_pool_size=1,max_pool_size=0,max_idle_pool_size=1,checkout_timeout=5.0,retry_attempts=1,retry_delay=0.2,&factory:->T)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(initial_pool_size = <span class="n">1</span>, max_pool_size = <span class="n">0</span>, max_idle_pool_size = <span class="n">1</span>, checkout_timeout = <span class="n">5.0</span>, retry_attempts = <span class="n">1</span>, retry_delay = <span class="n">0.2</span>, &factory : -> T) + + <a class="method-permalink" href="#new(initial_pool_size=1,max_pool_size=0,max_idle_pool_size=1,checkout_timeout=5.0,retry_attempts=1,retry_delay=0.2,&factory:-%3ET)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L15" target="_blank">View source</a>] + + </div> + </div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="checkout:T-instance-method"> + <div class="signature"> + + def <strong>checkout</strong> : T + + <a class="method-permalink" href="#checkout:T-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L31" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="checkout_some(candidates:Enumerable(WeakRef(T))):::Tuple(T,Bool)-instance-method"> + <div class="signature"> + + def <strong>checkout_some</strong>(candidates : Enumerable(WeakRef(T))) : ::Tuple(T, Bool) + + <a class="method-permalink" href="#checkout_some(candidates:Enumerable(WeakRef(T))):::Tuple(T,Bool)-instance-method">#</a> + </div> + + <div class="doc"><pre><code>selected, is_candidate <span class="o">=</span> pool.checkout_some(candidates)</code></pre> + +<p><code>selected</code> be a resource from the <code>candidates</code> list and <code>is_candidate</code> == <code>true</code> +or <code>selected</code> will be a new resource and <code>is_candidate</code> == <code>false</code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L53" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="close:Nil-instance-method"> + <div class="signature"> + + def <strong>close</strong> : Nil + + <a class="method-permalink" href="#close:Nil-instance-method">#</a> + </div> + + <div class="doc"><p>close all resources in the pool</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L25" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="release(resource:T):Nil-instance-method"> + <div class="signature"> + + def <strong>release</strong>(resource : T) : Nil + + <a class="method-permalink" href="#release(resource:T):Nil-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L69" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/Pool/TimeoutHelper.html b/api/0.6.0/DB/Pool/TimeoutHelper.html new file mode 100644 index 0000000..10bf12b --- /dev/null +++ b/api/0.6.0/DB/Pool/TimeoutHelper.html @@ -0,0 +1,423 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::Pool::TimeoutHelper - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../../DB/Pool.html">Pool</a> + + <ul> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::Pool::TimeoutHelper + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../../DB/Pool/TimeoutHelper.html">DB::Pool::TimeoutHelper</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L183" target="_blank"> + db/pool.cr + </a> + + <br/> + + + + + + + <h2>Constructors</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new(timeout:Float64)-class-method" class="signature"><strong>.new</strong>(timeout : Float64)</a> + + </li> + + </ul> + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#cancel-instance-method" class="signature"><strong>#cancel</strong></a> + + </li> + + <li class="entry-summary"> + <a href="#receive_select_action-instance-method" class="signature"><strong>#receive_select_action</strong></a> + + </li> + + <li class="entry-summary"> + <a href="#start-instance-method" class="signature"><strong>#start</strong></a> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Constructor Detail</h2> + + <div class="entry-detail" id="new(timeout:Float64)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(timeout : Float64) + + <a class="method-permalink" href="#new(timeout:Float64)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L184" target="_blank">View source</a>] + + </div> + </div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="cancel-instance-method"> + <div class="signature"> + + def <strong>cancel</strong> + + <a class="method-permalink" href="#cancel-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L202" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="receive_select_action-instance-method"> + <div class="signature"> + + def <strong>receive_select_action</strong> + + <a class="method-permalink" href="#receive_select_action-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L189" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="start-instance-method"> + <div class="signature"> + + def <strong>start</strong> + + <a class="method-permalink" href="#start-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L193" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/PoolPreparedStatement.html b/api/0.6.0/DB/PoolPreparedStatement.html new file mode 100644 index 0000000..5755a37 --- /dev/null +++ b/api/0.6.0/DB/PoolPreparedStatement.html @@ -0,0 +1,451 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::PoolPreparedStatement - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::PoolPreparedStatement + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/PoolPreparedStatement.html">DB::PoolPreparedStatement</a></li><li class="superclass"><a href="../DB/PoolStatement.html">DB::PoolStatement</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>Represents a statement to be executed in any of the connections +of the pool. The statement is not be executed in a prepared fashion. +The execution of the statement is retried according to the pool configuration.</p> + +<p>See <code><a href="../DB/PoolStatement.html">PoolStatement</a></code></p> + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_prepared_statement.cr#L7" target="_blank"> + db/pool_prepared_statement.cr + </a> + + <br/> + + + + + + + <h2>Constructors</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new(db:Database,query:String)-class-method" class="signature"><strong>.new</strong>(db : Database, query : String)</a> + + </li> + + </ul> + + + + + + + + + +<div class="methods-inherited"> + + + + <h3>Instance methods inherited from class <code><a href="../DB/PoolStatement.html">DB::PoolStatement</a></code></h3> + + + <a href="../DB/PoolStatement.html#exec(args:Array):ExecResult-instance-method" class="tooltip"> + <span>exec(args : Array) : ExecResult<br/>exec : ExecResult<br/>exec(*args) : ExecResult</span> + exec</a>, + + + <a href="../DB/PoolStatement.html#query(args:Array):ResultSet-instance-method" class="tooltip"> + <span>query(args : Array) : ResultSet<br/>query : ResultSet<br/>query(*args) : ResultSet</span> + query</a>, + + + <a href="../DB/PoolStatement.html#scalar(*args)-instance-method" class="tooltip"> + <span>scalar(*args)</span> + scalar</a> + + + + + + + <h3>Constructor methods inherited from class <code><a href="../DB/PoolStatement.html">DB::PoolStatement</a></code></h3> + + + <a href="../DB/PoolStatement.html#new(db:Database,query:String)-class-method" class="tooltip"> + <span>new(db : Database, query : String)</span> + new</a> + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/StatementMethods.html">DB::StatementMethods</a></code></h3> + + + <a href="../DB/StatementMethods.html#exec(args:Array):ExecResult-instance-method" class="tooltip"> + <span>exec(args : Array) : ExecResult<br/>exec : ExecResult<br/>exec(*args) : ExecResult</span> + exec</a>, + + + <a href="../DB/StatementMethods.html#query(*args,&block)-instance-method" class="tooltip"> + <span>query(*args, &block)<br/>query(args : Array) : ResultSet<br/>query : ResultSet<br/>query(*args) : ResultSet</span> + query</a>, + + + <a href="../DB/StatementMethods.html#scalar(*args)-instance-method" class="tooltip"> + <span>scalar(*args)</span> + scalar</a> + + + + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/Disposable.html">DB::Disposable</a></code></h3> + + + <a href="../DB/Disposable.html#close-instance-method" class="tooltip"> + <span>close</span> + close</a>, + + + <a href="../DB/Disposable.html#closed?-instance-method" class="tooltip"> + <span>closed?</span> + closed?</a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Constructor Detail</h2> + + <div class="entry-detail" id="new(db:Database,query:String)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(db : <a href="../DB/Database.html">Database</a>, query : String) + + <a class="method-permalink" href="#new(db:Database,query:String)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_prepared_statement.cr#L11" target="_blank">View source</a>] + + </div> + </div> + + + + + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/PoolRetryAttemptsExceeded.html b/api/0.6.0/DB/PoolRetryAttemptsExceeded.html new file mode 100644 index 0000000..f53483c --- /dev/null +++ b/api/0.6.0/DB/PoolRetryAttemptsExceeded.html @@ -0,0 +1,343 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::PoolRetryAttemptsExceeded - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::PoolRetryAttemptsExceeded + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/PoolRetryAttemptsExceeded.html">DB::PoolRetryAttemptsExceeded</a></li><li class="superclass"><a href="../DB/Error.html">DB::Error</a></li><li class="superclass">Exception</li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr#L11" target="_blank"> + db/error.cr + </a> + + <br/> + + + + + + + + + + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + + + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/PoolStatement.html b/api/0.6.0/DB/PoolStatement.html new file mode 100644 index 0000000..5aa1216 --- /dev/null +++ b/api/0.6.0/DB/PoolStatement.html @@ -0,0 +1,611 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::PoolStatement - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">abstract class</span> DB::PoolStatement + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/PoolStatement.html">DB::PoolStatement</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>When a statement is to be executed in a DB that has a connection pool +a statement from the DB needs to be able to represent a statement in any +of the connections of the pool. Otherwise the user will need to deal with +actual connections in some point.</p> + + + + + + <h2>Included Modules</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/StatementMethods.html">DB::StatementMethods</a></li> + + </ul> + + + + + + <h2>Direct Known Subclasses</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/PoolPreparedStatement.html">DB::PoolPreparedStatement</a></li> + + <li class="other-type"><a href="../DB/PoolUnpreparedStatement.html">DB::PoolUnpreparedStatement</a></li> + + </ul> + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L6" target="_blank"> + db/pool_statement.cr + </a> + + <br/> + + + + + + + <h2>Constructors</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new(db:Database,query:String)-class-method" class="signature"><strong>.new</strong>(db : Database, query : String)</a> + + </li> + + </ul> + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#exec(args:Array):ExecResult-instance-method" class="signature"><strong>#exec</strong>(args : Array) : ExecResult</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#exec:ExecResult-instance-method" class="signature"><strong>#exec</strong> : ExecResult</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#exec(*args):ExecResult-instance-method" class="signature"><strong>#exec</strong>(*args) : ExecResult</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#query(args:Array):ResultSet-instance-method" class="signature"><strong>#query</strong>(args : Array) : ResultSet</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#query:ResultSet-instance-method" class="signature"><strong>#query</strong> : ResultSet</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#query(*args):ResultSet-instance-method" class="signature"><strong>#query</strong>(*args) : ResultSet</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#scalar(*args)-instance-method" class="signature"><strong>#scalar</strong>(*args)</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#scalar(query,*args)-instance-method">QueryMethods#scalar</a></code></p></div> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + <h3>Instance methods inherited from module <code><a href="../DB/StatementMethods.html">DB::StatementMethods</a></code></h3> + + + <a href="../DB/StatementMethods.html#exec(args:Array):ExecResult-instance-method" class="tooltip"> + <span>exec(args : Array) : ExecResult<br/>exec : ExecResult<br/>exec(*args) : ExecResult</span> + exec</a>, + + + <a href="../DB/StatementMethods.html#query(*args,&block)-instance-method" class="tooltip"> + <span>query(*args, &block)<br/>query(args : Array) : ResultSet<br/>query : ResultSet<br/>query(*args) : ResultSet</span> + query</a>, + + + <a href="../DB/StatementMethods.html#scalar(*args)-instance-method" class="tooltip"> + <span>scalar(*args)</span> + scalar</a> + + + + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/Disposable.html">DB::Disposable</a></code></h3> + + + <a href="../DB/Disposable.html#close-instance-method" class="tooltip"> + <span>close</span> + close</a>, + + + <a href="../DB/Disposable.html#closed?-instance-method" class="tooltip"> + <span>closed?</span> + closed?</a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Constructor Detail</h2> + + <div class="entry-detail" id="new(db:Database,query:String)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(db : <a href="../DB/Database.html">Database</a>, query : String) + + <a class="method-permalink" href="#new(db:Database,query:String)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L9" target="_blank">View source</a>] + + </div> + </div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="exec(args:Array):ExecResult-instance-method"> + <div class="signature"> + + def <strong>exec</strong>(args : Array) : <a href="../DB/ExecResult.html">ExecResult</a> + + <a class="method-permalink" href="#exec(args:Array):ExecResult-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L23" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="exec:ExecResult-instance-method"> + <div class="signature"> + + def <strong>exec</strong> : <a href="../DB/ExecResult.html">ExecResult</a> + + <a class="method-permalink" href="#exec:ExecResult-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L13" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="exec(*args):ExecResult-instance-method"> + <div class="signature"> + + def <strong>exec</strong>(*args) : <a href="../DB/ExecResult.html">ExecResult</a> + + <a class="method-permalink" href="#exec(*args):ExecResult-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L18" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query(args:Array):ResultSet-instance-method"> + <div class="signature"> + + def <strong>query</strong>(args : Array) : <a href="../DB/ResultSet.html">ResultSet</a> + + <a class="method-permalink" href="#query(args:Array):ResultSet-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L38" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query:ResultSet-instance-method"> + <div class="signature"> + + def <strong>query</strong> : <a href="../DB/ResultSet.html">ResultSet</a> + + <a class="method-permalink" href="#query:ResultSet-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L28" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query(*args):ResultSet-instance-method"> + <div class="signature"> + + def <strong>query</strong>(*args) : <a href="../DB/ResultSet.html">ResultSet</a> + + <a class="method-permalink" href="#query(*args):ResultSet-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L33" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="scalar(*args)-instance-method"> + <div class="signature"> + + def <strong>scalar</strong>(*args) + + <a class="method-permalink" href="#scalar(*args)-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#scalar(query,*args)-instance-method">QueryMethods#scalar</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L43" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/PoolTimeout.html b/api/0.6.0/DB/PoolTimeout.html new file mode 100644 index 0000000..665bee2 --- /dev/null +++ b/api/0.6.0/DB/PoolTimeout.html @@ -0,0 +1,343 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::PoolTimeout - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::PoolTimeout + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/PoolTimeout.html">DB::PoolTimeout</a></li><li class="superclass"><a href="../DB/Error.html">DB::Error</a></li><li class="superclass">Exception</li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr#L8" target="_blank"> + db/error.cr + </a> + + <br/> + + + + + + + + + + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + + + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/PoolUnpreparedStatement.html b/api/0.6.0/DB/PoolUnpreparedStatement.html new file mode 100644 index 0000000..3e11843 --- /dev/null +++ b/api/0.6.0/DB/PoolUnpreparedStatement.html @@ -0,0 +1,451 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::PoolUnpreparedStatement - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::PoolUnpreparedStatement + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/PoolUnpreparedStatement.html">DB::PoolUnpreparedStatement</a></li><li class="superclass"><a href="../DB/PoolStatement.html">DB::PoolStatement</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>Represents a statement to be executed in any of the connections +of the pool. The statement is not be executed in a non prepared fashion. +The execution of the statement is retried according to the pool configuration.</p> + +<p>See <code><a href="../DB/PoolStatement.html">PoolStatement</a></code></p> + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_unprepared_statement.cr#L7" target="_blank"> + db/pool_unprepared_statement.cr + </a> + + <br/> + + + + + + + <h2>Constructors</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new(db:Database,query:String)-class-method" class="signature"><strong>.new</strong>(db : Database, query : String)</a> + + </li> + + </ul> + + + + + + + + + +<div class="methods-inherited"> + + + + <h3>Instance methods inherited from class <code><a href="../DB/PoolStatement.html">DB::PoolStatement</a></code></h3> + + + <a href="../DB/PoolStatement.html#exec(args:Array):ExecResult-instance-method" class="tooltip"> + <span>exec(args : Array) : ExecResult<br/>exec : ExecResult<br/>exec(*args) : ExecResult</span> + exec</a>, + + + <a href="../DB/PoolStatement.html#query(args:Array):ResultSet-instance-method" class="tooltip"> + <span>query(args : Array) : ResultSet<br/>query : ResultSet<br/>query(*args) : ResultSet</span> + query</a>, + + + <a href="../DB/PoolStatement.html#scalar(*args)-instance-method" class="tooltip"> + <span>scalar(*args)</span> + scalar</a> + + + + + + + <h3>Constructor methods inherited from class <code><a href="../DB/PoolStatement.html">DB::PoolStatement</a></code></h3> + + + <a href="../DB/PoolStatement.html#new(db:Database,query:String)-class-method" class="tooltip"> + <span>new(db : Database, query : String)</span> + new</a> + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/StatementMethods.html">DB::StatementMethods</a></code></h3> + + + <a href="../DB/StatementMethods.html#exec(args:Array):ExecResult-instance-method" class="tooltip"> + <span>exec(args : Array) : ExecResult<br/>exec : ExecResult<br/>exec(*args) : ExecResult</span> + exec</a>, + + + <a href="../DB/StatementMethods.html#query(*args,&block)-instance-method" class="tooltip"> + <span>query(*args, &block)<br/>query(args : Array) : ResultSet<br/>query : ResultSet<br/>query(*args) : ResultSet</span> + query</a>, + + + <a href="../DB/StatementMethods.html#scalar(*args)-instance-method" class="tooltip"> + <span>scalar(*args)</span> + scalar</a> + + + + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/Disposable.html">DB::Disposable</a></code></h3> + + + <a href="../DB/Disposable.html#close-instance-method" class="tooltip"> + <span>close</span> + close</a>, + + + <a href="../DB/Disposable.html#closed?-instance-method" class="tooltip"> + <span>closed?</span> + closed?</a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Constructor Detail</h2> + + <div class="entry-detail" id="new(db:Database,query:String)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(db : <a href="../DB/Database.html">Database</a>, query : String) + + <a class="method-permalink" href="#new(db:Database,query:String)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_unprepared_statement.cr#L8" target="_blank">View source</a>] + + </div> + </div> + + + + + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/QueryMethods.html b/api/0.6.0/DB/QueryMethods.html new file mode 100644 index 0000000..4d32f51 --- /dev/null +++ b/api/0.6.0/DB/QueryMethods.html @@ -0,0 +1,857 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::QueryMethods(Stmt) - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">module</span> DB::QueryMethods(Stmt) + +</h1> + + + + + + <h2>Overview</h2> + + <p>Methods to allow querying a database. +All methods accepts a <code>query : String</code> and a set arguments.</p> + +<p>Three kind of statements can be performed:</p> + +<ol><li><code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">#exec</a></code> waits no record response from the database. An <code><a href="../DB/ExecResult.html">ExecResult</a></code> is returned.</li><li><code><a href="../DB/QueryMethods.html#scalar(query,*args)-instance-method">#scalar</a></code> reads a single value of the response. A union of possible values is returned.</li><li><code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">#query</a></code> returns a <code><a href="../DB/ResultSet.html">ResultSet</a></code> that allows iteration over the rows in the response and column information.</li></ol> + +<p>Arguments can be passed by position</p> + +<pre><code>db.query(<span class="s">"SELECT name FROM ... WHERE age > ?"</span>, age)</code></pre> + +<p>Convention of mapping how arguments are mapped to the query depends on each driver.</p> + +<p>Including <code><a href="../DB/QueryMethods.html">QueryMethods</a></code> requires a <code>build(query) : <a href="../DB/Statement.html">Statement</a></code> method that is not expected +to be called directly.</p> + + + + + + + + + + + + <h2>Direct including types</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/SessionMethods.html">DB::SessionMethods(Session, Stmt)</a></li> + + <li class="other-type"><a href="../DB/SessionMethods/PreparedQuery.html">DB::SessionMethods::PreparedQuery(Session, Stmt)</a></li> + + <li class="other-type"><a href="../DB/SessionMethods/UnpreparedQuery.html">DB::SessionMethods::UnpreparedQuery(Session, Stmt)</a></li> + + </ul> + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L20" target="_blank"> + db/query_methods.cr + </a> + + <br/> + + + + + + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#exec(query,*args)-instance-method" class="signature"><strong>#exec</strong>(query, *args)</a> + + <div class="summary"><p>Performs the <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">#query</a></code> and returns an <code><a href="../DB/ExecResult.html">ExecResult</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#query(query,*args)-instance-method" class="signature"><strong>#query</strong>(query, *args)</a> + + <div class="summary"><p>Executes a <em>query</em> and returns a <code><a href="../DB/ResultSet.html">ResultSet</a></code> with the results.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#query(query,*args,&block)-instance-method" class="signature"><strong>#query</strong>(query, *args, &block)</a> + + <div class="summary"><p>Executes a <em>query</em> and yields a <code><a href="../DB/ResultSet.html">ResultSet</a></code> with the results.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#query_all(query,*args,astype:Class)-instance-method" class="signature"><strong>#query_all</strong>(query, *args, as type : Class)</a> + + <div class="summary"><p>Executes a <em>query</em> and returns an array where the value of each row is read as the given <em>type</em>.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#query_all(query,*args,astypes:NamedTuple)-instance-method" class="signature"><strong>#query_all</strong>(query, *args, as types : NamedTuple)</a> + + <div class="summary"><p>Executes a <em>query</em> and returns an array where each row is read as a named tuple of the given <em>types</em> (the keys of the named tuple are not necessarily the column names).</p></div> + + </li> + + <li class="entry-summary"> + <a href="#query_all(query,*args,&block:ResultSet-%3EU):Array(U)forallU-instance-method" class="signature"><strong>#query_all</strong>(query, *args, &block : ResultSet -> U) : Array(U) forall U</a> + + <div class="summary"><p>Executes a <em>query</em> and yield a <code><a href="../DB/ResultSet.html">ResultSet</a></code> positioned at the beginning of each row, returning an array of the values of the blocks.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#query_all(query,*args,astypes:Tuple)-instance-method" class="signature"><strong>#query_all</strong>(query, *args, as types : Tuple)</a> + + <div class="summary"><p>Executes a <em>query</em> and returns an array where each row is read as a tuple of the given <em>types</em>.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#query_each(query,*args,&block)-instance-method" class="signature"><strong>#query_each</strong>(query, *args, &block)</a> + + <div class="summary"><p>Executes a <em>query</em> and yields the <code><a href="../DB/ResultSet.html">ResultSet</a></code> once per each row.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#query_one(query,*args,&block:ResultSet-%3EU):UforallU-instance-method" class="signature"><strong>#query_one</strong>(query, *args, &block : ResultSet -> U) : U forall U</a> + + <div class="summary"><p>Executes a <em>query</em> that expects a single row and yields a <code><a href="../DB/ResultSet.html">ResultSet</a></code> positioned at that first row.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#query_one(query,*args,astypes:Tuple)-instance-method" class="signature"><strong>#query_one</strong>(query, *args, as types : Tuple)</a> + + <div class="summary"><p>Executes a <em>query</em> that expects a single row and returns it as a tuple of the given <em>types</em>.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#query_one(query,*args,astypes:NamedTuple)-instance-method" class="signature"><strong>#query_one</strong>(query, *args, as types : NamedTuple)</a> + + <div class="summary"><p>Executes a <em>query</em> that expects a single row and returns it as a named tuple of the given <em>types</em> (the keys of the named tuple are not necessarily the column names).</p></div> + + </li> + + <li class="entry-summary"> + <a href="#query_one(query,*args,astype:Class)-instance-method" class="signature"><strong>#query_one</strong>(query, *args, as type : Class)</a> + + <div class="summary"><p>Executes a <em>query</em> that expects a single row and returns the first column's value as the given <em>type</em>.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#query_one?(query,*args,astype:Class)-instance-method" class="signature"><strong>#query_one?</strong>(query, *args, as type : Class)</a> + + <div class="summary"><p>Executes a <em>query</em> that expects a single row and returns the first column's value as the given <em>type</em>.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#query_one?(query,*args,astypes:NamedTuple)-instance-method" class="signature"><strong>#query_one?</strong>(query, *args, as types : NamedTuple)</a> + + <div class="summary"><p>Executes a <em>query</em> that expects a single row and returns it as a named tuple of the given <em>types</em> (the keys of the named tuple are not necessarily the column names).</p></div> + + </li> + + <li class="entry-summary"> + <a href="#query_one?(query,*args,astypes:Tuple)-instance-method" class="signature"><strong>#query_one?</strong>(query, *args, as types : Tuple)</a> + + <div class="summary"><p>Executes a <em>query</em> that expects a single row and returns it as a tuple of the given <em>types</em>.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#query_one?(query,*args,&block:ResultSet-%3EU):U?forallU-instance-method" class="signature"><strong>#query_one?</strong>(query, *args, &block : ResultSet -> U) : U? forall U</a> + + <div class="summary"><p>Executes a <em>query</em> that expects at most a single row and yields a <code><a href="../DB/ResultSet.html">ResultSet</a></code> positioned at that first row.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#scalar(query,*args)-instance-method" class="signature"><strong>#scalar</strong>(query, *args)</a> + + <div class="summary"><p>Performs the <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">#query</a></code> and returns a single scalar value</p></div> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + +</div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="exec(query,*args)-instance-method"> + <div class="signature"> + + def <strong>exec</strong>(query, *args) + + <a class="method-permalink" href="#exec(query,*args)-instance-method">#</a> + </div> + + <div class="doc"><p>Performs the <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">#query</a></code> and returns an <code><a href="../DB/ExecResult.html">ExecResult</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L262" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query(query,*args)-instance-method"> + <div class="signature"> + + def <strong>query</strong>(query, *args) + + <a class="method-permalink" href="#query(query,*args)-instance-method">#</a> + </div> + + <div class="doc"><p>Executes a <em>query</em> and returns a <code><a href="../DB/ResultSet.html">ResultSet</a></code> with the results. +The <code><a href="../DB/ResultSet.html">ResultSet</a></code> must be closed manually.</p> + +<pre><code>result <span class="o">=</span> db.query <span class="s">"select name from contacts where id = ?"</span>, <span class="n">10</span> +<span class="k">begin</span> + <span class="k">if</span> result.move_next + id <span class="o">=</span> result.read(<span class="t">Int32</span>) + <span class="k">end</span> +<span class="k">ensure</span> + result.close +<span class="k">end</span></code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L37" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query(query,*args,&block)-instance-method"> + <div class="signature"> + + def <strong>query</strong>(query, *args, &block) + + <a class="method-permalink" href="#query(query,*args,&block)-instance-method">#</a> + </div> + + <div class="doc"><p>Executes a <em>query</em> and yields a <code><a href="../DB/ResultSet.html">ResultSet</a></code> with the results. +The <code><a href="../DB/ResultSet.html">ResultSet</a></code> is closed automatically.</p> + +<pre><code>db.query(<span class="s">"select name from contacts where age > ?"</span>, <span class="n">18</span>) <span class="k">do</span> <span class="o">|</span>rs<span class="o">|</span> + rs.each <span class="k">do</span> + name <span class="o">=</span> rs.read(<span class="t">String</span>) + <span class="k">end</span> +<span class="k">end</span></code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L51" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query_all(query,*args,astype:Class)-instance-method"> + <div class="signature"> + + def <strong>query_all</strong>(query, *args, as type : Class) + + <a class="method-permalink" href="#query_all(query,*args,astype:Class)-instance-method">#</a> + </div> + + <div class="doc"><p>Executes a <em>query</em> and returns an array where the +value of each row is read as the given <em>type</em>.</p> + +<pre><code>names <span class="o">=</span> db.query_all <span class="s">"select name from contacts"</span>, <span class="k">as</span>: <span class="t">String</span></code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L239" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query_all(query,*args,astypes:NamedTuple)-instance-method"> + <div class="signature"> + + def <strong>query_all</strong>(query, *args, as types : NamedTuple) + + <a class="method-permalink" href="#query_all(query,*args,astypes:NamedTuple)-instance-method">#</a> + </div> + + <div class="doc"><p>Executes a <em>query</em> and returns an array where each row is +read as a named tuple of the given <em>types</em> (the keys of the named tuple +are not necessarily the column names).</p> + +<pre><code>contacts <span class="o">=</span> db.query_all <span class="s">"select name, age from contacts"</span>, <span class="k">as</span>: {name: <span class="t">String</span>, age: <span class="t">Int32</span>}</code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L227" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query_all(query,*args,&block:ResultSet->U):Array(U)forallU-instance-method"> + <div class="signature"> + + def <strong>query_all</strong>(query, *args, &block : <a href="../DB/ResultSet.html">ResultSet</a> -> U) : Array(U) forall U + + <a class="method-permalink" href="#query_all(query,*args,&block:ResultSet-%3EU):Array(U)forallU-instance-method">#</a> + </div> + + <div class="doc"><p>Executes a <em>query</em> and yield a <code><a href="../DB/ResultSet.html">ResultSet</a></code> positioned at the beginning +of each row, returning an array of the values of the blocks.</p> + +<pre><code>names <span class="o">=</span> db.query_all <span class="s">"select name from contacts"</span>, <span class="o">&</span>.read(<span class="t">String</span>)</code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L200" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query_all(query,*args,astypes:Tuple)-instance-method"> + <div class="signature"> + + def <strong>query_all</strong>(query, *args, as types : Tuple) + + <a class="method-permalink" href="#query_all(query,*args,astypes:Tuple)-instance-method">#</a> + </div> + + <div class="doc"><p>Executes a <em>query</em> and returns an array where each row is +read as a tuple of the given <em>types</em>.</p> + +<pre><code>contacts <span class="o">=</span> db.query_all <span class="s">"select name, age from contacts"</span>, <span class="k">as</span>: {<span class="t">String</span>, <span class="t">Int32</span>}</code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L214" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query_each(query,*args,&block)-instance-method"> + <div class="signature"> + + def <strong>query_each</strong>(query, *args, &block) + + <a class="method-permalink" href="#query_each(query,*args,&block)-instance-method">#</a> + </div> + + <div class="doc"><p>Executes a <em>query</em> and yields the <code><a href="../DB/ResultSet.html">ResultSet</a></code> once per each row. +The <code><a href="../DB/ResultSet.html">ResultSet</a></code> is closed automatically.</p> + +<pre><code>db.query_each <span class="s">"select name from contacts"</span> <span class="k">do</span> <span class="o">|</span>rs<span class="o">|</span> + puts rs.read(<span class="t">String</span>) +<span class="k">end</span></code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L253" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query_one(query,*args,&block:ResultSet->U):UforallU-instance-method"> + <div class="signature"> + + def <strong>query_one</strong>(query, *args, &block : <a href="../DB/ResultSet.html">ResultSet</a> -> U) : U forall U + + <a class="method-permalink" href="#query_one(query,*args,&block:ResultSet-%3EU):UforallU-instance-method">#</a> + </div> + + <div class="doc"><p>Executes a <em>query</em> that expects a single row and yields a <code><a href="../DB/ResultSet.html">ResultSet</a></code> +positioned at that first row.</p> + +<p>The given block must not invoke <code>move_next</code> on the yielded result set.</p> + +<p>Raises <code><a href="../DB/Error.html">DB::Error</a></code> if there were no rows, or if there were more than one row.</p> + +<pre><code>name <span class="o">=</span> db.query_one <span class="s">"select name from contacts where id = ?"</span>, <span class="n">18</span>, <span class="o">&</span>.read(<span class="t">String</span>)</code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L67" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query_one(query,*args,astypes:Tuple)-instance-method"> + <div class="signature"> + + def <strong>query_one</strong>(query, *args, as types : Tuple) + + <a class="method-permalink" href="#query_one(query,*args,astypes:Tuple)-instance-method">#</a> + </div> + + <div class="doc"><p>Executes a <em>query</em> that expects a single row and returns it +as a tuple of the given <em>types</em>.</p> + +<p>Raises <code><a href="../DB/Error.html">DB::Error</a></code> if there were no rows, or if there were more than one row.</p> + +<pre><code>db.query_one <span class="s">"select name, age from contacts where id = ?"</span>, <span class="n">1</span>, <span class="k">as</span>: {<span class="t">String</span>, <span class="t">Int32</span>}</code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L85" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query_one(query,*args,astypes:NamedTuple)-instance-method"> + <div class="signature"> + + def <strong>query_one</strong>(query, *args, as types : NamedTuple) + + <a class="method-permalink" href="#query_one(query,*args,astypes:NamedTuple)-instance-method">#</a> + </div> + + <div class="doc"><p>Executes a <em>query</em> that expects a single row and returns it +as a named tuple of the given <em>types</em> (the keys of the named tuple +are not necessarily the column names).</p> + +<p>Raises <code><a href="../DB/Error.html">DB::Error</a></code> if there were no rows, or if there were more than one row.</p> + +<pre><code>db.query_one <span class="s">"select name, age from contacts where id = ?"</span>, <span class="n">1</span>, <span class="k">as</span>: {name: <span class="t">String</span>, age: <span class="t">Int32</span>}</code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L100" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query_one(query,*args,astype:Class)-instance-method"> + <div class="signature"> + + def <strong>query_one</strong>(query, *args, as type : Class) + + <a class="method-permalink" href="#query_one(query,*args,astype:Class)-instance-method">#</a> + </div> + + <div class="doc"><p>Executes a <em>query</em> that expects a single row +and returns the first column's value as the given <em>type</em>.</p> + +<p>Raises <code><a href="../DB/Error.html">DB::Error</a></code> if there were no rows, or if there were more than one row.</p> + +<pre><code>db.query_one <span class="s">"select name from contacts where id = ?"</span>, <span class="n">1</span>, <span class="k">as</span>: <span class="t">String</span></code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L114" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query_one?(query,*args,astype:Class)-instance-method"> + <div class="signature"> + + def <strong>query_one?</strong>(query, *args, as type : Class) + + <a class="method-permalink" href="#query_one?(query,*args,astype:Class)-instance-method">#</a> + </div> + + <div class="doc"><p>Executes a <em>query</em> that expects a single row +and returns the first column's value as the given <em>type</em>.</p> + +<p>Returns <code>nil</code> if there were no rows.</p> + +<p>Raises <code><a href="../DB/Error.html">DB::Error</a></code> if there were more than one row.</p> + +<pre><code>name <span class="o">=</span> db.query_one? <span class="s">"select name from contacts where id = ?"</span>, <span class="n">1</span>, <span class="k">as</span>: <span class="t">String</span> +<span class="k">typeof</span>(name) <span class="c"># => String?</span></code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L188" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query_one?(query,*args,astypes:NamedTuple)-instance-method"> + <div class="signature"> + + def <strong>query_one?</strong>(query, *args, as types : NamedTuple) + + <a class="method-permalink" href="#query_one?(query,*args,astypes:NamedTuple)-instance-method">#</a> + </div> + + <div class="doc"><p>Executes a <em>query</em> that expects a single row and returns it +as a named tuple of the given <em>types</em> (the keys of the named tuple +are not necessarily the column names).</p> + +<p>Returns <code>nil</code> if there were no rows.</p> + +<p>Raises <code><a href="../DB/Error.html">DB::Error</a></code> if there were more than one row.</p> + +<pre><code>result <span class="o">=</span> db.query_one? <span class="s">"select name, age from contacts where id = ?"</span>, <span class="n">1</span>, <span class="k">as</span>: {age: <span class="t">String</span>, name: <span class="t">Int32</span>} +<span class="k">typeof</span>(result) <span class="c"># => NamedTuple(age: String, name: Int32) | Nil</span></code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L171" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query_one?(query,*args,astypes:Tuple)-instance-method"> + <div class="signature"> + + def <strong>query_one?</strong>(query, *args, as types : Tuple) + + <a class="method-permalink" href="#query_one?(query,*args,astypes:Tuple)-instance-method">#</a> + </div> + + <div class="doc"><p>Executes a <em>query</em> that expects a single row and returns it +as a tuple of the given <em>types</em>.</p> + +<p>Returns <code>nil</code> if there were no rows.</p> + +<p>Raises <code><a href="../DB/Error.html">DB::Error</a></code> if there were more than one row.</p> + +<pre><code>result <span class="o">=</span> db.query_one? <span class="s">"select name, age from contacts where id = ?"</span>, <span class="n">1</span>, <span class="k">as</span>: {<span class="t">String</span>, <span class="t">Int32</span>} +<span class="k">typeof</span>(result) <span class="c"># => Tuple(String, Int32) | Nil</span></code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L153" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query_one?(query,*args,&block:ResultSet->U):U?forallU-instance-method"> + <div class="signature"> + + def <strong>query_one?</strong>(query, *args, &block : <a href="../DB/ResultSet.html">ResultSet</a> -> U) : U? forall U + + <a class="method-permalink" href="#query_one?(query,*args,&block:ResultSet-%3EU):U?forallU-instance-method">#</a> + </div> + + <div class="doc"><p>Executes a <em>query</em> that expects at most a single row and yields a <code><a href="../DB/ResultSet.html">ResultSet</a></code> +positioned at that first row.</p> + +<p>Returns <code>nil</code>, not invoking the block, if there were no rows.</p> + +<p>Raises <code><a href="../DB/Error.html">DB::Error</a></code> if there were more than one row +(this ends up invoking the block once).</p> + +<pre><code>name <span class="o">=</span> db.query_one? <span class="s">"select name from contacts where id = ?"</span>, <span class="n">18</span>, <span class="o">&</span>.read(<span class="t">String</span>) +<span class="k">typeof</span>(name) <span class="c"># => String | Nil</span></code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L132" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="scalar(query,*args)-instance-method"> + <div class="signature"> + + def <strong>scalar</strong>(query, *args) + + <a class="method-permalink" href="#scalar(query,*args)-instance-method">#</a> + </div> + + <div class="doc"><p>Performs the <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">#query</a></code> and returns a single scalar value</p> + +<pre><code>puts db.scalar(<span class="s">"SELECT MAX(name)"</span>).<span class="k">as</span>(<span class="t">String</span>) <span class="c"># => (a String)</span></code></pre></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L271" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/ResultSet.html b/api/0.6.0/DB/ResultSet.html new file mode 100644 index 0000000..e184c4c --- /dev/null +++ b/api/0.6.0/DB/ResultSet.html @@ -0,0 +1,688 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::ResultSet - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">abstract class</span> DB::ResultSet + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/ResultSet.html">DB::ResultSet</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>The response of a query performed on a <code><a href="../DB/Database.html">Database</a></code>.</p> + +<p>See <code><a href="../DB.html">DB</a></code> for a complete sample.</p> + +<p>Each <code><a href="../DB/ResultSet.html#read(**types:Class)-instance-method">#read</a></code> call consumes the result and moves to the next column. +Each column must be read in order. +At any moment a <code><a href="../DB/ResultSet.html#move_next:Bool-instance-method">#move_next</a></code> can be invoked, meaning to skip the +remaining, or even all the columns, in the current row. +Also it is not mandatory to consume the whole <code><a href="../DB/ResultSet.html">ResultSet</a></code>, hence an iteration +through <code><a href="../DB/ResultSet.html#each(&block)-instance-method">#each</a></code> or <code><a href="../DB/ResultSet.html#move_next:Bool-instance-method">#move_next</a></code> can be stopped.</p> + +<p><strong>Note:</strong> depending on how the <code><a href="../DB/ResultSet.html">ResultSet</a></code> was obtained it might be mandatory an +explicit call to <code>#close</code>. Check <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code>.</p> + +<h3>Note to implementors</h3> + +<ol><li>Override <code><a href="../DB/ResultSet.html#move_next:Bool-instance-method">#move_next</a></code> to move to the next row.</li><li>Override <code><a href="../DB/ResultSet.html#read(**types:Class)-instance-method">#read</a></code> returning the next value in the row.</li><li>(Optional) Override <code><a href="../DB/ResultSet.html#read(type:DB::Mappable.class)-instance-method">#read(t)</a></code> for some types <code>t</code> for which custom logic other than a simple cast is needed.</li><li>Override <code><a href="../DB/ResultSet.html#column_count:Int32-instance-method">#column_count</a></code>, <code><a href="../DB/ResultSet.html#column_name(index:Int32):String-instance-method">#column_name</a></code>.</li></ol> + + + + + + <h2>Included Modules</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/Disposable.html">DB::Disposable</a></li> + + </ul> + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L22" target="_blank"> + db/result_set.cr + </a> + + <br/> + + + + + + + <h2>Constructors</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new(statement:DB::Statement)-class-method" class="signature"><strong>.new</strong>(statement : DB::Statement)</a> + + </li> + + </ul> + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#column_count:Int32-instance-method" class="signature"><strong>#column_count</strong> : Int32</a> + + <div class="summary"><p>Returns the number of columns in the result</p></div> + + </li> + + <li class="entry-summary"> + <a href="#column_name(index:Int32):String-instance-method" class="signature"><strong>#column_name</strong>(index : Int32) : String</a> + + <div class="summary"><p>Returns the name of the column in <code>index</code> 0-based position.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#column_names-instance-method" class="signature"><strong>#column_names</strong></a> + + <div class="summary"><p>Returns the name of the columns.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#each(&block)-instance-method" class="signature"><strong>#each</strong>(&block)</a> + + <div class="summary"><p>Iterates over all the rows</p></div> + + </li> + + <li class="entry-summary"> + <a href="#each_column(&block)-instance-method" class="signature"><strong>#each_column</strong>(&block)</a> + + <div class="summary"><p>Iterates over all the columns</p></div> + + </li> + + <li class="entry-summary"> + <a href="#move_next:Bool-instance-method" class="signature"><strong>#move_next</strong> : Bool</a> + + <div class="summary"><p>Move the next row in the result.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#read(type:DB::Mappable.class)-instance-method" class="signature"><strong>#read</strong>(type : <span class="t">DB</span><span class="t">::</span><span class="t">Mappable</span>.<span class="k">class</span>)</a> + + <div class="summary"><p>Reads the next columns and maps them to a class</p></div> + + </li> + + <li class="entry-summary"> + <a href="#read(type:T.class):TforallT-instance-method" class="signature"><strong>#read</strong>(type : <span class="t">T</span>.<span class="k">class</span>) : T forall T</a> + + <div class="summary"><p>Reads the next column value as a <strong>type</strong></p></div> + + </li> + + <li class="entry-summary"> + <a href="#read(**types:Class)-instance-method" class="signature"><strong>#read</strong>(**types : Class)</a> + + <div class="summary"><p>Reads the next columns and returns a named tuple of the values.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#read-instance-method" class="signature"><strong>#read</strong></a> + + <div class="summary"><p>Reads the next column value</p></div> + + </li> + + <li class="entry-summary"> + <a href="#read(*types:Class)-instance-method" class="signature"><strong>#read</strong>(*types : Class)</a> + + <div class="summary"><p>Reads the next columns and returns a tuple of the values.</p></div> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + <h3>Instance methods inherited from module <code><a href="../DB/Disposable.html">DB::Disposable</a></code></h3> + + + <a href="../DB/Disposable.html#close-instance-method" class="tooltip"> + <span>close</span> + close</a>, + + + <a href="../DB/Disposable.html#closed?-instance-method" class="tooltip"> + <span>closed?</span> + closed?</a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Constructor Detail</h2> + + <div class="entry-detail" id="new(statement:DB::Statement)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(statement : <a href="../DB/Statement.html">DB::Statement</a>) + + <a class="method-permalink" href="#new(statement:DB::Statement)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L28" target="_blank">View source</a>] + + </div> + </div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="column_count:Int32-instance-method"> + <div class="signature"> + abstract + def <strong>column_count</strong> : Int32 + + <a class="method-permalink" href="#column_count:Int32-instance-method">#</a> + </div> + + <div class="doc"><p>Returns the number of columns in the result</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L59" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="column_name(index:Int32):String-instance-method"> + <div class="signature"> + abstract + def <strong>column_name</strong>(index : Int32) : String + + <a class="method-permalink" href="#column_name(index:Int32):String-instance-method">#</a> + </div> + + <div class="doc"><p>Returns the name of the column in <code>index</code> 0-based position.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L62" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="column_names-instance-method"> + <div class="signature"> + + def <strong>column_names</strong> + + <a class="method-permalink" href="#column_names-instance-method">#</a> + </div> + + <div class="doc"><p>Returns the name of the columns.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L65" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="each(&block)-instance-method"> + <div class="signature"> + + def <strong>each</strong>(&block) + + <a class="method-permalink" href="#each(&block)-instance-method">#</a> + </div> + + <div class="doc"><p>Iterates over all the rows</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L38" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="each_column(&block)-instance-method"> + <div class="signature"> + + def <strong>each_column</strong>(&block) + + <a class="method-permalink" href="#each_column(&block)-instance-method">#</a> + </div> + + <div class="doc"><p>Iterates over all the columns</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L45" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="move_next:Bool-instance-method"> + <div class="signature"> + abstract + def <strong>move_next</strong> : Bool + + <a class="method-permalink" href="#move_next:Bool-instance-method">#</a> + </div> + + <div class="doc"><p>Move the next row in the result. +Return <code>false</code> if no more rows are available. +See <code><a href="../DB/ResultSet.html#each(&block)-instance-method">#each</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L54" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="read(type:DB::Mappable.class)-instance-method"> + <div class="signature"> + + def <strong>read</strong>(type : <span class="t">DB</span><span class="t">::</span><span class="t">Mappable</span>.<span class="k">class</span>) + + <a class="method-permalink" href="#read(type:DB::Mappable.class)-instance-method">#</a> + </div> + + <div class="doc"><p>Reads the next columns and maps them to a class</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L73" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="read(type:T.class):TforallT-instance-method"> + <div class="signature"> + + def <strong>read</strong>(type : <span class="t">T</span>.<span class="k">class</span>) : T forall T + + <a class="method-permalink" href="#read(type:T.class):TforallT-instance-method">#</a> + </div> + + <div class="doc"><p>Reads the next column value as a <strong>type</strong></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L78" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="read(**types:Class)-instance-method"> + <div class="signature"> + + def <strong>read</strong>(**types : Class) + + <a class="method-permalink" href="#read(**types:Class)-instance-method">#</a> + </div> + + <div class="doc"><p>Reads the next columns and returns a named tuple of the values.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L93" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="read-instance-method"> + <div class="signature"> + abstract + def <strong>read</strong> + + <a class="method-permalink" href="#read-instance-method">#</a> + </div> + + <div class="doc"><p>Reads the next column value</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L70" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="read(*types:Class)-instance-method"> + <div class="signature"> + + def <strong>read</strong>(*types : Class) + + <a class="method-permalink" href="#read(*types:Class)-instance-method">#</a> + </div> + + <div class="doc"><p>Reads the next columns and returns a tuple of the values.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L88" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/Rollback.html b/api/0.6.0/DB/Rollback.html new file mode 100644 index 0000000..663296e --- /dev/null +++ b/api/0.6.0/DB/Rollback.html @@ -0,0 +1,343 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::Rollback - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::Rollback + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/Rollback.html">DB::Rollback</a></li><li class="superclass"><a href="../DB/Error.html">DB::Error</a></li><li class="superclass">Exception</li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr#L30" target="_blank"> + db/error.cr + </a> + + <br/> + + + + + + + + + + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + + + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/SavePointTransaction.html b/api/0.6.0/DB/SavePointTransaction.html new file mode 100644 index 0000000..57bf826 --- /dev/null +++ b/api/0.6.0/DB/SavePointTransaction.html @@ -0,0 +1,568 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::SavePointTransaction - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::SavePointTransaction + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/SavePointTransaction.html">DB::SavePointTransaction</a></li><li class="superclass"><a href="../DB/Transaction.html">DB::Transaction</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L94" target="_blank"> + db/transaction.cr + </a> + + <br/> + + + + + + + <h2>Constructors</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new(parent:Transaction,savepoint_name:String)-class-method" class="signature"><strong>.new</strong>(parent : Transaction, savepoint_name : String)</a> + + </li> + + </ul> + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#begin_transaction:Transaction-instance-method" class="signature"><strong>#begin_transaction</strong> : Transaction</a> + + </li> + + <li class="entry-summary"> + <a href="#commit-instance-method" class="signature"><strong>#commit</strong></a> + + </li> + + <li class="entry-summary"> + <a href="#connection:Connection-instance-method" class="signature"><strong>#connection</strong> : Connection</a> + + </li> + + <li class="entry-summary"> + <a href="#create_save_point_transaction(parent:Transaction)-instance-method" class="signature"><strong>#create_save_point_transaction</strong>(parent : Transaction)</a> + + </li> + + <li class="entry-summary"> + <a href="#release_from_nested_transaction-instance-method" class="signature"><strong>#release_from_nested_transaction</strong></a> + + </li> + + <li class="entry-summary"> + <a href="#rollback-instance-method" class="signature"><strong>#rollback</strong></a> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + <h3>Instance methods inherited from class <code><a href="../DB/Transaction.html">DB::Transaction</a></code></h3> + + + <a href="../DB/Transaction.html#commit-instance-method" class="tooltip"> + <span>commit</span> + commit</a>, + + + <a href="../DB/Transaction.html#connection:Connection-instance-method" class="tooltip"> + <span>connection : Connection</span> + connection</a>, + + + <a href="../DB/Transaction.html#release_from_nested_transaction-instance-method" class="tooltip"> + <span>release_from_nested_transaction</span> + release_from_nested_transaction</a>, + + + <a href="../DB/Transaction.html#rollback-instance-method" class="tooltip"> + <span>rollback</span> + rollback</a> + + + + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/BeginTransaction.html">DB::BeginTransaction</a></code></h3> + + + <a href="../DB/BeginTransaction.html#begin_transaction:Transaction-instance-method" class="tooltip"> + <span>begin_transaction : Transaction</span> + begin_transaction</a>, + + + <a href="../DB/BeginTransaction.html#transaction(&block)-instance-method" class="tooltip"> + <span>transaction(&block)</span> + transaction</a> + + + + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/Disposable.html">DB::Disposable</a></code></h3> + + + <a href="../DB/Disposable.html#close-instance-method" class="tooltip"> + <span>close</span> + close</a>, + + + <a href="../DB/Disposable.html#closed?-instance-method" class="tooltip"> + <span>closed?</span> + closed?</a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Constructor Detail</h2> + + <div class="entry-detail" id="new(parent:Transaction,savepoint_name:String)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(parent : <a href="../DB/Transaction.html">Transaction</a>, savepoint_name : String) + + <a class="method-permalink" href="#new(parent:Transaction,savepoint_name:String)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L97" target="_blank">View source</a>] + + </div> + </div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="begin_transaction:Transaction-instance-method"> + <div class="signature"> + + def <strong>begin_transaction</strong> : <a href="../DB/Transaction.html">Transaction</a> + + <a class="method-permalink" href="#begin_transaction:Transaction-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L117" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="commit-instance-method"> + <div class="signature"> + + def <strong>commit</strong> + + <a class="method-permalink" href="#commit-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L103" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="connection:Connection-instance-method"> + <div class="signature"> + + def <strong>connection</strong> : <a href="../DB/Connection.html">Connection</a> + + <a class="method-permalink" href="#connection:Connection-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L97" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="create_save_point_transaction(parent:Transaction)-instance-method"> + <div class="signature"> + + def <strong>create_save_point_transaction</strong>(parent : <a href="../DB/Transaction.html">Transaction</a>) + + <a class="method-permalink" href="#create_save_point_transaction(parent:Transaction)-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L123" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="release_from_nested_transaction-instance-method"> + <div class="signature"> + + def <strong>release_from_nested_transaction</strong> + + <a class="method-permalink" href="#release_from_nested_transaction-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L127" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="rollback-instance-method"> + <div class="signature"> + + def <strong>rollback</strong> + + <a class="method-permalink" href="#rollback-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L108" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/SessionMethods.html b/api/0.6.0/DB/SessionMethods.html new file mode 100644 index 0000000..d7facd9 --- /dev/null +++ b/api/0.6.0/DB/SessionMethods.html @@ -0,0 +1,576 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::SessionMethods(Session, Stmt) - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">module</span> DB::SessionMethods(Session, Stmt) + +</h1> + + + + + + <h2>Overview</h2> + + <p>Methods that are shared accross session like objects:</p> + +<ul><li>Database</li><li>Connection</li></ul></ul> + +<p>Classes that includes this module are able to execute +queries and statements in both prepared and unprepared fashion.</p> + +<p>This module serves for dsl reuse over session like objects.</p> + + + + + + <h2>Included Modules</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/QueryMethods.html">DB::QueryMethods(Stmt)</a></li> + + </ul> + + + + + + + + <h2>Direct including types</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/Connection.html">DB::Connection</a></li> + + <li class="other-type"><a href="../DB/Database.html">DB::Database</a></li> + + </ul> + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L10" target="_blank"> + db/session_methods.cr + </a> + + <br/> + + + + + + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#build(query):Stmt-instance-method" class="signature"><strong>#build</strong>(query) : Stmt</a> + + </li> + + <li class="entry-summary"> + <a href="#build_unprepared_statement(query):Stmt-instance-method" class="signature"><strong>#build_unprepared_statement</strong>(query) : Stmt</a> + + </li> + + <li class="entry-summary"> + <a href="#fetch_or_build_prepared_statement(query):Stmt-instance-method" class="signature"><strong>#fetch_or_build_prepared_statement</strong>(query) : Stmt</a> + + </li> + + <li class="entry-summary"> + <a href="#prepared(query)-instance-method" class="signature"><strong>#prepared</strong>(query)</a> + + <div class="summary"><p>Returns a prepared <code><a href="../DB/Statement.html">Statement</a></code> that has not been executed yet.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#prepared-instance-method" class="signature"><strong>#prepared</strong></a> + + <div class="summary"><p>dsl helper to build prepared statements returns a value that includes <code><a href="../DB/QueryMethods.html">QueryMethods</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#prepared_statements?:Bool-instance-method" class="signature"><strong>#prepared_statements?</strong> : Bool</a> + + <div class="summary"><p>Returns whether by default the statements should be prepared or not.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#unprepared(query)-instance-method" class="signature"><strong>#unprepared</strong>(query)</a> + + <div class="summary"><p>Returns an unprepared <code><a href="../DB/Statement.html">Statement</a></code> that has not been executed yet.</p></div> + + </li> + + <li class="entry-summary"> + <a href="#unprepared-instance-method" class="signature"><strong>#unprepared</strong></a> + + <div class="summary"><p>dsl helper to build unprepared statements returns a value that includes <code><a href="../DB/QueryMethods.html">QueryMethods</a></code></p></div> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + <h3>Instance methods inherited from module <code><a href="../DB/QueryMethods.html">DB::QueryMethods(Stmt)</a></code></h3> + + + <a href="../DB/QueryMethods.html#exec(query,*args)-instance-method" class="tooltip"> + <span>exec(query, *args)</span> + exec</a>, + + + <a href="../DB/QueryMethods.html#query(query,*args)-instance-method" class="tooltip"> + <span>query(query, *args)<br/>query(query, *args, &block)</span> + query</a>, + + + <a href="../DB/QueryMethods.html#query_all(query,*args,astype:Class)-instance-method" class="tooltip"> + <span>query_all(query, *args, as type : Class)<br/>query_all(query, *args, as types : NamedTuple)<br/>query_all(query, *args, &block : ResultSet -> U) : Array(U) forall U<br/>query_all(query, *args, as types : Tuple)</span> + query_all</a>, + + + <a href="../DB/QueryMethods.html#query_each(query,*args,&block)-instance-method" class="tooltip"> + <span>query_each(query, *args, &block)</span> + query_each</a>, + + + <a href="../DB/QueryMethods.html#query_one(query,*args,&block:ResultSet-%3EU):UforallU-instance-method" class="tooltip"> + <span>query_one(query, *args, &block : ResultSet -> U) : U forall U<br/>query_one(query, *args, as types : Tuple)<br/>query_one(query, *args, as types : NamedTuple)<br/>query_one(query, *args, as type : Class)</span> + query_one</a>, + + + <a href="../DB/QueryMethods.html#query_one?(query,*args,astype:Class)-instance-method" class="tooltip"> + <span>query_one?(query, *args, as type : Class)<br/>query_one?(query, *args, as types : NamedTuple)<br/>query_one?(query, *args, as types : Tuple)<br/>query_one?(query, *args, &block : ResultSet -> U) : U? forall U</span> + query_one?</a>, + + + <a href="../DB/QueryMethods.html#scalar(query,*args)-instance-method" class="tooltip"> + <span>scalar(query, *args)</span> + scalar</a> + + + + + + + + + + + +</div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="build(query):Stmt-instance-method"> + <div class="signature"> + + def <strong>build</strong>(query) : Stmt + + <a class="method-permalink" href="#build(query):Stmt-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L21" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="build_unprepared_statement(query):Stmt-instance-method"> + <div class="signature"> + abstract + def <strong>build_unprepared_statement</strong>(query) : Stmt + + <a class="method-permalink" href="#build_unprepared_statement(query):Stmt-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L19" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="fetch_or_build_prepared_statement(query):Stmt-instance-method"> + <div class="signature"> + abstract + def <strong>fetch_or_build_prepared_statement</strong>(query) : Stmt + + <a class="method-permalink" href="#fetch_or_build_prepared_statement(query):Stmt-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L17" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="prepared(query)-instance-method"> + <div class="signature"> + + def <strong>prepared</strong>(query) + + <a class="method-permalink" href="#prepared(query)-instance-method">#</a> + </div> + + <div class="doc"><p>Returns a prepared <code><a href="../DB/Statement.html">Statement</a></code> that has not been executed yet.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L36" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="prepared-instance-method"> + <div class="signature"> + + def <strong>prepared</strong> + + <a class="method-permalink" href="#prepared-instance-method">#</a> + </div> + + <div class="doc"><p>dsl helper to build prepared statements +returns a value that includes <code><a href="../DB/QueryMethods.html">QueryMethods</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L31" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="prepared_statements?:Bool-instance-method"> + <div class="signature"> + abstract + def <strong>prepared_statements?</strong> : Bool + + <a class="method-permalink" href="#prepared_statements?:Bool-instance-method">#</a> + </div> + + <div class="doc"><p>Returns whether by default the statements should +be prepared or not.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L15" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="unprepared(query)-instance-method"> + <div class="signature"> + + def <strong>unprepared</strong>(query) + + <a class="method-permalink" href="#unprepared(query)-instance-method">#</a> + </div> + + <div class="doc"><p>Returns an unprepared <code><a href="../DB/Statement.html">Statement</a></code> that has not been executed yet.</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L47" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="unprepared-instance-method"> + <div class="signature"> + + def <strong>unprepared</strong> + + <a class="method-permalink" href="#unprepared-instance-method">#</a> + </div> + + <div class="doc"><p>dsl helper to build unprepared statements +returns a value that includes <code><a href="../DB/QueryMethods.html">QueryMethods</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L42" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/SessionMethods/PreparedQuery.html b/api/0.6.0/DB/SessionMethods/PreparedQuery.html new file mode 100644 index 0000000..9951d2a --- /dev/null +++ b/api/0.6.0/DB/SessionMethods/PreparedQuery.html @@ -0,0 +1,447 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::SessionMethods::PreparedQuery(Session, Stmt) - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">struct</span> DB::SessionMethods::PreparedQuery(Session, Stmt) + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../../DB/SessionMethods/PreparedQuery.html">DB::SessionMethods::PreparedQuery(Session, Stmt)</a></li><li class="superclass">Struct</li><li class="superclass">Value</li><li class="superclass">Object</li></ul> + + + + + + + + + <h2>Included Modules</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../../DB/QueryMethods.html">DB::QueryMethods(Stmt)</a></li> + + </ul> + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L51" target="_blank"> + db/session_methods.cr + </a> + + <br/> + + + + + + + <h2>Constructors</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new(session:Session)-class-method" class="signature"><strong>.new</strong>(session : Session)</a> + + </li> + + </ul> + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#build(query):Stmt-instance-method" class="signature"><strong>#build</strong>(query) : Stmt</a> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + <h3>Instance methods inherited from module <code><a href="../../DB/QueryMethods.html">DB::QueryMethods(Stmt)</a></code></h3> + + + <a href="../../DB/QueryMethods.html#exec(query,*args)-instance-method" class="tooltip"> + <span>exec(query, *args)</span> + exec</a>, + + + <a href="../../DB/QueryMethods.html#query(query,*args)-instance-method" class="tooltip"> + <span>query(query, *args)<br/>query(query, *args, &block)</span> + query</a>, + + + <a href="../../DB/QueryMethods.html#query_all(query,*args,astype:Class)-instance-method" class="tooltip"> + <span>query_all(query, *args, as type : Class)<br/>query_all(query, *args, as types : NamedTuple)<br/>query_all(query, *args, &block : ResultSet -> U) : Array(U) forall U<br/>query_all(query, *args, as types : Tuple)</span> + query_all</a>, + + + <a href="../../DB/QueryMethods.html#query_each(query,*args,&block)-instance-method" class="tooltip"> + <span>query_each(query, *args, &block)</span> + query_each</a>, + + + <a href="../../DB/QueryMethods.html#query_one(query,*args,&block:ResultSet-%3EU):UforallU-instance-method" class="tooltip"> + <span>query_one(query, *args, &block : ResultSet -> U) : U forall U<br/>query_one(query, *args, as types : Tuple)<br/>query_one(query, *args, as types : NamedTuple)<br/>query_one(query, *args, as type : Class)</span> + query_one</a>, + + + <a href="../../DB/QueryMethods.html#query_one?(query,*args,astype:Class)-instance-method" class="tooltip"> + <span>query_one?(query, *args, as type : Class)<br/>query_one?(query, *args, as types : NamedTuple)<br/>query_one?(query, *args, as types : Tuple)<br/>query_one?(query, *args, &block : ResultSet -> U) : U? forall U</span> + query_one?</a>, + + + <a href="../../DB/QueryMethods.html#scalar(query,*args)-instance-method" class="tooltip"> + <span>scalar(query, *args)</span> + scalar</a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Constructor Detail</h2> + + <div class="entry-detail" id="new(session:Session)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(session : Session) + + <a class="method-permalink" href="#new(session:Session)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L54" target="_blank">View source</a>] + + </div> + </div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="build(query):Stmt-instance-method"> + <div class="signature"> + + def <strong>build</strong>(query) : Stmt + + <a class="method-permalink" href="#build(query):Stmt-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L57" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/SessionMethods/UnpreparedQuery.html b/api/0.6.0/DB/SessionMethods/UnpreparedQuery.html new file mode 100644 index 0000000..ce5e73d --- /dev/null +++ b/api/0.6.0/DB/SessionMethods/UnpreparedQuery.html @@ -0,0 +1,447 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::SessionMethods::UnpreparedQuery(Session, Stmt) - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">struct</span> DB::SessionMethods::UnpreparedQuery(Session, Stmt) + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../../DB/SessionMethods/UnpreparedQuery.html">DB::SessionMethods::UnpreparedQuery(Session, Stmt)</a></li><li class="superclass">Struct</li><li class="superclass">Value</li><li class="superclass">Object</li></ul> + + + + + + + + + <h2>Included Modules</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../../DB/QueryMethods.html">DB::QueryMethods(Stmt)</a></li> + + </ul> + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L62" target="_blank"> + db/session_methods.cr + </a> + + <br/> + + + + + + + <h2>Constructors</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new(session:Session)-class-method" class="signature"><strong>.new</strong>(session : Session)</a> + + </li> + + </ul> + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#build(query):Stmt-instance-method" class="signature"><strong>#build</strong>(query) : Stmt</a> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + <h3>Instance methods inherited from module <code><a href="../../DB/QueryMethods.html">DB::QueryMethods(Stmt)</a></code></h3> + + + <a href="../../DB/QueryMethods.html#exec(query,*args)-instance-method" class="tooltip"> + <span>exec(query, *args)</span> + exec</a>, + + + <a href="../../DB/QueryMethods.html#query(query,*args)-instance-method" class="tooltip"> + <span>query(query, *args)<br/>query(query, *args, &block)</span> + query</a>, + + + <a href="../../DB/QueryMethods.html#query_all(query,*args,astype:Class)-instance-method" class="tooltip"> + <span>query_all(query, *args, as type : Class)<br/>query_all(query, *args, as types : NamedTuple)<br/>query_all(query, *args, &block : ResultSet -> U) : Array(U) forall U<br/>query_all(query, *args, as types : Tuple)</span> + query_all</a>, + + + <a href="../../DB/QueryMethods.html#query_each(query,*args,&block)-instance-method" class="tooltip"> + <span>query_each(query, *args, &block)</span> + query_each</a>, + + + <a href="../../DB/QueryMethods.html#query_one(query,*args,&block:ResultSet-%3EU):UforallU-instance-method" class="tooltip"> + <span>query_one(query, *args, &block : ResultSet -> U) : U forall U<br/>query_one(query, *args, as types : Tuple)<br/>query_one(query, *args, as types : NamedTuple)<br/>query_one(query, *args, as type : Class)</span> + query_one</a>, + + + <a href="../../DB/QueryMethods.html#query_one?(query,*args,astype:Class)-instance-method" class="tooltip"> + <span>query_one?(query, *args, as type : Class)<br/>query_one?(query, *args, as types : NamedTuple)<br/>query_one?(query, *args, as types : Tuple)<br/>query_one?(query, *args, &block : ResultSet -> U) : U? forall U</span> + query_one?</a>, + + + <a href="../../DB/QueryMethods.html#scalar(query,*args)-instance-method" class="tooltip"> + <span>scalar(query, *args)</span> + scalar</a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Constructor Detail</h2> + + <div class="entry-detail" id="new(session:Session)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(session : Session) + + <a class="method-permalink" href="#new(session:Session)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L65" target="_blank">View source</a>] + + </div> + </div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="build(query):Stmt-instance-method"> + <div class="signature"> + + def <strong>build</strong>(query) : Stmt + + <a class="method-permalink" href="#build(query):Stmt-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L68" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/Statement.html b/api/0.6.0/DB/Statement.html new file mode 100644 index 0000000..19ba5eb --- /dev/null +++ b/api/0.6.0/DB/Statement.html @@ -0,0 +1,600 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::Statement - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">abstract class</span> DB::Statement + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/Statement.html">DB::Statement</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>Represents a query in a <code><a href="../DB/Connection.html">Connection</a></code>. +It should be created by <code><a href="../DB/QueryMethods.html">QueryMethods</a></code>.</p> + +<h3>Note to implementors</h3> + +<ol><li>Subclass <code>Statements</code></li><li><code>Statements</code> are created from a custom driver <code>Connection#prepare</code> method.</li><li><code>#perform_query</code> executes a query that is expected to return a <code><a href="../DB/ResultSet.html">ResultSet</a></code></li><li><code>#perform_exec</code> executes a query that is expected to return an <code><a href="../DB/ExecResult.html">ExecResult</a></code></li><li><code>#do_close</code> is called to release the statement resources.</li></ol> + + + + + + <h2>Included Modules</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/StatementMethods.html">DB::StatementMethods</a></li> + + </ul> + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L52" target="_blank"> + db/statement.cr + </a> + + <br/> + + + + + + + <h2>Constructors</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new(connection:Connection)-class-method" class="signature"><strong>.new</strong>(connection : Connection)</a> + + </li> + + </ul> + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#exec(args:Array):DB::ExecResult-instance-method" class="signature"><strong>#exec</strong>(args : Array) : DB::ExecResult</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#exec:DB::ExecResult-instance-method" class="signature"><strong>#exec</strong> : DB::ExecResult</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#exec(*args)-instance-method" class="signature"><strong>#exec</strong>(*args)</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#query(args:Array):DB::ResultSet-instance-method" class="signature"><strong>#query</strong>(args : Array) : DB::ResultSet</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#query:DB::ResultSet-instance-method" class="signature"><strong>#query</strong> : DB::ResultSet</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#query(*args)-instance-method" class="signature"><strong>#query</strong>(*args)</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#release_connection-instance-method" class="signature"><strong>#release_connection</strong></a> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + <h3>Instance methods inherited from module <code><a href="../DB/StatementMethods.html">DB::StatementMethods</a></code></h3> + + + <a href="../DB/StatementMethods.html#exec(args:Array):ExecResult-instance-method" class="tooltip"> + <span>exec(args : Array) : ExecResult<br/>exec : ExecResult<br/>exec(*args) : ExecResult</span> + exec</a>, + + + <a href="../DB/StatementMethods.html#query(*args,&block)-instance-method" class="tooltip"> + <span>query(*args, &block)<br/>query(args : Array) : ResultSet<br/>query : ResultSet<br/>query(*args) : ResultSet</span> + query</a>, + + + <a href="../DB/StatementMethods.html#scalar(*args)-instance-method" class="tooltip"> + <span>scalar(*args)</span> + scalar</a> + + + + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/Disposable.html">DB::Disposable</a></code></h3> + + + <a href="../DB/Disposable.html#close-instance-method" class="tooltip"> + <span>close</span> + close</a>, + + + <a href="../DB/Disposable.html#closed?-instance-method" class="tooltip"> + <span>closed?</span> + closed?</a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Constructor Detail</h2> + + <div class="entry-detail" id="new(connection:Connection)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(connection : <a href="../DB/Connection.html">Connection</a>) + + <a class="method-permalink" href="#new(connection:Connection)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L58" target="_blank">View source</a>] + + </div> + </div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="exec(args:Array):DB::ExecResult-instance-method"> + <div class="signature"> + + def <strong>exec</strong>(args : Array) : <a href="../DB/ExecResult.html">DB::ExecResult</a> + + <a class="method-permalink" href="#exec(args:Array):DB::ExecResult-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L71" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="exec:DB::ExecResult-instance-method"> + <div class="signature"> + + def <strong>exec</strong> : <a href="../DB/ExecResult.html">DB::ExecResult</a> + + <a class="method-permalink" href="#exec:DB::ExecResult-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L66" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="exec(*args)-instance-method"> + <div class="signature"> + + def <strong>exec</strong>(*args) + + <a class="method-permalink" href="#exec(*args)-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L76" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query(args:Array):DB::ResultSet-instance-method"> + <div class="signature"> + + def <strong>query</strong>(args : Array) : <a href="../DB/ResultSet.html">DB::ResultSet</a> + + <a class="method-permalink" href="#query(args:Array):DB::ResultSet-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L87" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query:DB::ResultSet-instance-method"> + <div class="signature"> + + def <strong>query</strong> : <a href="../DB/ResultSet.html">DB::ResultSet</a> + + <a class="method-permalink" href="#query:DB::ResultSet-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L82" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query(*args)-instance-method"> + <div class="signature"> + + def <strong>query</strong>(*args) + + <a class="method-permalink" href="#query(*args)-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L92" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="release_connection-instance-method"> + <div class="signature"> + + def <strong>release_connection</strong> + + <a class="method-permalink" href="#release_connection-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L61" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/StatementMethods.html b/api/0.6.0/DB/StatementMethods.html new file mode 100644 index 0000000..2e7e487 --- /dev/null +++ b/api/0.6.0/DB/StatementMethods.html @@ -0,0 +1,554 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::StatementMethods - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">module</span> DB::StatementMethods + +</h1> + + + + + + <h2>Overview</h2> + + <p>Common interface for connection based statements +and for connection pool statements.</p> + + + + + + <h2>Included Modules</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/Disposable.html">DB::Disposable</a></li> + + </ul> + + + + + + + + <h2>Direct including types</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/PoolStatement.html">DB::PoolStatement</a></li> + + <li class="other-type"><a href="../DB/Statement.html">DB::Statement</a></li> + + </ul> + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L4" target="_blank"> + db/statement.cr + </a> + + <br/> + + + + + + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#exec(args:Array):ExecResult-instance-method" class="signature"><strong>#exec</strong>(args : Array) : ExecResult</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#exec:ExecResult-instance-method" class="signature"><strong>#exec</strong> : ExecResult</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#exec(*args):ExecResult-instance-method" class="signature"><strong>#exec</strong>(*args) : ExecResult</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#query(*args,&block)-instance-method" class="signature"><strong>#query</strong>(*args, &block)</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#query(args:Array):ResultSet-instance-method" class="signature"><strong>#query</strong>(args : Array) : ResultSet</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#query:ResultSet-instance-method" class="signature"><strong>#query</strong> : ResultSet</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#query(*args):ResultSet-instance-method" class="signature"><strong>#query</strong>(*args) : ResultSet</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + </li> + + <li class="entry-summary"> + <a href="#scalar(*args)-instance-method" class="signature"><strong>#scalar</strong>(*args)</a> + + <div class="summary"><p>See <code><a href="../DB/QueryMethods.html#scalar(query,*args)-instance-method">QueryMethods#scalar</a></code></p></div> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + <h3>Instance methods inherited from module <code><a href="../DB/Disposable.html">DB::Disposable</a></code></h3> + + + <a href="../DB/Disposable.html#close-instance-method" class="tooltip"> + <span>close</span> + close</a>, + + + <a href="../DB/Disposable.html#closed?-instance-method" class="tooltip"> + <span>closed?</span> + closed?</a> + + + + + + + + + + + +</div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="exec(args:Array):ExecResult-instance-method"> + <div class="signature"> + abstract + def <strong>exec</strong>(args : Array) : <a href="../DB/ExecResult.html">ExecResult</a> + + <a class="method-permalink" href="#exec(args:Array):ExecResult-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L32" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="exec:ExecResult-instance-method"> + <div class="signature"> + abstract + def <strong>exec</strong> : <a href="../DB/ExecResult.html">ExecResult</a> + + <a class="method-permalink" href="#exec:ExecResult-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L28" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="exec(*args):ExecResult-instance-method"> + <div class="signature"> + abstract + def <strong>exec</strong>(*args) : <a href="../DB/ExecResult.html">ExecResult</a> + + <a class="method-permalink" href="#exec(*args):ExecResult-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#exec(query,*args)-instance-method">QueryMethods#exec</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L30" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query(*args,&block)-instance-method"> + <div class="signature"> + + def <strong>query</strong>(*args, &block) + + <a class="method-permalink" href="#query(*args,&block)-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L22" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query(args:Array):ResultSet-instance-method"> + <div class="signature"> + abstract + def <strong>query</strong>(args : Array) : <a href="../DB/ResultSet.html">ResultSet</a> + + <a class="method-permalink" href="#query(args:Array):ResultSet-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L39" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query:ResultSet-instance-method"> + <div class="signature"> + abstract + def <strong>query</strong> : <a href="../DB/ResultSet.html">ResultSet</a> + + <a class="method-permalink" href="#query:ResultSet-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L35" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="query(*args):ResultSet-instance-method"> + <div class="signature"> + abstract + def <strong>query</strong>(*args) : <a href="../DB/ResultSet.html">ResultSet</a> + + <a class="method-permalink" href="#query(*args):ResultSet-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#query(query,*args)-instance-method">QueryMethods#query</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L37" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="scalar(*args)-instance-method"> + <div class="signature"> + + def <strong>scalar</strong>(*args) + + <a class="method-permalink" href="#scalar(*args)-instance-method">#</a> + </div> + + <div class="doc"><p>See <code><a href="../DB/QueryMethods.html#scalar(query,*args)-instance-method">QueryMethods#scalar</a></code></p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L11" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/StringKeyCache.html b/api/0.6.0/DB/StringKeyCache.html new file mode 100644 index 0000000..14993c7 --- /dev/null +++ b/api/0.6.0/DB/StringKeyCache.html @@ -0,0 +1,394 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::StringKeyCache(T) - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::StringKeyCache(T) + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/StringKeyCache.html">DB::StringKeyCache(T)</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/string_key_cache.cr#L2" target="_blank"> + db/string_key_cache.cr + </a> + + <br/> + + + + + + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#clear-instance-method" class="signature"><strong>#clear</strong></a> + + </li> + + <li class="entry-summary"> + <a href="#each_value(&block)-instance-method" class="signature"><strong>#each_value</strong>(&block)</a> + + </li> + + <li class="entry-summary"> + <a href="#fetch(key:String,&block):T-instance-method" class="signature"><strong>#fetch</strong>(key : String, &block) : T</a> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + + + + + + + + + + + + + + + + + + +</div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="clear-instance-method"> + <div class="signature"> + + def <strong>clear</strong> + + <a class="method-permalink" href="#clear-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/string_key_cache.cr#L17" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="each_value(&block)-instance-method"> + <div class="signature"> + + def <strong>each_value</strong>(&block) + + <a class="method-permalink" href="#each_value(&block)-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/string_key_cache.cr#L11" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="fetch(key:String,&block):T-instance-method"> + <div class="signature"> + + def <strong>fetch</strong>(key : String, &block) : T + + <a class="method-permalink" href="#fetch(key:String,&block):T-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/string_key_cache.cr#L5" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/TopLevelTransaction.html b/api/0.6.0/DB/TopLevelTransaction.html new file mode 100644 index 0000000..aea0c9b --- /dev/null +++ b/api/0.6.0/DB/TopLevelTransaction.html @@ -0,0 +1,526 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::TopLevelTransaction - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">class</span> DB::TopLevelTransaction + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/TopLevelTransaction.html">DB::TopLevelTransaction</a></li><li class="superclass"><a href="../DB/Transaction.html">DB::Transaction</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + + + + + + + + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L38" target="_blank"> + db/transaction.cr + </a> + + <br/> + + + + + + + <h2>Constructors</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#new(connection:Connection)-class-method" class="signature"><strong>.new</strong>(connection : Connection)</a> + + </li> + + </ul> + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#begin_transaction:Transaction-instance-method" class="signature"><strong>#begin_transaction</strong> : Transaction</a> + + </li> + + <li class="entry-summary"> + <a href="#commit-instance-method" class="signature"><strong>#commit</strong></a> + + </li> + + <li class="entry-summary"> + <a href="#connection:Connection-instance-method" class="signature"><strong>#connection</strong> : Connection</a> + + </li> + + <li class="entry-summary"> + <a href="#rollback-instance-method" class="signature"><strong>#rollback</strong></a> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + <h3>Instance methods inherited from class <code><a href="../DB/Transaction.html">DB::Transaction</a></code></h3> + + + <a href="../DB/Transaction.html#commit-instance-method" class="tooltip"> + <span>commit</span> + commit</a>, + + + <a href="../DB/Transaction.html#connection:Connection-instance-method" class="tooltip"> + <span>connection : Connection</span> + connection</a>, + + + <a href="../DB/Transaction.html#release_from_nested_transaction-instance-method" class="tooltip"> + <span>release_from_nested_transaction</span> + release_from_nested_transaction</a>, + + + <a href="../DB/Transaction.html#rollback-instance-method" class="tooltip"> + <span>rollback</span> + rollback</a> + + + + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/BeginTransaction.html">DB::BeginTransaction</a></code></h3> + + + <a href="../DB/BeginTransaction.html#begin_transaction:Transaction-instance-method" class="tooltip"> + <span>begin_transaction : Transaction</span> + begin_transaction</a>, + + + <a href="../DB/BeginTransaction.html#transaction(&block)-instance-method" class="tooltip"> + <span>transaction(&block)</span> + transaction</a> + + + + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/Disposable.html">DB::Disposable</a></code></h3> + + + <a href="../DB/Disposable.html#close-instance-method" class="tooltip"> + <span>close</span> + close</a>, + + + <a href="../DB/Disposable.html#closed?-instance-method" class="tooltip"> + <span>closed?</span> + closed?</a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + <h2>Constructor Detail</h2> + + <div class="entry-detail" id="new(connection:Connection)-class-method"> + <div class="signature"> + + def self.<strong>new</strong>(connection : <a href="../DB/Connection.html">Connection</a>) + + <a class="method-permalink" href="#new(connection:Connection)-class-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L43" target="_blank">View source</a>] + + </div> + </div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="begin_transaction:Transaction-instance-method"> + <div class="signature"> + + def <strong>begin_transaction</strong> : <a href="../DB/Transaction.html">Transaction</a> + + <a class="method-permalink" href="#begin_transaction:Transaction-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L62" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="commit-instance-method"> + <div class="signature"> + + def <strong>commit</strong> + + <a class="method-permalink" href="#commit-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L48" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="connection:Connection-instance-method"> + <div class="signature"> + + def <strong>connection</strong> : <a href="../DB/Connection.html">Connection</a> + + <a class="method-permalink" href="#connection:Connection-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L41" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="rollback-instance-method"> + <div class="signature"> + + def <strong>rollback</strong> + + <a class="method-permalink" href="#rollback-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L53" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/DB/Transaction.html b/api/0.6.0/DB/Transaction.html new file mode 100644 index 0000000..61a702e --- /dev/null +++ b/api/0.6.0/DB/Transaction.html @@ -0,0 +1,503 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="../css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="../js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = "../"; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>DB::Transaction - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="../index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent open current" data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="../DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="../DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="../DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="../DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="../DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="../DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="../DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="../DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="../DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="../DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="../DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="../DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="../DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="../DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="../DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="../DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="../DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="../DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="../DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="../DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="../DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="../DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="../DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="../DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="../DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="../DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="../DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="../DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="../DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="../DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="../DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="../DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="../DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="../DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" current" data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="../DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<h1 class="type-name"> + + <span class="kind">abstract class</span> DB::Transaction + +</h1> + + + <ul class="superclass-hierarchy"><li class="superclass"><a href="../DB/Transaction.html">DB::Transaction</a></li><li class="superclass">Reference</li><li class="superclass">Object</li></ul> + + + + + <h2>Overview</h2> + + <p>Transactions should be started from <code>DB#transaction</code>, <code>Connection#transaction</code> +or <code><a href="../DB/Connection.html#begin_transaction:Transaction-instance-method">Connection#begin_transaction</a></code>.</p> + +<p>Use <code><a href="../DB/Transaction.html#connection:Connection-instance-method">Transaction#connection</a></code> to submit statements to the database.</p> + +<p>Use <code><a href="../DB/Transaction.html#commit-instance-method">Transaction#commit</a></code> or <code><a href="../DB/Transaction.html#rollback-instance-method">Transaction#rollback</a></code> to close the ongoing transaction +explicitly. Or refer to <code><a href="../DB/BeginTransaction.html#transaction(&block)-instance-method">BeginTransaction#transaction</a></code> for documentation on how to +use <code>#transaction(&block)</code> methods in <code><a href="../DB.html">DB</a></code> and <code><a href="../DB/Connection.html">Connection</a></code>.</p> + +<p>Nested transactions are supported by using sql <code>SAVEPOINT</code>. To start a nested +transaction use <code>Transaction#transaction</code> or <code>Transaction#begin_transaction</code>.</p> + + + + + + <h2>Included Modules</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/BeginTransaction.html">DB::BeginTransaction</a></li> + + <li class="other-type"><a href="../DB/Disposable.html">DB::Disposable</a></li> + + </ul> + + + + + + <h2>Direct Known Subclasses</h2> + <ul class="other-types-list"> + + <li class="other-type"><a href="../DB/SavePointTransaction.html">DB::SavePointTransaction</a></li> + + <li class="other-type"><a href="../DB/TopLevelTransaction.html">DB::TopLevelTransaction</a></li> + + </ul> + + + + + + + <h2>Defined in:</h2> + + + <a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L14" target="_blank"> + db/transaction.cr + </a> + + <br/> + + + + + + + + + + + <h2>Instance Method Summary</h2> + <ul class="list-summary"> + + <li class="entry-summary"> + <a href="#commit-instance-method" class="signature"><strong>#commit</strong></a> + + <div class="summary"><p>commits the current transaction</p></div> + + </li> + + <li class="entry-summary"> + <a href="#connection:Connection-instance-method" class="signature"><strong>#connection</strong> : Connection</a> + + </li> + + <li class="entry-summary"> + <a href="#release_from_nested_transaction-instance-method" class="signature"><strong>#release_from_nested_transaction</strong></a> + + </li> + + <li class="entry-summary"> + <a href="#rollback-instance-method" class="signature"><strong>#rollback</strong></a> + + <div class="summary"><p>rollbacks the current transaction</p></div> + + </li> + + </ul> + + + + + +<div class="methods-inherited"> + + + + <h3>Instance methods inherited from module <code><a href="../DB/BeginTransaction.html">DB::BeginTransaction</a></code></h3> + + + <a href="../DB/BeginTransaction.html#begin_transaction:Transaction-instance-method" class="tooltip"> + <span>begin_transaction : Transaction</span> + begin_transaction</a>, + + + <a href="../DB/BeginTransaction.html#transaction(&block)-instance-method" class="tooltip"> + <span>transaction(&block)</span> + transaction</a> + + + + + + + + + + + + + + <h3>Instance methods inherited from module <code><a href="../DB/Disposable.html">DB::Disposable</a></code></h3> + + + <a href="../DB/Disposable.html#close-instance-method" class="tooltip"> + <span>close</span> + close</a>, + + + <a href="../DB/Disposable.html#closed?-instance-method" class="tooltip"> + <span>closed?</span> + closed?</a> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +</div> + + + + + + + <h2>Instance Method Detail</h2> + + <div class="entry-detail" id="commit-instance-method"> + <div class="signature"> + + def <strong>commit</strong> + + <a class="method-permalink" href="#commit-instance-method">#</a> + </div> + + <div class="doc"><p>commits the current transaction</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L21" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="connection:Connection-instance-method"> + <div class="signature"> + abstract + def <strong>connection</strong> : <a href="../DB/Connection.html">Connection</a> + + <a class="method-permalink" href="#connection:Connection-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L18" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="release_from_nested_transaction-instance-method"> + <div class="signature"> + abstract + def <strong>release_from_nested_transaction</strong> + + <a class="method-permalink" href="#release_from_nested_transaction-instance-method">#</a> + </div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L35" target="_blank">View source</a>] + + </div> + </div> + + <div class="entry-detail" id="rollback-instance-method"> + <div class="signature"> + + def <strong>rollback</strong> + + <a class="method-permalink" href="#rollback-instance-method">#</a> + </div> + + <div class="doc"><p>rollbacks the current transaction</p></div> + + <br/> + <div> + + [<a href="https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L26" target="_blank">View source</a>] + + </div> + </div> + + + + + +</div> + +</body> +</html> diff --git a/api/0.6.0/css/style.css b/api/0.6.0/css/style.css new file mode 100644 index 0000000..7295c3f --- /dev/null +++ b/api/0.6.0/css/style.css @@ -0,0 +1,629 @@ +html, body { + background: #FFFFFF; + position: relative; + margin: 0; + padding: 0; + width: 100%; + height: 100%; + overflow: hidden; +} + +body { + font-family: "Avenir", "Tahoma", "Lucida Sans", "Lucida Grande", Verdana, Arial, sans-serif; + color: #333; + line-height: 1.5; +} + +a { + color: #263F6C; +} + +a:visited { + color: #112750; +} + +h1, h2, h3, h4, h5, h6 { + margin: 35px 0 25px; + color: #444444; +} + +h1.type-name { + color: #47266E; + margin: 20px 0 30px; + background-color: #F8F8F8; + padding: 10px 12px; + border: 1px solid #EBEBEB; + border-radius: 2px; +} + +h2 { + border-bottom: 1px solid #E6E6E6; + padding-bottom: 5px; +} + +body { + display: flex; +} + +.sidebar, .main-content { + overflow: auto; +} + +.sidebar { + width: 30em; + color: #F8F4FD; + background-color: #2E1052; + padding: 0 0 30px; + box-shadow: inset -3px 0 4px rgba(0,0,0,.35); + line-height: 1.2; +} + +.sidebar .search-box { + padding: 8px 9px; +} + +.sidebar input { + display: block; + box-sizing: border-box; + margin: 0; + padding: 5px; + font: inherit; + font-family: inherit; + line-height: 1.2; + width: 100%; + border: 0; + outline: 0; + border-radius: 2px; + box-shadow: 0px 3px 5px rgba(0,0,0,.25); + transition: box-shadow .12s; +} + +.sidebar input:focus { + box-shadow: 0px 5px 6px rgba(0,0,0,.5); +} + +.sidebar input::-webkit-input-placeholder { /* Chrome/Opera/Safari */ + color: #C8C8C8; + font-size: 14px; + text-indent: 2px; +} + +.sidebar input::-moz-placeholder { /* Firefox 19+ */ + color: #C8C8C8; + font-size: 14px; + text-indent: 2px; +} + +.sidebar input:-ms-input-placeholder { /* IE 10+ */ + color: #C8C8C8; + font-size: 14px; + text-indent: 2px; +} + +.sidebar input:-moz-placeholder { /* Firefox 18- */ + color: #C8C8C8; + font-size: 14px; + text-indent: 2px; +} + +.sidebar ul { + margin: 0; + padding: 0; + list-style: none outside; +} + +.sidebar li { + display: block; + position: relative; +} + +.types-list li.hide { + display: none; +} + +.sidebar a { + text-decoration: none; + color: inherit; + transition: color .14s; +} +.types-list a { + display: block; + padding: 5px 15px 5px 30px; +} + +.types-list { + display: block; +} + +.sidebar a:focus { + outline: 1px solid #D1B7F1; +} + +.types-list a { + padding: 5px 15px 5px 30px; +} + +.sidebar .current > a, +.sidebar a:hover { + color: #866BA6; +} + +.repository-links { + padding: 5px 15px 5px 30px; +} + +.types-list li ul { + overflow: hidden; + height: 0; + max-height: 0; + transition: 1s ease-in-out; +} + +.types-list li.parent { + padding-left: 30px; +} + +.types-list li.parent::before { + box-sizing: border-box; + content: "▼"; + display: block; + width: 30px; + height: 30px; + position: absolute; + top: 0; + left: 0; + text-align: center; + color: white; + font-size: 8px; + line-height: 30px; + transform: rotateZ(-90deg); + cursor: pointer; + transition: .2s linear; +} + + +.types-list li.parent > a { + padding-left: 0; +} + +.types-list li.parent.open::before { + transform: rotateZ(0); +} + +.types-list li.open > ul { + height: auto; + max-height: 1000em; +} + +.main-content { + padding: 0 30px 30px 30px; + width: 100%; +} + +.kind { + font-size: 60%; + color: #866BA6; +} + +.superclass-hierarchy { + margin: -15px 0 30px 0; + padding: 0; + list-style: none outside; + font-size: 80%; +} + +.superclass-hierarchy .superclass { + display: inline-block; + margin: 0 7px 0 0; + padding: 0; +} + +.superclass-hierarchy .superclass + .superclass::before { + content: "<"; + margin-right: 7px; +} + +.other-types-list li { + display: inline-block; +} + +.other-types-list, +.list-summary { + margin: 0 0 30px 0; + padding: 0; + list-style: none outside; +} + +.entry-const { + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; +} + +.entry-const code { + white-space: pre-wrap; +} + +.entry-summary { + padding-bottom: 4px; +} + +.superclass-hierarchy .superclass a, +.other-type a, +.entry-summary .signature { + padding: 4px 8px; + margin-bottom: 4px; + display: inline-block; + background-color: #f8f8f8; + color: #47266E; + border: 1px solid #f0f0f0; + text-decoration: none; + border-radius: 3px; + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; + transition: background .15s, border-color .15s; +} + +.superclass-hierarchy .superclass a:hover, +.other-type a:hover, +.entry-summary .signature:hover { + background: #D5CAE3; + border-color: #624288; +} + +.entry-summary .summary { + padding-left: 32px; +} + +.entry-summary .summary p { + margin: 12px 0 16px; +} + +.entry-summary a { + text-decoration: none; +} + +.entry-detail { + padding: 30px 0; +} + +.entry-detail .signature { + position: relative; + padding: 5px 15px; + margin-bottom: 10px; + display: block; + border-radius: 5px; + background-color: #f8f8f8; + color: #47266E; + border: 1px solid #f0f0f0; + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; + transition: .2s ease-in-out; +} + +.entry-detail:target .signature { + background-color: #D5CAE3; + border: 1px solid #624288; +} + +.entry-detail .signature .method-permalink { + position: absolute; + top: 0; + left: -35px; + padding: 5px 15px; + text-decoration: none; + font-weight: bold; + color: #624288; + opacity: .4; + transition: opacity .2s; +} + +.entry-detail .signature .method-permalink:hover { + opacity: 1; +} + +.entry-detail:target .signature .method-permalink { + opacity: 1; +} + +.methods-inherited { + padding-right: 10%; + line-height: 1.5em; +} + +.methods-inherited h3 { + margin-bottom: 4px; +} + +.methods-inherited a { + display: inline-block; + text-decoration: none; + color: #47266E; +} + +.methods-inherited a:hover { + text-decoration: underline; + color: #6C518B; +} + +.methods-inherited .tooltip>span { + background: #D5CAE3; + padding: 4px 8px; + border-radius: 3px; + margin: -4px -8px; +} + +.methods-inherited .tooltip * { + color: #47266E; +} + +pre { + padding: 10px 20px; + margin-top: 4px; + border-radius: 3px; + line-height: 1.45; + overflow: auto; + color: #333; + background: #fdfdfd; + font-size: 14px; + border: 1px solid #eee; +} + +code { + font-family: Menlo, Monaco, Consolas, 'Courier New', Courier, monospace; +} + +:not(pre) > code { + background-color: rgba(40,35,30,0.05); + padding: 0.2em 0.4em; + font-size: 85%; + border-radius: 3px; +} + +span.flag { + padding: 2px 4px 1px; + border-radius: 3px; + margin-right: 3px; + font-size: 11px; + border: 1px solid transparent; +} + +span.flag.orange { + background-color: #EE8737; + color: #FCEBDD; + border-color: #EB7317; +} + +span.flag.yellow { + background-color: #E4B91C; + color: #FCF8E8; + border-color: #B69115; +} + +span.flag.green { + background-color: #469C14; + color: #E2F9D3; + border-color: #34700E; +} + +span.flag.red { + background-color: #BF1919; + color: #F9ECEC; + border-color: #822C2C; +} + +span.flag.purple { + background-color: #2E1052; + color: #ECE1F9; + border-color: #1F0B37; +} + +.tooltip>span { + position: absolute; + opacity: 0; + display: none; + pointer-events: none; +} + +.tooltip:hover>span { + display: inline-block; + opacity: 1; +} + +.c { + color: #969896; +} + +.n { + color: #0086b3; +} + +.t { + color: #0086b3; +} + +.s { + color: #183691; +} + +.i { + color: #7f5030; +} + +.k { + color: #a71d5d; +} + +.o { + color: #a71d5d; +} + +.m { + color: #795da3; +} + +.hidden { + display: none; +} +.search-results { + font-size: 90%; + line-height: 1.3; +} + +.search-results mark { + color: inherit; + background: transparent; + font-weight: bold; +} +.search-result { + padding: 5px 8px 5px 5px; + cursor: pointer; + border-left: 5px solid transparent; + transform: translateX(-3px); + transition: all .2s, background-color 0s, border .02s; + min-height: 3.2em; +} +.search-result.current { + border-left-color: #ddd; + background-color: rgba(200,200,200,0.4); + transform: translateX(0); + transition: all .2s, background-color .5s, border 0s; +} +.search-result.current:hover, +.search-result.current:focus { + border-left-color: #866BA6; +} +.search-result:not(.current):nth-child(2n) { + background-color: rgba(255,255,255,.06); +} +.search-result__title { + font-size: 105%; + word-break: break-all; + line-height: 1.1; + padding: 3px 0; +} +.search-result__title strong { + font-weight: normal; +} +.search-results .search-result__title > a { + padding: 0; + display: block; +} +.search-result__title > a > .args { + color: #dddddd; + font-weight: 300; + transition: inherit; + font-size: 88%; + line-height: 1.2; + letter-spacing: -.02em; +} +.search-result__title > a > .args * { + color: inherit; +} + +.search-result a, +.search-result a:hover { + color: inherit; +} +.search-result:not(.current):hover .search-result__title > a, +.search-result:not(.current):focus .search-result__title > a, +.search-result__title > a:focus { + color: #866BA6; +} +.search-result:not(.current):hover .args, +.search-result:not(.current):focus .args { + color: #6a5a7d; +} + +.search-result__type { + color: #e8e8e8; + font-weight: 300; +} +.search-result__doc { + color: #bbbbbb; + font-size: 90%; +} +.search-result__doc p { + margin: 0; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + overflow: hidden; + line-height: 1.2em; + max-height: 2.4em; +} + +.js-modal-visible .modal-background { + display: flex; +} +.main-content { + position: relative; +} +.modal-background { + position: absolute; + display: none; + height: 100%; + width: 100%; + background: rgba(120,120,120,.4); + z-index: 100; + align-items: center; + justify-content: center; +} +.usage-modal { + max-width: 90%; + background: #fff; + border: 2px solid #ccc; + border-radius: 9px; + padding: 5px 15px 20px; + min-width: 50%; + color: #555; + position: relative; + transform: scale(.5); + transition: transform 200ms; +} +.js-modal-visible .usage-modal { + transform: scale(1); +} +.usage-modal > .close-button { + position: absolute; + right: 15px; + top: 8px; + color: #aaa; + font-size: 27px; + cursor: pointer; +} +.usage-modal > .close-button:hover { + text-shadow: 2px 2px 2px #ccc; + color: #999; +} +.modal-title { + margin: 0; + text-align: center; + font-weight: normal; + color: #666; + border-bottom: 2px solid #ddd; + padding: 10px; +} +.usage-list { + padding: 0; + margin: 13px; +} +.usage-list > li { + padding: 5px 2px; + overflow: auto; + padding-left: 100px; + min-width: 12em; +} +.usage-modal kbd { + background: #eee; + border: 1px solid #ccc; + border-bottom-width: 2px; + border-radius: 3px; + padding: 3px 8px; + font-family: monospace; + margin-right: 2px; + display: inline-block; +} +.usage-key { + float: left; + clear: left; + margin-left: -100px; + margin-right: 12px; +} diff --git a/api/0.6.0/index.html b/api/0.6.0/index.html new file mode 100644 index 0000000..f17ccae --- /dev/null +++ b/api/0.6.0/index.html @@ -0,0 +1,320 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="utf-8"> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="generator" content="Crystal Docs 0.29.0"> + + +<link href="css/style.css" rel="stylesheet" type="text/css"> + +<script type="text/javascript" src="js/doc.js"></script> +<script type="text/javascript"> + CrystalDoc.base_path = ""; +</script> + + <meta id="repository-name" content="github.com/crystal-lang/crystal-db"> + <title>README - github.com/crystal-lang/crystal-db</title> +</head> +<body> + +<div class="sidebar"> + <div class="sidebar-header"> + <div class="search-box"> + <input type="search" class="search-input" placeholder="Search..." spellcheck="false" aria-label="Search"> + </div> + + <div class="repository-links"> + <a href="index.html">README</a> + </div> + </div> + + <div class="search-results" class="hidden"> + <ul class="search-list"></ul> + </div> + + <div class="types-list"> + <ul> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB" data-name="db"> + <a href="DB.html">DB</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Any" data-name="db::any"> + <a href="DB/Any.html">Any</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/BeginTransaction" data-name="db::begintransaction"> + <a href="DB/BeginTransaction.html">BeginTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Connection" data-name="db::connection"> + <a href="DB/Connection.html">Connection</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionContext" data-name="db::connectioncontext"> + <a href="DB/ConnectionContext.html">ConnectionContext</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionLost" data-name="db::connectionlost"> + <a href="DB/ConnectionLost.html">ConnectionLost</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ConnectionRefused" data-name="db::connectionrefused"> + <a href="DB/ConnectionRefused.html">ConnectionRefused</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Database" data-name="db::database"> + <a href="DB/Database.html">Database</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Disposable" data-name="db::disposable"> + <a href="DB/Disposable.html">Disposable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Driver" data-name="db::driver"> + <a href="DB/Driver.html">Driver</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs" data-name="db::driverspecs(dbanytype)"> + <a href="DB/DriverSpecs.html">DriverSpecs</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef" data-name="db::driverspecs::columndef"> + <a href="DB/DriverSpecs/ColumnDef.html">ColumnDef</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Error" data-name="db::error"> + <a href="DB/Error.html">Error</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ExecResult" data-name="db::execresult"> + <a href="DB/ExecResult.html">ExecResult</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Mappable" data-name="db::mappable"> + <a href="DB/Mappable.html">Mappable</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/MappingException" data-name="db::mappingexception"> + <a href="DB/MappingException.html">MappingException</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/Pool" data-name="db::pool(t)"> + <a href="DB/Pool.html">Pool</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper" data-name="db::pool::timeouthelper"> + <a href="DB/Pool/TimeoutHelper.html">TimeoutHelper</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement" data-name="db::poolpreparedstatement"> + <a href="DB/PoolPreparedStatement.html">PoolPreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded" data-name="db::poolretryattemptsexceeded"> + <a href="DB/PoolRetryAttemptsExceeded.html">PoolRetryAttemptsExceeded</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolStatement" data-name="db::poolstatement"> + <a href="DB/PoolStatement.html">PoolStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolTimeout" data-name="db::pooltimeout"> + <a href="DB/PoolTimeout.html">PoolTimeout</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement" data-name="db::poolunpreparedstatement"> + <a href="DB/PoolUnpreparedStatement.html">PoolUnpreparedStatement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/QueryMethods" data-name="db::querymethods(stmt)"> + <a href="DB/QueryMethods.html">QueryMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/ResultSet" data-name="db::resultset"> + <a href="DB/ResultSet.html">ResultSet</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Rollback" data-name="db::rollback"> + <a href="DB/Rollback.html">Rollback</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SavePointTransaction" data-name="db::savepointtransaction"> + <a href="DB/SavePointTransaction.html">SavePointTransaction</a> + + </li> + + <li class="parent " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods" data-name="db::sessionmethods(session, stmt)"> + <a href="DB/SessionMethods.html">SessionMethods</a> + + <ul> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery" data-name="db::sessionmethods::preparedquery(session, stmt)"> + <a href="DB/SessionMethods/PreparedQuery.html">PreparedQuery</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery" data-name="db::sessionmethods::unpreparedquery(session, stmt)"> + <a href="DB/SessionMethods/UnpreparedQuery.html">UnpreparedQuery</a> + + </li> + +</ul> + + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Statement" data-name="db::statement"> + <a href="DB/Statement.html">Statement</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StatementMethods" data-name="db::statementmethods"> + <a href="DB/StatementMethods.html">StatementMethods</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/StringKeyCache" data-name="db::stringkeycache(t)"> + <a href="DB/StringKeyCache.html">StringKeyCache</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/TopLevelTransaction" data-name="db::topleveltransaction"> + <a href="DB/TopLevelTransaction.html">TopLevelTransaction</a> + + </li> + + <li class=" " data-id="github.com/crystal-lang/crystal-db/DB/Transaction" data-name="db::transaction"> + <a href="DB/Transaction.html">Transaction</a> + + </li> + +</ul> + + + </li> + +</ul> + + </div> +</div> + + +<div class="main-content"> +<p><a href="https://travis-ci.org/crystal-lang/crystal-db" target="_blank"><img src="https://travis-ci.org/crystal-lang/crystal-db.svg?branch=master" alt="Build Status"/></a></p> + +<h1>crystal-db</h1> + +<p>Common db api for crystal. You will need to have a specific driver to access a database.</p> + +<ul><li><a href="https://github.com/crystal-lang/crystal-sqlite3" target="_blank">SQLite</a></li><li><a href="https://github.com/crystal-lang/crystal-mysql" target="_blank">MySQL</a></li><li><a href="https://github.com/will/crystal-pg" target="_blank">PostgreSQL</a></li><li><a href="https://github.com/kaukas/crystal-cassandra" target="_blank">Cassandra</a></li></ul> + +<h2>Installation</h2> + +<p>If you are creating a shard that will work with <em>any</em> driver, then add <code>crystal-db</code> as a dependency in <code>shard.yml</code>:</p> + +<pre><code class="language-yaml">dependencies: + db: + github: crystal-lang/crystal-db</code></pre> + +<p>If you are creating an application that will work with <em>some specific</em> driver(s), then add them in <code>shard.yml</code>:</p> + +<pre><code class="language-yaml">dependencies: + sqlite3: + github: crystal-lang/crystal-sqlite3</code></pre> + +<p><code>crystal-db</code> itself will be a nested dependency if drivers are included.</p> + +<p>Note: Multiple drivers can be included in the same application.</p> + +<h2>Documentation</h2> + +<ul><li><a href="http://crystal-lang.github.io/crystal-db/api/latest/" target="_blank">Latest API</a></li><li><a href="https://crystal-lang.org/docs/database/" target="_blank">Crystal book</a></li></ul> + +<h2>Usage</h2> + +<p>This shard only provides an abstract database API. In order to use it, a specific driver for the intended database has to be required as well:</p> + +<p>The following example uses SQLite where <code>?</code> indicates the arguments. If PostgreSQL is used <code>$1</code>, <code>$2</code>, etc. should be used. <code>crystal-db</code> does not interpret the statements.</p> + +<pre><code class="language-crystal"><span class="k">require</span> <span class="s">"db"</span> +<span class="k">require</span> <span class="s">"sqlite3"</span> + +<span class="t">DB</span>.open <span class="s">"sqlite3:./file.db"</span> <span class="k">do</span> <span class="o">|</span>db<span class="o">|</span> + <span class="c"># When using the pg driver, use $1, $2, etc. instead of ?</span> + db.exec <span class="s">"create table contacts (name text, age integer)"</span> + db.exec <span class="s">"insert into contacts values (?, ?)"</span>, <span class="s">"John Doe"</span>, <span class="n">30</span> + + args <span class="o">=</span> <span class="o">[]</span> <span class="k">of</span> <span class="t">DB</span><span class="t">::</span><span class="t">Any</span> + args <span class="o"><<</span> <span class="s">"Sarah"</span> + args <span class="o"><<</span> <span class="n">33</span> + db.exec <span class="s">"insert into contacts values (?, ?)"</span>, args + + puts <span class="s">"max age:"</span> + puts db.scalar <span class="s">"select max(age) from contacts"</span> <span class="c"># => 33</span> + + puts <span class="s">"contacts:"</span> + db.query <span class="s">"select name, age from contacts order by age desc"</span> <span class="k">do</span> <span class="o">|</span>rs<span class="o">|</span> + puts <span class="s">"</span><span class="i">#{</span>rs.column_name(<span class="n">0</span>)<span class="i">}</span><span class="s"> (</span><span class="i">#{</span>rs.column_name(<span class="n">1</span>)<span class="i">}</span><span class="s">)"</span> + <span class="c"># => name (age)</span> + rs.each <span class="k">do</span> + puts <span class="s">"</span><span class="i">#{</span>rs.read(<span class="t">String</span>)<span class="i">}</span><span class="s"> (</span><span class="i">#{</span>rs.read(<span class="t">Int32</span>)<span class="i">}</span><span class="s">)"</span> + <span class="c"># => Sarah (33)</span> + <span class="c"># => John Doe (30)</span> + <span class="k">end</span> + <span class="k">end</span> +<span class="k">end</span></code></pre> + +<h2>Roadmap</h2> + +<p>Issues not yet addressed:</p> + +<ul><li>[x] Support non prepared statements. <a href="https://github.com/crystal-lang/crystal-db/pull/25" target="_blank">#25</a></li><li>[x] Time data type. (implementation details depends on actual drivers)</li><li>[x] Data type extensibility. Allow each driver to extend the data types allowed.</li><li>[x] Transactions & nested transactions. <a href="https://github.com/crystal-lang/crystal-db/pull/27" target="_blank">#27</a></li><li>[x] Connection pool.</li><li>[ ] Logging</li><li>[ ] Direct access to <code>IO</code> to avoid memory allocation for blobs.</li></ul> + +<h2>Contributing</h2> + +<ol><li>Fork it ( https://github.com/crystal-lang/crystal-db/fork )</li><li>Create your feature branch (git checkout -b my-new-feature)</li><li>Commit your changes (git commit -am 'Add some feature')</li><li>Push to the branch (git push origin my-new-feature)</li><li>Create a new Pull Request</li></ol> + +<h2>Contributors</h2> + +<ul><li><a href="https://github.com/bcardiff" target="_blank">bcardiff</a> Brian J. Cardiff - creator, maintainer</li></ul> +</div> +</body> +</html> diff --git a/api/0.6.0/index.json b/api/0.6.0/index.json new file mode 100644 index 0000000..875fabf --- /dev/null +++ b/api/0.6.0/index.json @@ -0,0 +1 @@ +{"repository_name":"github.com/crystal-lang/crystal-db","body":"[](https://travis-ci.org/crystal-lang/crystal-db)\n\n# crystal-db\n\nCommon db api for crystal. You will need to have a specific driver to access a database.\n\n* [SQLite](https://github.com/crystal-lang/crystal-sqlite3)\n* [MySQL](https://github.com/crystal-lang/crystal-mysql)\n* [PostgreSQL](https://github.com/will/crystal-pg)\n* [Cassandra](https://github.com/kaukas/crystal-cassandra)\n\n## Installation\n\nIf you are creating a shard that will work with _any_ driver, then add `crystal-db` as a dependency in `shard.yml`:\n\n```yaml\ndependencies:\n db:\n github: crystal-lang/crystal-db\n```\n\nIf you are creating an application that will work with _some specific_ driver(s), then add them in `shard.yml`:\n\n```yaml\ndependencies:\n sqlite3:\n github: crystal-lang/crystal-sqlite3\n```\n\n`crystal-db` itself will be a nested dependency if drivers are included.\n\nNote: Multiple drivers can be included in the same application.\n\n## Documentation\n\n* [Latest API](http://crystal-lang.github.io/crystal-db/api/latest/)\n* [Crystal book](https://crystal-lang.org/docs/database/)\n\n## Usage\n\nThis shard only provides an abstract database API. In order to use it, a specific driver for the intended database has to be required as well:\n\nThe following example uses SQLite where `?` indicates the arguments. If PostgreSQL is used `$1`, `$2`, etc. should be used. `crystal-db` does not interpret the statements.\n\n```crystal\nrequire \"db\"\nrequire \"sqlite3\"\n\nDB.open \"sqlite3:./file.db\" do |db|\n # When using the pg driver, use $1, $2, etc. instead of ?\n db.exec \"create table contacts (name text, age integer)\"\n db.exec \"insert into contacts values (?, ?)\", \"John Doe\", 30\n\n args = [] of DB::Any\n args << \"Sarah\"\n args << 33\n db.exec \"insert into contacts values (?, ?)\", args\n\n puts \"max age:\"\n puts db.scalar \"select max(age) from contacts\" # => 33\n\n puts \"contacts:\"\n db.query \"select name, age from contacts order by age desc\" do |rs|\n puts \"#{rs.column_name(0)} (#{rs.column_name(1)})\"\n # => name (age)\n rs.each do\n puts \"#{rs.read(String)} (#{rs.read(Int32)})\"\n # => Sarah (33)\n # => John Doe (30)\n end\n end\nend\n```\n\n## Roadmap\n\nIssues not yet addressed:\n\n- [x] Support non prepared statements. [#25](https://github.com/crystal-lang/crystal-db/pull/25)\n- [x] Time data type. (implementation details depends on actual drivers)\n- [x] Data type extensibility. Allow each driver to extend the data types allowed.\n- [x] Transactions & nested transactions. [#27](https://github.com/crystal-lang/crystal-db/pull/27)\n- [x] Connection pool.\n- [ ] Logging\n- [ ] Direct access to `IO` to avoid memory allocation for blobs.\n\n## Contributing\n\n1. Fork it ( https://github.com/crystal-lang/crystal-db/fork )\n2. Create your feature branch (git checkout -b my-new-feature)\n3. Commit your changes (git commit -am 'Add some feature')\n4. Push to the branch (git push origin my-new-feature)\n5. Create a new Pull Request\n\n## Contributors\n\n- [bcardiff](https://github.com/bcardiff) Brian J. Cardiff - creator, maintainer\n","program":{"html_id":"github.com/crystal-lang/crystal-db/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"superclass":null,"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Spec/Methods","kind":"module","full_name":"Spec::Methods","name":"Methods"},{"html_id":"github.com/crystal-lang/crystal-db/Spec/Expectations","kind":"module","full_name":"Spec::Expectations","name":"Expectations"}],"locations":[],"repository_name":"github.com/crystal-lang/crystal-db","program":true,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/Spec/Expectations","kind":"module","full_name":"Spec::Expectations","name":"Expectations"},{"html_id":"github.com/crystal-lang/crystal-db/Spec/Methods","kind":"module","full_name":"Spec::Methods","name":"Methods"}],"extended_modules":[{"html_id":"github.com/crystal-lang/crystal-db/Spec/Expectations","kind":"module","full_name":"Spec::Expectations","name":"Expectations"},{"html_id":"github.com/crystal-lang/crystal-db/Spec/Methods","kind":"module","full_name":"Spec::Methods","name":"Methods"}],"subclasses":[],"including_types":[],"namespace":null,"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"github.com/crystal-lang/crystal-db/DB","path":"DB.html","kind":"module","full_name":"DB","name":"DB","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"db.cr","line_number":77,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr"},{"filename":"db/pool.cr","line_number":3,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr"},{"filename":"db/string_key_cache.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/string_key_cache.cr"},{"filename":"db/query_methods.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr"},{"filename":"db/session_methods.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr"},{"filename":"db/disposable.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/disposable.cr"},{"filename":"db/driver.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/driver.cr"},{"filename":"db/statement.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr"},{"filename":"db/begin_transaction.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/begin_transaction.cr"},{"filename":"db/connection_context.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr"},{"filename":"db/connection.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr"},{"filename":"db/transaction.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr"},{"filename":"db/pool_statement.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr"},{"filename":"db/database.cr","line_number":4,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr"},{"filename":"db/pool_prepared_statement.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_prepared_statement.cr"},{"filename":"db/pool_unprepared_statement.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_unprepared_statement.cr"},{"filename":"db/result_set.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr"},{"filename":"db/error.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"},{"filename":"db/mapping.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/mapping.cr"},{"filename":"spec.cr","line_number":9,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr"},{"filename":"db/version.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/version.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[{"id":"TYPES","name":"TYPES","value":"[Nil, String, Bool, Int32, Int64, Float32, Float64, Time, Bytes]","doc":"Types supported to interface with database driver.\nThese can be used in any `ResultSet#read` or any `Database#query` related\nmethod to be used as query parameters","summary":"<p>Types supported to interface with database driver.</p>"},{"id":"VERSION","name":"VERSION","value":"\"0.6.0\"","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":null,"doc":"The DB module is a unified interface for database access.\nIndividual database systems are supported by specific database driver shards.\n\nAvailable drivers include:\n* [crystal-lang/crystal-sqlite3](https://github.com/crystal-lang/crystal-sqlite3) for SQLite\n* [crystal-lang/crystal-mysql](https://github.com/crystal-lang/crystal-mysql) for MySQL and MariaDB\n* [will/crystal-pg](https://github.com/will/crystal-pg) for PostgreSQL\n* [kaukas/crystal-cassandra](https://github.com/kaukas/crystal-cassandra) for Cassandra\n\nFor basic instructions on implementing a new database driver, check `Driver` and the existing drivers.\n\nDB manages a connection pool. The connection pool can be configured by query parameters to the\nconnection `URI` as described in `Database`.\n\n### Usage\n\nAssuming `crystal-sqlite3` is included a SQLite3 database can be opened with `#open`.\n\n```\ndb = DB.open \"sqlite3:./path/to/db/file.db\"\ndb.close\n```\n\nIf a block is given to `#open` the database is closed automatically\n\n```\nDB.open \"sqlite3:./file.db\" do |db|\n # work with db\nend # db is closed\n```\n\nIn the code above `db` is a `Database`. Methods available for querying it are described in `QueryMethods`.\n\nThree kind of statements can be performed:\n1. `Database#exec` waits no response from the database.\n2. `Database#scalar` reads a single value of the response.\n3. `Database#query` returns a ResultSet that allows iteration over the rows in the response and column information.\n\nAll of the above methods allows parametrised query. Either positional or named arguments.\n\nCheck a full working version:\n\nThe following example uses SQLite where `?` indicates the arguments. If PostgreSQL is used `$1`, `$2`, etc. should be used. `crystal-db` does not interpret the statements.\n\n```\nrequire \"db\"\nrequire \"sqlite3\"\n\nDB.open \"sqlite3:./file.db\" do |db|\n # When using the pg driver, use $1, $2, etc. instead of ?\n db.exec \"create table contacts (name text, age integer)\"\n db.exec \"insert into contacts values (?, ?)\", \"John Doe\", 30\n\n args = [] of DB::Any\n args << \"Sarah\"\n args << 33\n db.exec \"insert into contacts values (?, ?)\", args\n\n puts \"max age:\"\n puts db.scalar \"select max(age) from contacts\" # => 33\n\n puts \"contacts:\"\n db.query \"select name, age from contacts order by age desc\" do |rs|\n puts \"#{rs.column_name(0)} (#{rs.column_name(1)})\"\n # => name (age)\n rs.each do\n puts \"#{rs.read(String)} (#{rs.read(Int32)})\"\n # => Sarah (33)\n # => John Doe (30)\n end\n end\nend\n```\n","summary":"<p>The DB module is a unified interface for database access.</p>","class_methods":[{"id":"connect(uri:URI|String)-class-method","html_id":"connect(uri:URI|String)-class-method","name":"connect","doc":"Opens a connection using the specified *uri*.\nThe scheme of the *uri* determines the driver to use.\nReturned connection must be closed by `Connection#close`.\nIf a block is used the connection is yielded and closed automatically.","summary":"<p>Opens a connection using the specified <em>uri</em>.</p>","abstract":false,"args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"args_string":"(uri : URI | String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L133","def":{"name":"connect","args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"build_connection(uri)"}},{"id":"connect(uri:URI|String,&block)-class-method","html_id":"connect(uri:URI|String,&block)-class-method","name":"connect","doc":"Opens a connection using the specified *uri*.\nThe scheme of the *uri* determines the driver to use.\nReturned connection must be closed by `Connection#close`.\nIf a block is used the connection is yielded and closed automatically.","summary":"<p>Opens a connection using the specified <em>uri</em>.</p>","abstract":false,"args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"args_string":"(uri : URI | String, &block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L138","def":{"name":"connect","args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"cnn = build_connection(uri)\nbegin\n yield cnn\nensure\n cnn.close\nend\n"}},{"id":"open(uri:URI|String)-class-method","html_id":"open(uri:URI|String)-class-method","name":"open","doc":"Creates a `Database` pool and opens initial connection(s) as specified in the connection *uri*.\nUse `DB#connect` to open a single connection.\n\nThe scheme of the *uri* determines the driver to use.\nConnection parameters such as hostname, user, database name, etc. are specified according\nto each database driver's specific format.\n\nThe returned database must be closed by `Database#close`.","summary":"<p>Creates a <code><a href=\"DB/Database.html\">Database</a></code> pool and opens initial connection(s) as specified in the connection <em>uri</em>.</p>","abstract":false,"args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"args_string":"(uri : URI | String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L115","def":{"name":"open","args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"build_database(uri)"}},{"id":"open(uri:URI|String,&block)-class-method","html_id":"open(uri:URI|String,&block)-class-method","name":"open","doc":"Same as `#open` but the database is yielded and closed automatically at the end of the block.","summary":"<p>Same as <code><a href=\"DB.html#open(uri:URI%7CString)-class-method\">#open</a></code> but the database is yielded and closed automatically at the end of the block.</p>","abstract":false,"args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"args_string":"(uri : URI | String, &block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L120","def":{"name":"open","args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"db = build_database(uri)\nbegin\n yield db\nensure\n db.close\nend\n"}},{"id":"register_driver(driver_name,driver_class:Driver.class)-class-method","html_id":"register_driver(driver_name,driver_class:Driver.class)-class-method","name":"register_driver","doc":"Registers a driver class for a given *driver_name*.\nShould be called by drivers implementors only.","summary":"<p>Registers a driver class for a given <em>driver_name</em>.</p>","abstract":false,"args":[{"name":"driver_name","doc":null,"default_value":"","external_name":"driver_name","restriction":""},{"name":"driver_class","doc":null,"default_value":"","external_name":"driver_class","restriction":"Driver.class"}],"args_string":"(driver_name, driver_class : <span class=\"t\">Driver</span>.<span class=\"k\">class</span>)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L99","def":{"name":"register_driver","args":[{"name":"driver_name","doc":null,"default_value":"","external_name":"driver_name","restriction":""},{"name":"driver_class","doc":null,"default_value":"","external_name":"driver_class","restriction":"Driver.class"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"drivers[driver_name] = driver_class"}}],"constructors":[],"instance_methods":[],"macros":[{"id":"mapping(properties,strict=true)-macro","html_id":"mapping(properties,strict=true)-macro","name":"mapping","doc":"The `DB.mapping` macro defines how an object is built from a `ResultSet`.\n\nIt takes hash literal as argument, in which attributes and types are defined.\nOnce defined, `ResultSet#read(t)` populates properties of the class from the\n`ResultSet`.\n\n```crystal\nrequire \"db\"\n\nclass Employee\n DB.mapping({\n title: String,\n name: String,\n })\nend\n\nemployees = Employee.from_rs(db.query(\"SELECT title, name FROM employees\"))\nemployees[0].title # => \"Manager\"\nemployees[0].name # => \"John\"\n```\n\nAttributes not mapped with `DB.mapping` are not defined as properties.\nAlso, missing attributes raise a `DB::MappingException`.\n\nYou can also define attributes for each property.\n\n```crystal\nclass Employee\n DB.mapping({\n title: String,\n name: {\n type: String,\n nilable: true,\n key: \"firstname\",\n },\n })\nend\n```\n\nAvailable attributes:\n\n* *type* (required) defines its type. In the example above, *title: String* is a shortcut to *title: {type: String}*.\n* *nilable* defines if a property can be a `Nil`.\n* **default**: value to use if the property is missing in the result set, or if it's `null` and `nilable` was not set to `true`. If the default value creates a new instance of an object (for example `[1, 2, 3]` or `SomeObject.new`), a different instance will be used each time a row is parsed.\n* *key* defines which column to read from a `ResultSet`. It defaults to the name of the property.\n* *converter* takes an alternate type for parsing. It requires a `#from_rs` method in that class, and returns an instance of the given type.\n\nThe mapping also automatically defines Crystal properties (getters and setters) for each\nof the keys. It doesn't define a constructor accepting those arguments, but you can provide\nan overload.\n\nThe macro basically defines a constructor accepting a `ResultSet` that reads from\nit and initializes this type's instance variables.\n\nThis macro also declares instance variables of the types given in the mapping.","summary":"<p>The <code><a href=\"DB.html#mapping(**properties)-macro\">DB.mapping</a></code> macro defines how an object is built from a <code><a href=\"DB/ResultSet.html\">ResultSet</a></code>.</p>","abstract":false,"args":[{"name":"properties","doc":null,"default_value":"","external_name":"properties","restriction":""},{"name":"strict","doc":null,"default_value":"true","external_name":"strict","restriction":""}],"args_string":"(properties, strict = <span class=\"n\">true</span>)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/mapping.cr#L60","def":{"name":"mapping","args":[{"name":"properties","doc":null,"default_value":"","external_name":"properties","restriction":""},{"name":"strict","doc":null,"default_value":"true","external_name":"strict","restriction":""}],"double_splat":null,"splat_index":null,"block_arg":null,"visibility":"Public","body":" include ::DB::Mappable\n\n \n{% for key, value in properties %}\n {% unless value.is_a?(HashLiteral) || value.is_a?(NamedTupleLiteral)\n properties[key] = {type: value}\nend %}\n {% end %}\n\n\n \n{% for key, value in properties %}\n {% if value[:type].is_a?(Generic) && (value[:type].type_vars.map(&.resolve).includes?(Nil))\n value[:nilable] = true\nend %}\n\n {% if (value[:type].is_a?(Call) && (value[:type].name == \"|\")) && ((value[:type].receiver.resolve == Nil) || value[:type].args.map(&.resolve).any?(&.==(Nil))) %}\n {% value[:nilable] = true %}\n {% end %}\n {% end %}\n\n\n \n{% for key, value in properties %}\n @{{ key.id }} : {{ value[:type] }} {{ (value[:nilable] ? \"?\" : \"\").id }}\n\n def {{ key.id }}=(_{{ key.id }} : {{ value[:type] }} {{ (value[:nilable] ? \"?\" : \"\").id }})\n @{{ key.id }} = _{{ key.id }}\n end\n\n def {{ key.id }}\n @{{ key.id }}\n end\n {% end %}\n\n\n def self.from_rs(\n%rs\n : ::DB::ResultSet)\n \n%objs\n = Array(self).new\n \n%rs\n.each do\n \n%objs\n << self.new(\n%rs\n)\n \nend\n \n%objs\n\n \nensure\n \n%rs\n.close\n \nend\n\n def initialize(\n%rs\n : ::DB::ResultSet)\n \n{% for key, value in properties %}\n %var{key.id} = nil\n %found{key.id} = false\n {% end %}\n\n\n \n%rs\n.each_column do |col_name|\n case col_name\n \n{% for key, value in properties %}\n when {{ value[:key] || key.id.stringify }}\n %found{key.id} = true\n %var{key.id} =\n {% if value[:converter] %}\n {{ value[:converter] }}.from_rs(%rs)\n {% else %}{% if value[:nilable] || (value[:default] != nil) %}\n %rs.read(::Union({{ value[:type] }} | Nil))\n {% else %}\n %rs.read({{ value[:type] }})\n {% end %}{% end %}\n {% end %}\n\n \nelse\n \n{% if strict %}\n raise ::DB::MappingException.new(\"unknown result set attribute: #{col_name}\")\n {% else %}\n %rs.read\n {% end %}\n\n \nend\n \nend\n\n \n{% for key, value in properties %}\n {% if value[:nilable] || (value[:default] != nil) %}{% else %}\n if %var{key.id}.is_a?(Nil) && !%found{key.id}\n raise ::DB::MappingException.new(\"missing result set attribute: {{ (value[:key] || key).id }}\")\n end\n {% end %}\n {% end %}\n\n\n \n{% for key, value in properties %}\n {% if value[:nilable] %}\n {% if value[:default] != nil %}\n @{{ key.id }} = %found{key.id} ? %var{key.id} : {{ value[:default] }}\n {% else %}\n @{{ key.id }} = %var{key.id}\n {% end %}\n {% else %}{% if value[:default] != nil %}\n @{{ key.id }} = %var{key.id}.is_a?(Nil) ? {{ value[:default] }} : %var{key.id}\n {% else %}\n @{{ key.id }} = %var{key.id}.as({{ value[:type] }})\n {% end %}{% end %}\n {% end %}\n\n \nend\n \n"}},{"id":"mapping(**properties)-macro","html_id":"mapping(**properties)-macro","name":"mapping","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(**properties)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/mapping.cr#L151","def":{"name":"mapping","args":[],"double_splat":{"name":"properties","doc":null,"default_value":"","external_name":"properties","restriction":""},"splat_index":null,"block_arg":null,"visibility":"Public","body":" ::DB.mapping(\n{{ properties }}\n)\n \n"}}],"types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Any","path":"DB/Any.html","kind":"alias","full_name":"DB::Any","name":"Any","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"db.cr","line_number":84,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":true,"aliased":"(Bool | Float32 | Float64 | Int32 | Int64 | Slice(UInt8) | String | Time | Nil)","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/BeginTransaction","path":"DB/BeginTransaction.html","kind":"module","full_name":"DB::BeginTransaction","name":"BeginTransaction","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"db/begin_transaction.cr","line_number":2,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/begin_transaction.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Connection","kind":"class","full_name":"DB::Connection","name":"Connection"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Transaction","kind":"class","full_name":"DB::Transaction","name":"Transaction"}],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"id":"begin_transaction:Transaction-instance-method","html_id":"begin_transaction:Transaction-instance-method","name":"begin_transaction","doc":"Creates a transaction from the current context.\nIf is expected that either `Transaction#commit` or `Transaction#rollback`\nare called explicitly to release the context.","summary":"<p>Creates a transaction from the current context.</p>","abstract":true,"args":[],"args_string":" : Transaction","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/begin_transaction.cr#L6","def":{"name":"begin_transaction","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Transaction","visibility":"Public","body":""}},{"id":"transaction(&block)-instance-method","html_id":"transaction(&block)-instance-method","name":"transaction","doc":"yields a transaction from the current context.\nQuery the database through `Transaction#connection` object.\nIf an exception is thrown within the block a rollback is performed.\nThe exception thrown is bubbled unless it is a `DB::Rollback`.\nFrom the yielded object `Transaction#commit` or `Transaction#rollback`\ncan be called explicitly.","summary":"<p>yields a transaction from the current context.</p>","abstract":false,"args":[],"args_string":"(&block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/begin_transaction.cr#L14","def":{"name":"transaction","args":[],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"tx = begin_transaction\nbegin\n yield tx\nrescue DB::Rollback\n if tx.closed?\n else\n tx.rollback\n end\nrescue e\n if tx.closed?\n else\n begin\n tx.rollback\n rescue\n nil\n end\n end\n raise(e)\nelse\n if tx.closed?\n else\n tx.commit\n end\nend\n"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Connection","path":"DB/Connection.html","kind":"class","full_name":"DB::Connection","name":"Connection","abstract":true,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/BeginTransaction","kind":"module","full_name":"DB::BeginTransaction","name":"BeginTransaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","kind":"module","full_name":"DB::SessionMethods","name":"SessionMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/connection.cr","line_number":21,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/BeginTransaction","kind":"module","full_name":"DB::BeginTransaction","name":"BeginTransaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","kind":"module","full_name":"DB::SessionMethods","name":"SessionMethods"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Database driver implementors must subclass `Connection`.\n\nRepresents one active connection to a database.\n\nUsers should never instantiate a `Connection` manually. Use `DB#open` or `Database#connection`.\n\nRefer to `QueryMethods` for documentation about querying the database through this connection.\n\n### Note to implementors\n\nThe connection must be initialized in `#initialize` and closed in `#do_close`.\n\nOverride `#build_prepared_statement` method in order to return a prepared `Statement` to allow querying.\nOverride `#build_unprepared_statement` method in order to return a unprepared `Statement` to allow querying.\nSee also `Statement` to define how the statements are executed.\n\nIf at any give moment the connection is lost a DB::ConnectionLost should be raised. This will\nallow the connection pool to try to reconnect or use another connection if available.\n","summary":"<p>Database driver implementors must subclass <code><a href=\"../DB/Connection.html\">Connection</a></code>.</p>","class_methods":[],"constructors":[{"id":"new(context:ConnectionContext)-class-method","html_id":"new(context:ConnectionContext)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"ConnectionContext"}],"args_string":"(context : ConnectionContext)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr#L34","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"ConnectionContext"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"begin_transaction:Transaction-instance-method","html_id":"begin_transaction:Transaction-instance-method","name":"begin_transaction","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Transaction","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr#L49","def":{"name":"begin_transaction","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Transaction","visibility":"Public","body":"if @transaction\n raise(DB::Error.new(\"There is an existing transaction in this connection\"))\nend\n@transaction = true\ncreate_transaction\n"}},{"id":"prepared_statements?:Bool-instance-method","html_id":"prepared_statements?:Bool-instance-method","name":"prepared_statements?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr#L32","def":{"name":"prepared_statements?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@prepared_statements"}},{"id":"release-instance-method","html_id":"release-instance-method","name":"release","doc":"return this connection to the pool\nmanaged by the database. Should be used\nonly if the connection was obtained by `Database#checkout`.","summary":"<p>return this connection to the pool managed by the database.</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr#L77","def":{"name":"release","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@context.release(self)"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/ConnectionContext","path":"DB/ConnectionContext.html","kind":"module","full_name":"DB::ConnectionContext","name":"ConnectionContext","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"db/connection_context.cr","line_number":2,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Database","kind":"class","full_name":"DB::Database","name":"Database"}],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"id":"discard(connection:Connection)-instance-method","html_id":"discard(connection:Connection)-instance-method","name":"discard","doc":"Indicates that the *connection* was permanently closed\nand should not be used in the future.","summary":"<p>Indicates that the <em>connection</em> was permanently closed and should not be used in the future.</p>","abstract":true,"args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"args_string":"(connection : Connection)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr#L11","def":{"name":"discard","args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"prepared_statements?:Bool-instance-method","html_id":"prepared_statements?:Bool-instance-method","name":"prepared_statements?","doc":"Return whether the statements should be prepared by default","summary":"<p>Return whether the statements should be prepared by default</p>","abstract":true,"args":[],"args_string":" : Bool","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr#L7","def":{"name":"prepared_statements?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":""}},{"id":"release(connection:Connection)-instance-method","html_id":"release(connection:Connection)-instance-method","name":"release","doc":"Indicates that the *connection* is no longer needed\nand can be reused in the future.","summary":"<p>Indicates that the <em>connection</em> is no longer needed and can be reused in the future.</p>","abstract":true,"args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"args_string":"(connection : Connection)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr#L15","def":{"name":"release","args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"uri:URI-instance-method","html_id":"uri:URI-instance-method","name":"uri","doc":"Returns the uri with the connection settings to the database","summary":"<p>Returns the uri with the connection settings to the database</p>","abstract":true,"args":[],"args_string":" : URI","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr#L4","def":{"name":"uri","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"URI","visibility":"Public","body":""}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/ConnectionLost","path":"DB/ConnectionLost.html","kind":"class","full_name":"DB::ConnectionLost","name":"ConnectionLost","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/error.cr","line_number":17,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Raised when an established connection is lost\nprobably due to socket/network issues.\nIt is used by the connection pool retry logic.","summary":"<p>Raised when an established connection is lost probably due to socket/network issues.</p>","class_methods":[],"constructors":[{"id":"new(connection)-class-method","html_id":"new(connection)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":""}],"args_string":"(connection)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr#L20","def":{"name":"new","args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(connection)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"connection:Connection-instance-method","html_id":"connection:Connection-instance-method","name":"connection","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Connection","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr#L20","def":{"name":"connection","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Connection","visibility":"Public","body":"@connection"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/ConnectionRefused","path":"DB/ConnectionRefused.html","kind":"class","full_name":"DB::ConnectionRefused","name":"ConnectionRefused","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/error.cr","line_number":27,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Raised when a connection is unable to be established\nprobably due to socket/network or configuration issues.\nIt is used by the connection pool retry logic.","summary":"<p>Raised when a connection is unable to be established probably due to socket/network or configuration issues.</p>","class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Database","path":"DB/Database.html","kind":"class","full_name":"DB::Database","name":"Database","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/ConnectionContext","kind":"module","full_name":"DB::ConnectionContext","name":"ConnectionContext"},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","kind":"module","full_name":"DB::SessionMethods","name":"SessionMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/database.cr","line_number":30,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/ConnectionContext","kind":"module","full_name":"DB::ConnectionContext","name":"ConnectionContext"},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","kind":"module","full_name":"DB::SessionMethods","name":"SessionMethods"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Acts as an entry point for database access.\nConnections are managed by a pool.\nUse `DB#open` to create a `Database` instance.\n\nRefer to `QueryMethods` and `SessionMethods` for documentation about querying the database.\n\n## Database URI\n\nConnection parameters are configured in a URI. The format is specified by the individual\ndatabase drivers. See the [reference book](https://crystal-lang.org/reference/database/) for examples.\n\nThe connection pool can be configured from URI parameters:\n\n - `initial_pool_size` (default 1)\n - `max_pool_size` (default 0 = unlimited)\n - `max_idle_pool_size` (default 1)\n - `checkout_timeout` (default 5.0)\n - `retry_attempts` (default 1)\n - `retry_delay` (in seconds, default 1.0)\n\nWhen querying a database, prepared statements are used by default.\nThis can be changed from the `prepared_statements` URI parameter:\n\n - `prepared_statements` (true, or false, default true)\n","summary":"<p>Acts as an entry point for database access.</p>","class_methods":[],"constructors":[],"instance_methods":[{"id":"checkout-instance-method","html_id":"checkout-instance-method","name":"checkout","doc":"returns a connection from the pool\nthe returned connection must be returned\nto the pool by explictly calling `Connection#release`","summary":"<p>returns a connection from the pool the returned connection must be returned to the pool by explictly calling <code><a href=\"../DB/Connection.html#release-instance-method\">Connection#release</a></code></p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L123","def":{"name":"checkout","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"connection = @pool.checkout\nconnection.auto_release = false\nconnection\n"}},{"id":"close-instance-method","html_id":"close-instance-method","name":"close","doc":"Closes all connection to the database.","summary":"<p>Closes all connection to the database.</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L71","def":{"name":"close","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@statements_cache.each_value(&.close)\n@statements_cache.clear\n@pool.close\n"}},{"id":"prepared_statements?:Bool-instance-method","html_id":"prepared_statements?:Bool-instance-method","name":"prepared_statements?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L44","def":{"name":"prepared_statements?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@prepared_statements"}},{"id":"setup_connection(&proc:Connection->Nil)-instance-method","html_id":"setup_connection(&proc:Connection->Nil)-instance-method","name":"setup_connection","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&proc : Connection -> Nil)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L63","def":{"name":"setup_connection","args":[],"double_splat":null,"splat_index":null,"yields":1,"block_arg":{"name":"proc","doc":null,"default_value":"","external_name":"proc","restriction":"(Connection -> Nil)"},"return_type":"","visibility":"Public","body":"@setup_connection = proc\n@pool.each_resource do |conn|\n @setup_connection.call(conn)\nend\n"}},{"id":"transaction(&block)-instance-method","html_id":"transaction(&block)-instance-method","name":"transaction","doc":"yields a `Transaction` from a connection of the pool\nRefer to `BeginTransaction#transaction` for documentation.","summary":"<p>yields a <code><a href=\"../DB/Transaction.html\">Transaction</a></code> from a connection of the pool Refer to <code><a href=\"../DB/BeginTransaction.html#transaction(&block)-instance-method\">BeginTransaction#transaction</a></code> for documentation.</p>","abstract":false,"args":[],"args_string":"(&block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L131","def":{"name":"transaction","args":[],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"using_connection do |cnn|\n cnn.transaction do |tx|\n yield tx\n end\nend"}},{"id":"uri:URI-instance-method","html_id":"uri:URI-instance-method","name":"uri","doc":"Returns the uri with the connection settings to the database","summary":"<p>Returns the uri with the connection settings to the database</p>","abstract":false,"args":[],"args_string":" : URI","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L42","def":{"name":"uri","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"URI","visibility":"Public","body":"@uri"}},{"id":"using_connection(&block)-instance-method","html_id":"using_connection(&block)-instance-method","name":"using_connection","doc":"yields a connection from the pool\nthe connection is returned to the pool\nwhen the block ends","summary":"<p>yields a connection from the pool the connection is returned to the pool when the block ends</p>","abstract":false,"args":[],"args_string":"(&block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L111","def":{"name":"using_connection","args":[],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"connection = self.checkout\nbegin\n yield connection\nensure\n connection.release\nend\n"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","path":"DB/Disposable.html","kind":"module","full_name":"DB::Disposable","name":"Disposable","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"db/disposable.cr","line_number":3,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/disposable.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Connection","kind":"class","full_name":"DB::Connection","name":"Connection"},{"html_id":"github.com/crystal-lang/crystal-db/DB/ResultSet","kind":"class","full_name":"DB::ResultSet","name":"ResultSet"},{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Transaction","kind":"class","full_name":"DB::Transaction","name":"Transaction"}],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Generic module to encapsulate disposable db resources.","summary":"<p>Generic module to encapsulate disposable db resources.</p>","class_methods":[],"constructors":[],"instance_methods":[{"id":"close-instance-method","html_id":"close-instance-method","name":"close","doc":"Closes this object.","summary":"<p>Closes this object.</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/disposable.cr#L9","def":{"name":"close","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if @closed\n return\nend\ndo_close\n@closed = true\n"}},{"id":"closed?-instance-method","html_id":"closed?-instance-method","name":"closed?","doc":"Returns `true` if this object is closed. See `#close`.","summary":"<p>Returns <code>true</code> if this object is closed.</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/disposable.cr#L16","def":{"name":"closed?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@closed"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Driver","path":"DB/Driver.html","kind":"class","full_name":"DB::Driver","name":"Driver","abstract":true,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/driver.cr","line_number":28,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/driver.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Database driver implementors must subclass `Driver`,\nregister with a driver_name using `DB#register_driver` and\noverride the factory method `#build_connection`.\n\n```\nrequire \"db\"\n\nclass FakeDriver < DB::Driver\n def build_connection(context : DB::ConnectionContext)\n FakeConnection.new context\n end\nend\n\nDB.register_driver \"fake\", FakeDriver\n```\n\nAccess to this fake datbase will be available with\n\n```\nDB.open \"fake://...\" do |db|\n # ... use db ...\nend\n```\n\nRefer to `Connection`, `Statement` and `ResultSet` for further\ndriver implementation instructions.","summary":"<p>Database driver implementors must subclass <code><a href=\"../DB/Driver.html\">Driver</a></code>, register with a driver_name using <code><a href=\"../DB.html#register_driver(driver_name,driver_class:Driver.class)-class-method\">DB#register_driver</a></code> and override the factory method <code><a href=\"../DB/Driver.html#build_connection(context:ConnectionContext):Connection-instance-method\">#build_connection</a></code>.</p>","class_methods":[],"constructors":[],"instance_methods":[{"id":"build_connection(context:ConnectionContext):Connection-instance-method","html_id":"build_connection(context:ConnectionContext):Connection-instance-method","name":"build_connection","doc":null,"summary":null,"abstract":true,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"ConnectionContext"}],"args_string":"(context : ConnectionContext) : Connection","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/driver.cr#L29","def":{"name":"build_connection","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"ConnectionContext"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Connection","visibility":"Public","body":""}},{"id":"connection_pool_options(params:HTTP::Params)-instance-method","html_id":"connection_pool_options(params:HTTP::Params)-instance-method","name":"connection_pool_options","doc":null,"summary":null,"abstract":false,"args":[{"name":"params","doc":null,"default_value":"","external_name":"params","restriction":"HTTP::Params"}],"args_string":"(params : HTTP::Params)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/driver.cr#L31","def":{"name":"connection_pool_options","args":[{"name":"params","doc":null,"default_value":"","external_name":"params","restriction":"HTTP::Params"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"{initial_pool_size: (params.fetch(\"initial_pool_size\", 1)).to_i, max_pool_size: (params.fetch(\"max_pool_size\", 0)).to_i, max_idle_pool_size: (params.fetch(\"max_idle_pool_size\", 1)).to_i, checkout_timeout: (params.fetch(\"checkout_timeout\", 5.0)).to_f, retry_attempts: (params.fetch(\"retry_attempts\", 1)).to_i, retry_delay: (params.fetch(\"retry_delay\", 1.0)).to_f}"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/DriverSpecs","path":"DB/DriverSpecs.html","kind":"class","full_name":"DB::DriverSpecs(DBAnyType)","name":"DriverSpecs","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"spec.cr","line_number":51,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Helper class to ensure behaviour of custom drivers\n\n```\nrequire \"db/spec\"\n\nDB::DriverSpecs(DB::Any).run do\n # How to connect to database\n connection_string \"scheme://database_url\"\n\n # Clean up database if needed using before/after callbacks\n before do\n # ...\n end\n\n after do\n # ...\n end\n\n # Sample values that will be stored, retrieved across many specs\n sample_value \"hello\", \"varchar(25)\", \"'hello'\"\n\n it \"custom spec with a db initialized\" do |db|\n # assert something using *db*\n end\n\n # Configure the appropiate syntax for different commands needed to run the specs\n binding_syntax do |index|\n \"?\"\n end\n\n create_table_1column_syntax do |table_name, col1|\n \"create table #{table_name} (#{col1.name} #{col1.sql_type} #{col1.null ? \"NULL\" : \"NOT NULL\"})\"\n end\nend\n```\n\nThe following methods needs to be called to configure the appropiate syntax\nfor different commands and allow all the specs to run: `binding_syntax`, `create_table_1column_syntax`,\n`create_table_2columns_syntax`, `select_1column_syntax`, `select_2columns_syntax`, `select_count_syntax`,\n`select_scalar_syntax`, `insert_1column_syntax`, `insert_2columns_syntax`, `drop_table_if_exists_syntax`.\n","summary":"<p>Helper class to ensure behaviour of custom drivers</p>","class_methods":[{"id":"run(description="asadb",&block)-class-method","html_id":"run(description=&quot;asadb&quot;,&block)-class-method","name":"run","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"\"as a db\"","external_name":"description","restriction":""}],"args_string":"(description = <span class=\"s\">"as a db"</span>, &block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L469","def":{"name":"run","args":[{"name":"description","doc":null,"default_value":"\"as a db\"","external_name":"description","restriction":""}],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"ctx = self.new\nwith ctx yield\ndescribe(description) do\n ctx.include_shared_specs\n ctx.its.each do |db_it|\n case db_it.prepared\n when :default\n it(db_it.description, db_it.file, db_it.line, db_it.end_line) do\n ctx.with_db do |db|\n db_it.block.call(db)\n nil\n end\n end\n when :both\n values = [] of Bool\n if ctx.support_prepared\n values << true\n end\n if ctx.support_unprepared\n values << false\n end\n case values.size\n when 0\n raise(\"Neither prepared non unprepared statements allowed\")\n when 1\n it(db_it.description, db_it.file, db_it.line, db_it.end_line) do\n ctx.with_db do |db|\n db_it.block.call(db)\n nil\n end\n end\n else\n values.each do |prepared_statements|\n it(\"#{db_it.description} (prepared_statements=#{prepared_statements})\", db_it.file, db_it.line, db_it.end_line) do\n ctx.with_db(\"prepared_statements=#{prepared_statements}\") do |db|\n db_it.block.call(db)\n nil\n end\n end\n end\n end\n end\n end\nend\n"}}],"constructors":[],"instance_methods":[{"id":"after(&after:->Nil)-instance-method","html_id":"after(&after:->Nil)-instance-method","name":"after","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&after : -> Nil)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L63","def":{"name":"after","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"after","doc":null,"default_value":"","external_name":"after","restriction":"(-> Nil)"},"return_type":"","visibility":"Public","body":"@after = after"}},{"id":"before(&before:->Nil)-instance-method","html_id":"before(&before:->Nil)-instance-method","name":"before","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&before : -> Nil)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L60","def":{"name":"before","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"before","doc":null,"default_value":"","external_name":"before","restriction":"(-> Nil)"},"return_type":"","visibility":"Public","body":"@before = before"}},{"id":"binding_syntax(&binding_syntax:Proc(Int32,String))-instance-method","html_id":"binding_syntax(&binding_syntax:Proc(Int32,String))-instance-method","name":"binding_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&binding_syntax : Proc(Int32, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L110","def":{"name":"binding_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"binding_syntax","doc":null,"default_value":"","external_name":"binding_syntax","restriction":"Proc(Int32, String)"},"return_type":"","visibility":"Public","body":"@binding_syntax = binding_syntax"}},{"id":"connection_string(connection_string:String)-instance-method","html_id":"connection_string(connection_string:String)-instance-method","name":"connection_string","doc":null,"summary":null,"abstract":false,"args":[{"name":"connection_string","doc":null,"default_value":"","external_name":"connection_string","restriction":"String"}],"args_string":"(connection_string : String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L109","def":{"name":"connection_string","args":[{"name":"connection_string","doc":null,"default_value":"","external_name":"connection_string","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@connection_string = connection_string"}},{"id":"create_table_1column_syntax(&create_table_1column_syntax:Proc(String,ColumnDef,String))-instance-method","html_id":"create_table_1column_syntax(&create_table_1column_syntax:Proc(String,ColumnDef,String))-instance-method","name":"create_table_1column_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&create_table_1column_syntax : Proc(String, ColumnDef, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L112","def":{"name":"create_table_1column_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"create_table_1column_syntax","doc":null,"default_value":"","external_name":"create_table_1column_syntax","restriction":"Proc(String, ColumnDef, String)"},"return_type":"","visibility":"Public","body":"@create_table_1column_syntax = create_table_1column_syntax"}},{"id":"create_table_2columns_syntax(&create_table_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method","html_id":"create_table_2columns_syntax(&create_table_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method","name":"create_table_2columns_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&create_table_2columns_syntax : Proc(String, ColumnDef, ColumnDef, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L113","def":{"name":"create_table_2columns_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"create_table_2columns_syntax","doc":null,"default_value":"","external_name":"create_table_2columns_syntax","restriction":"Proc(String, ColumnDef, ColumnDef, String)"},"return_type":"","visibility":"Public","body":"@create_table_2columns_syntax = create_table_2columns_syntax"}},{"id":"drop_table_if_exists_syntax(&drop_table_if_exists_syntax:Proc(String,String))-instance-method","html_id":"drop_table_if_exists_syntax(&drop_table_if_exists_syntax:Proc(String,String))-instance-method","name":"drop_table_if_exists_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&drop_table_if_exists_syntax : Proc(String, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L119","def":{"name":"drop_table_if_exists_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"drop_table_if_exists_syntax","doc":null,"default_value":"","external_name":"drop_table_if_exists_syntax","restriction":"Proc(String, String)"},"return_type":"","visibility":"Public","body":"@drop_table_if_exists_syntax = drop_table_if_exists_syntax"}},{"id":"encode_null(encode_null:String)-instance-method","html_id":"encode_null(encode_null:String)-instance-method","name":"encode_null","doc":null,"summary":null,"abstract":false,"args":[{"name":"encode_null","doc":null,"default_value":"","external_name":"encode_null","restriction":"String"}],"args_string":"(encode_null : String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L66","def":{"name":"encode_null","args":[{"name":"encode_null","doc":null,"default_value":"","external_name":"encode_null","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@encode_null = encode_null"}},{"id":"insert_1column_syntax(&insert_1column_syntax:Proc(String,ColumnDef,String,String))-instance-method","html_id":"insert_1column_syntax(&insert_1column_syntax:Proc(String,ColumnDef,String,String))-instance-method","name":"insert_1column_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&insert_1column_syntax : Proc(String, ColumnDef, String, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L114","def":{"name":"insert_1column_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"insert_1column_syntax","doc":null,"default_value":"","external_name":"insert_1column_syntax","restriction":"Proc(String, ColumnDef, String, String)"},"return_type":"","visibility":"Public","body":"@insert_1column_syntax = insert_1column_syntax"}},{"id":"insert_2columns_syntax(&insert_2columns_syntax:Proc(String,ColumnDef,String,ColumnDef,String,String))-instance-method","html_id":"insert_2columns_syntax(&insert_2columns_syntax:Proc(String,ColumnDef,String,ColumnDef,String,String))-instance-method","name":"insert_2columns_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&insert_2columns_syntax : Proc(String, ColumnDef, String, ColumnDef, String, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L115","def":{"name":"insert_2columns_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"insert_2columns_syntax","doc":null,"default_value":"","external_name":"insert_2columns_syntax","restriction":"Proc(String, ColumnDef, String, ColumnDef, String, String)"},"return_type":"","visibility":"Public","body":"@insert_2columns_syntax = insert_2columns_syntax"}},{"id":"it(description="assert",prepared=:default,file=__FILE__,line=__LINE__,end_line=__END_LINE__,&block:DB::Database->)-instance-method","html_id":"it(description=&quot;assert&quot;,prepared=:default,file=__FILE__,line=__LINE__,end_line=__END_LINE__,&block:DB::Database->)-instance-method","name":"it","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"\"assert\"","external_name":"description","restriction":""},{"name":"prepared","doc":null,"default_value":":default","external_name":"prepared","restriction":""},{"name":"file","doc":null,"default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","doc":null,"default_value":"__LINE__","external_name":"line","restriction":""},{"name":"end_line","doc":null,"default_value":"__END_LINE__","external_name":"end_line","restriction":""}],"args_string":"(description = <span class=\"s\">"assert"</span>, prepared = <span class=\"n\">:default</span>, file = __FILE__, line = __LINE__, end_line = __END_LINE__, &block : DB::Database -> )","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L125","def":{"name":"it","args":[{"name":"description","doc":null,"default_value":"\"assert\"","external_name":"description","restriction":""},{"name":"prepared","doc":null,"default_value":":default","external_name":"prepared","restriction":""},{"name":"file","doc":null,"default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","doc":null,"default_value":"__LINE__","external_name":"line","restriction":""},{"name":"end_line","doc":null,"default_value":"__END_LINE__","external_name":"end_line","restriction":""}],"double_splat":null,"splat_index":null,"yields":1,"block_arg":{"name":"block","doc":null,"default_value":"","external_name":"block","restriction":"(DB::Database -> )"},"return_type":"","visibility":"Public","body":"if Spec.matches?(description, file, line, end_line)\nelse\n return\nend\n@its << (SpecIt.new(description, prepared, file, line, end_line, block))\n"}},{"id":"its-instance-method","html_id":"its-instance-method","name":"its","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L125","def":{"name":"its","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@its"}},{"id":"sample_value(value,sql_type,value_encoded,*,type_safe_value=true)-instance-method","html_id":"sample_value(value,sql_type,value_encoded,*,type_safe_value=true)-instance-method","name":"sample_value","doc":"Use *value* as sample value that should be stored in columns of type *sql_type*.\n*value_encoded* is driver specific expression that should generate that value in the database.\n*type_safe_value* indicates whether *value_encoded* is expected to generate the *value* even without\nbeen stored in a table (default `true`).","summary":"<p>Use <em>value</em> as sample value that should be stored in columns of type <em>sql_type</em>.</p>","abstract":false,"args":[{"name":"value","doc":null,"default_value":"","external_name":"value","restriction":""},{"name":"sql_type","doc":null,"default_value":"","external_name":"sql_type","restriction":""},{"name":"value_encoded","doc":null,"default_value":"","external_name":"value_encoded","restriction":""},{"name":"","doc":null,"default_value":"","external_name":"","restriction":""},{"name":"type_safe_value","doc":null,"default_value":"true","external_name":"type_safe_value","restriction":""}],"args_string":"(value, sql_type, value_encoded, *, type_safe_value = <span class=\"n\">true</span>)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L139","def":{"name":"sample_value","args":[{"name":"value","doc":null,"default_value":"","external_name":"value","restriction":""},{"name":"sql_type","doc":null,"default_value":"","external_name":"sql_type","restriction":""},{"name":"value_encoded","doc":null,"default_value":"","external_name":"value_encoded","restriction":""},{"name":"","doc":null,"default_value":"","external_name":"","restriction":""},{"name":"type_safe_value","doc":null,"default_value":"true","external_name":"type_safe_value","restriction":""}],"double_splat":null,"splat_index":3,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@values << (ValueDef(DBAnyType).new(value, sql_type, value_encoded))\nit(\"select nil as (#{typeof(value)} | Nil)\", prepared: :both) do |db|\n db.query(select_scalar(encode_null, nil)) do |rs|\n assert_single_read(rs, typeof(value || nil), nil)\n end\nend\nvalue_desc = value.to_s\nif value_desc.size > 25\n value_desc = \"#{value_desc[0..25]}...(#{value_desc.size})\"\nend\nvalue_desc = \"#{value_desc} as #{sql_type}\"\nif type_safe_value\n it(\"executes with bind #{value_desc}\") do |db|\n (db.scalar(select_scalar(param(1), sql_type), value)).should(eq(value))\n end\n it(\"executes with bind #{value_desc} as array\") do |db|\n (db.scalar(select_scalar(param(1), sql_type), [value])).should(eq(value))\n end\n it(\"select #{value_desc} as literal\") do |db|\n (db.scalar(select_scalar(value_encoded, sql_type))).should(eq(value))\n db.query(select_scalar(value_encoded, sql_type)) do |rs|\n assert_single_read(rs, typeof(value), value)\n end\n end\nend\nit(\"insert/get value #{value_desc} from table\", prepared: :both) do |db|\n db.exec(sql_create_table_table1(c1 = col1(sql_type)))\n db.exec(sql_insert_table1(c1, value_encoded))\n (db.query_one(sql_select_table1(c1), as: typeof(value))).should(eq(value))\nend\nit(\"insert/get value #{value_desc} from table as nillable\", prepared: :both) do |db|\n db.exec(sql_create_table_table1(c1 = col1(sql_type)))\n db.exec(sql_insert_table1(c1, value_encoded))\n (db.query_one(sql_select_table1(c1), as: ::Union(typeof(value) | Nil))).should(eq(value))\nend\nit(\"insert/get value nil from table as nillable #{sql_type}\", prepared: :both) do |db|\n db.exec(sql_create_table_table1(c1 = col1(sql_type, null: true)))\n db.exec(sql_insert_table1(c1, encode_null))\n (db.query_one(sql_select_table1(c1), as: ::Union(typeof(value) | Nil))).should(eq(nil))\nend\nit(\"insert/get value #{value_desc} from table with binding\") do |db|\n db.exec(sql_create_table_table2(c1 = col1(sql_type_for(String)), c2 = col2(sql_type)))\n db.exec(sql_insert_table2(c1, param(1), c2, param(2)), value_for(String), value)\n (db.query_one(sql_select_table2(c2), as: typeof(value))).should(eq(value))\nend\nit(\"insert/get value #{value_desc} from table as nillable with binding\") do |db|\n db.exec(sql_create_table_table2(c1 = col1(sql_type_for(String)), c2 = col2(sql_type)))\n db.exec(sql_insert_table2(c1, param(1), c2, param(2)), value_for(String), value)\n (db.query_one(sql_select_table2(c2), as: ::Union(typeof(value) | Nil))).should(eq(value))\nend\nit(\"insert/get value nil from table as nillable #{sql_type} with binding\") do |db|\n db.exec(sql_create_table_table2(c1 = col1(sql_type_for(String)), c2 = col2(sql_type, null: true)))\n db.exec(sql_insert_table2(c1, param(1), c2, param(2)), value_for(String), nil)\n (db.query_one(sql_select_table2(c2), as: ::Union(typeof(value) | Nil))).should(eq(nil))\nend\nit(\"can use read(#{typeof(value)}) with DB::ResultSet\", prepared: :both) do |db|\n db.exec(sql_create_table_table1(c1 = col1(sql_type)))\n db.exec(sql_insert_table1(c1, value_encoded))\n db.query(sql_select_table1(c1)) do |rs|\n assert_single_read(rs.as(DB::ResultSet), typeof(value), value)\n end\nend\nit(\"can use read(#{typeof(value)}?) with DB::ResultSet\", prepared: :both) do |db|\n db.exec(sql_create_table_table1(c1 = col1(sql_type)))\n db.exec(sql_insert_table1(c1, value_encoded))\n db.query(sql_select_table1(c1)) do |rs|\n assert_single_read(rs.as(DB::ResultSet), ::Union(typeof(value) | Nil), value)\n end\nend\nit(\"can use read(#{typeof(value)}?) with DB::ResultSet for nil\", prepared: :both) do |db|\n db.exec(sql_create_table_table1(c1 = col1(sql_type, null: true)))\n db.exec(sql_insert_table1(c1, encode_null))\n db.query(sql_select_table1(c1)) do |rs|\n assert_single_read(rs.as(DB::ResultSet), ::Union(typeof(value) | Nil), nil)\n end\nend\n"}},{"id":"select_1column_syntax(&select_1column_syntax:Proc(String,ColumnDef,String))-instance-method","html_id":"select_1column_syntax(&select_1column_syntax:Proc(String,ColumnDef,String))-instance-method","name":"select_1column_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&select_1column_syntax : Proc(String, ColumnDef, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L116","def":{"name":"select_1column_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"select_1column_syntax","doc":null,"default_value":"","external_name":"select_1column_syntax","restriction":"Proc(String, ColumnDef, String)"},"return_type":"","visibility":"Public","body":"@select_1column_syntax = select_1column_syntax"}},{"id":"select_2columns_syntax(&select_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method","html_id":"select_2columns_syntax(&select_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method","name":"select_2columns_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&select_2columns_syntax : Proc(String, ColumnDef, ColumnDef, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L117","def":{"name":"select_2columns_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"select_2columns_syntax","doc":null,"default_value":"","external_name":"select_2columns_syntax","restriction":"Proc(String, ColumnDef, ColumnDef, String)"},"return_type":"","visibility":"Public","body":"@select_2columns_syntax = select_2columns_syntax"}},{"id":"select_count_syntax(&select_count_syntax:Proc(String,String))-instance-method","html_id":"select_count_syntax(&select_count_syntax:Proc(String,String))-instance-method","name":"select_count_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&select_count_syntax : Proc(String, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L118","def":{"name":"select_count_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"select_count_syntax","doc":null,"default_value":"","external_name":"select_count_syntax","restriction":"Proc(String, String)"},"return_type":"","visibility":"Public","body":"@select_count_syntax = select_count_syntax"}},{"id":"select_scalar_syntax(&select_scalar_syntax:Proc(String,String?,String))-instance-method","html_id":"select_scalar_syntax(&select_scalar_syntax:Proc(String,String?,String))-instance-method","name":"select_scalar_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&select_scalar_syntax : Proc(String, String?, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L111","def":{"name":"select_scalar_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"select_scalar_syntax","doc":null,"default_value":"","external_name":"select_scalar_syntax","restriction":"Proc(String, String | ::Nil, String)"},"return_type":"","visibility":"Public","body":"@select_scalar_syntax = select_scalar_syntax"}},{"id":"support_prepared(support_prepared:Bool)-instance-method","html_id":"support_prepared(support_prepared:Bool)-instance-method","name":"support_prepared","doc":"Allow specs that uses prepared statements (default `true`)","summary":"<p>Allow specs that uses prepared statements (default <code>true</code>)</p>","abstract":false,"args":[{"name":"support_prepared","doc":null,"default_value":"","external_name":"support_prepared","restriction":"Bool"}],"args_string":"(support_prepared : Bool)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L70","def":{"name":"support_prepared","args":[{"name":"support_prepared","doc":null,"default_value":"","external_name":"support_prepared","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@support_prepared = support_prepared"}},{"id":"support_unprepared(support_unprepared:Bool)-instance-method","html_id":"support_unprepared(support_unprepared:Bool)-instance-method","name":"support_unprepared","doc":"Allow specs that uses unprepared statements (default `true`)","summary":"<p>Allow specs that uses unprepared statements (default <code>true</code>)</p>","abstract":false,"args":[{"name":"support_unprepared","doc":null,"default_value":"","external_name":"support_unprepared","restriction":"Bool"}],"args_string":"(support_unprepared : Bool)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L79","def":{"name":"support_unprepared","args":[{"name":"support_unprepared","doc":null,"default_value":"","external_name":"support_unprepared","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@support_unprepared = support_unprepared"}}],"macros":[],"types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef","path":"DB/DriverSpecs/ColumnDef.html","kind":"struct","full_name":"DB::DriverSpecs::ColumnDef","name":"ColumnDef","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"github.com/crystal-lang/crystal-db/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"spec.cr","line_number":52,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB/DriverSpecs","kind":"class","full_name":"DB::DriverSpecs(DBAnyType)","name":"DriverSpecs"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(name:String,sql_type:String,null:Bool)-class-method","html_id":"new(name:String,sql_type:String,null:Bool)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"},{"name":"sql_type","doc":null,"default_value":"","external_name":"sql_type","restriction":"String"},{"name":"null","doc":null,"default_value":"","external_name":"null","restriction":"Bool"}],"args_string":"(name : String, sql_type : String, null : Bool)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L52","def":{"name":"new","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"},{"name":"sql_type","doc":null,"default_value":"","external_name":"sql_type","restriction":"String"},{"name":"null","doc":null,"default_value":"","external_name":"null","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(name, sql_type, null)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"clone-instance-method","html_id":"clone-instance-method","name":"clone","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L52","def":{"name":"clone","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.class.new(@name.clone, @sql_type.clone, @null.clone)"}},{"id":"copy_with(name_name=@name,sql_type_sql_type=@sql_type,null_null=@null)-instance-method","html_id":"copy_with(name_name=@name,sql_type_sql_type=@sql_type,null_null=@null)-instance-method","name":"copy_with","doc":null,"summary":null,"abstract":false,"args":[{"name":"_name","doc":null,"default_value":"@name","external_name":"name","restriction":""},{"name":"_sql_type","doc":null,"default_value":"@sql_type","external_name":"sql_type","restriction":""},{"name":"_null","doc":null,"default_value":"@null","external_name":"null","restriction":""}],"args_string":"(name _name = @name, sql_type _sql_type = @sql_type, null _null = @null)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L52","def":{"name":"copy_with","args":[{"name":"_name","doc":null,"default_value":"@name","external_name":"name","restriction":""},{"name":"_sql_type","doc":null,"default_value":"@sql_type","external_name":"sql_type","restriction":""},{"name":"_null","doc":null,"default_value":"@null","external_name":"null","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.class.new(_name, _sql_type, _null)"}},{"id":"name:String-instance-method","html_id":"name:String-instance-method","name":"name","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":null,"def":{"name":"name","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@name"}},{"id":"null:Bool-instance-method","html_id":"null:Bool-instance-method","name":"null","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","source_link":null,"def":{"name":"null","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@null"}},{"id":"sql_type:String-instance-method","html_id":"sql_type:String-instance-method","name":"sql_type","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":null,"def":{"name":"sql_type","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@sql_type"}}],"macros":[],"types":[]}]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","path":"DB/Error.html","kind":"class","full_name":"DB::Error","name":"Error","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/error.cr","line_number":2,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"github.com/crystal-lang/crystal-db/DB/ConnectionLost","kind":"class","full_name":"DB::ConnectionLost","name":"ConnectionLost"},{"html_id":"github.com/crystal-lang/crystal-db/DB/ConnectionRefused","kind":"class","full_name":"DB::ConnectionRefused","name":"ConnectionRefused"},{"html_id":"github.com/crystal-lang/crystal-db/DB/MappingException","kind":"class","full_name":"DB::MappingException","name":"MappingException"},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded","kind":"class","full_name":"DB::PoolRetryAttemptsExceeded","name":"PoolRetryAttemptsExceeded"},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolTimeout","kind":"class","full_name":"DB::PoolTimeout","name":"PoolTimeout"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Rollback","kind":"class","full_name":"DB::Rollback","name":"Rollback"}],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/ExecResult","path":"DB/ExecResult.html","kind":"struct","full_name":"DB::ExecResult","name":"ExecResult","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"github.com/crystal-lang/crystal-db/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db.cr","line_number":89,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Result of a `#exec` statement.","summary":"<p>Result of a <code>#exec</code> statement.</p>","class_methods":[],"constructors":[{"id":"new(rows_affected:Int64,last_insert_id:Int64)-class-method","html_id":"new(rows_affected:Int64,last_insert_id:Int64)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"rows_affected","doc":null,"default_value":"","external_name":"rows_affected","restriction":"Int64"},{"name":"last_insert_id","doc":null,"default_value":"","external_name":"last_insert_id","restriction":"Int64"}],"args_string":"(rows_affected : Int64, last_insert_id : Int64)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L89","def":{"name":"new","args":[{"name":"rows_affected","doc":null,"default_value":"","external_name":"rows_affected","restriction":"Int64"},{"name":"last_insert_id","doc":null,"default_value":"","external_name":"last_insert_id","restriction":"Int64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(rows_affected, last_insert_id)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"clone-instance-method","html_id":"clone-instance-method","name":"clone","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L89","def":{"name":"clone","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.class.new(@rows_affected.clone, @last_insert_id.clone)"}},{"id":"copy_with(rows_affected_rows_affected=@rows_affected,last_insert_id_last_insert_id=@last_insert_id)-instance-method","html_id":"copy_with(rows_affected_rows_affected=@rows_affected,last_insert_id_last_insert_id=@last_insert_id)-instance-method","name":"copy_with","doc":null,"summary":null,"abstract":false,"args":[{"name":"_rows_affected","doc":null,"default_value":"@rows_affected","external_name":"rows_affected","restriction":""},{"name":"_last_insert_id","doc":null,"default_value":"@last_insert_id","external_name":"last_insert_id","restriction":""}],"args_string":"(rows_affected _rows_affected = @rows_affected, last_insert_id _last_insert_id = @last_insert_id)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L89","def":{"name":"copy_with","args":[{"name":"_rows_affected","doc":null,"default_value":"@rows_affected","external_name":"rows_affected","restriction":""},{"name":"_last_insert_id","doc":null,"default_value":"@last_insert_id","external_name":"last_insert_id","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.class.new(_rows_affected, _last_insert_id)"}},{"id":"last_insert_id:Int64-instance-method","html_id":"last_insert_id:Int64-instance-method","name":"last_insert_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int64","source_link":null,"def":{"name":"last_insert_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int64","visibility":"Public","body":"@last_insert_id"}},{"id":"rows_affected:Int64-instance-method","html_id":"rows_affected:Int64-instance-method","name":"rows_affected","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int64","source_link":null,"def":{"name":"rows_affected","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int64","visibility":"Public","body":"@rows_affected"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Mappable","path":"DB/Mappable.html","kind":"module","full_name":"DB::Mappable","name":"Mappable","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"db/mapping.cr","line_number":3,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/mapping.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Empty module used for marking a class as supporting DB:Mapping","summary":"<p>Empty module used for marking a class as supporting DB:Mapping</p>","class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/MappingException","path":"DB/MappingException.html","kind":"class","full_name":"DB::MappingException","name":"MappingException","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/error.cr","line_number":5,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Pool","path":"DB/Pool.html","kind":"class","full_name":"DB::Pool(T)","name":"Pool","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/pool.cr","line_number":4,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(initial_pool_size=1,max_pool_size=0,max_idle_pool_size=1,checkout_timeout=5.0,retry_attempts=1,retry_delay=0.2,&factory:->T)-class-method","html_id":"new(initial_pool_size=1,max_pool_size=0,max_idle_pool_size=1,checkout_timeout=5.0,retry_attempts=1,retry_delay=0.2,&factory:->T)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"initial_pool_size","doc":null,"default_value":"1","external_name":"initial_pool_size","restriction":""},{"name":"max_pool_size","doc":null,"default_value":"0","external_name":"max_pool_size","restriction":""},{"name":"max_idle_pool_size","doc":null,"default_value":"1","external_name":"max_idle_pool_size","restriction":""},{"name":"checkout_timeout","doc":null,"default_value":"5.0","external_name":"checkout_timeout","restriction":""},{"name":"retry_attempts","doc":null,"default_value":"1","external_name":"retry_attempts","restriction":""},{"name":"retry_delay","doc":null,"default_value":"0.2","external_name":"retry_delay","restriction":""}],"args_string":"(initial_pool_size = <span class=\"n\">1</span>, max_pool_size = <span class=\"n\">0</span>, max_idle_pool_size = <span class=\"n\">1</span>, checkout_timeout = <span class=\"n\">5.0</span>, retry_attempts = <span class=\"n\">1</span>, retry_delay = <span class=\"n\">0.2</span>, &factory : -> T)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L15","def":{"name":"new","args":[{"name":"initial_pool_size","doc":null,"default_value":"1","external_name":"initial_pool_size","restriction":""},{"name":"max_pool_size","doc":null,"default_value":"0","external_name":"max_pool_size","restriction":""},{"name":"max_idle_pool_size","doc":null,"default_value":"1","external_name":"max_idle_pool_size","restriction":""},{"name":"checkout_timeout","doc":null,"default_value":"5.0","external_name":"checkout_timeout","restriction":""},{"name":"retry_attempts","doc":null,"default_value":"1","external_name":"retry_attempts","restriction":""},{"name":"retry_delay","doc":null,"default_value":"0.2","external_name":"retry_delay","restriction":""}],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"factory","doc":null,"default_value":"","external_name":"factory","restriction":"(-> T)"},"return_type":"","visibility":"Public","body":"_ = Pool(T).allocate\n_.initialize(initial_pool_size, max_pool_size, max_idle_pool_size, checkout_timeout, retry_attempts, retry_delay, &factory) do\n yield\nend\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"checkout:T-instance-method","html_id":"checkout:T-instance-method","name":"checkout","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : T","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L31","def":{"name":"checkout","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"T","visibility":"Public","body":"resource = if @available.empty?\n if can_increase_pool\n build_resource\n else\n wait_for_available\n pick_available\n end\nelse\n pick_available\nend\n@available.delete(resource)\nresource.before_checkout\nresource\n"}},{"id":"checkout_some(candidates:Enumerable(WeakRef(T))):::Tuple(T,Bool)-instance-method","html_id":"checkout_some(candidates:Enumerable(WeakRef(T))):::Tuple(T,Bool)-instance-method","name":"checkout_some","doc":"```\nselected, is_candidate = pool.checkout_some(candidates)\n```\n`selected` be a resource from the `candidates` list and `is_candidate` == `true`\nor `selected` will be a new resource and `is_candidate` == `false`","summary":"<p><code></code>` selected, is_candidate = pool.checkout_some(candidates) <code></code>` <code>selected</code> be a resource from the <code>candidates</code> list and <code>is_candidate</code> == <code>true</code> or <code>selected</code> will be a new resource and <code>is_candidate</code> == <code>false</code></p>","abstract":false,"args":[{"name":"candidates","doc":null,"default_value":"","external_name":"candidates","restriction":"Enumerable(WeakRef(T))"}],"args_string":"(candidates : Enumerable(WeakRef(T))) : ::Tuple(T, Bool)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L53","def":{"name":"checkout_some","args":[{"name":"candidates","doc":null,"default_value":"","external_name":"candidates","restriction":"Enumerable(WeakRef(T))"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"::Tuple(T, Bool)","visibility":"Public","body":"candidates.each do |ref|\n resource = ref.value\n if resource && (is_available?(resource))\n @available.delete(resource)\n resource.before_checkout\n return {resource, true}\n end\nend\nresource = checkout\n{resource, candidates.any? do |ref|\n ref.value == resource\nend}\n"}},{"id":"close:Nil-instance-method","html_id":"close:Nil-instance-method","name":"close","doc":"close all resources in the pool","summary":"<p>close all resources in the pool</p>","abstract":false,"args":[],"args_string":" : Nil","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L25","def":{"name":"close","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Nil","visibility":"Public","body":"@total.each(&.close)\n@total.clear\n@available.clear\n"}},{"id":"release(resource:T):Nil-instance-method","html_id":"release(resource:T):Nil-instance-method","name":"release","doc":null,"summary":null,"abstract":false,"args":[{"name":"resource","doc":null,"default_value":"","external_name":"resource","restriction":"T"}],"args_string":"(resource : T) : Nil","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L69","def":{"name":"release","args":[{"name":"resource","doc":null,"default_value":"","external_name":"resource","restriction":"T"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Nil","visibility":"Public","body":"if can_increase_idle_pool\n @available << resource\n resource.after_release\n if are_waiting_for_resource?\n @availability_channel.send(nil)\n end\nelse\n resource.close\n @total.delete(resource)\nend"}}],"macros":[],"types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper","path":"DB/Pool/TimeoutHelper.html","kind":"class","full_name":"DB::Pool::TimeoutHelper","name":"TimeoutHelper","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/pool.cr","line_number":183,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB/Pool","kind":"class","full_name":"DB::Pool(T)","name":"Pool"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(timeout:Float64)-class-method","html_id":"new(timeout:Float64)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"timeout","doc":null,"default_value":"","external_name":"timeout","restriction":"Float64"}],"args_string":"(timeout : Float64)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L184","def":{"name":"new","args":[{"name":"timeout","doc":null,"default_value":"","external_name":"timeout","restriction":"Float64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(timeout)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"cancel-instance-method","html_id":"cancel-instance-method","name":"cancel","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L202","def":{"name":"cancel","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@abort_timeout = true"}},{"id":"receive_select_action-instance-method","html_id":"receive_select_action-instance-method","name":"receive_select_action","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L189","def":{"name":"receive_select_action","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@timeout_channel.receive_select_action"}},{"id":"start-instance-method","html_id":"start-instance-method","name":"start","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L193","def":{"name":"start","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"spawn do\n sleep(@timeout)\n if @abort_timeout\n else\n @timeout_channel.send(nil)\n end\nend"}}],"macros":[],"types":[]}]},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement","path":"DB/PoolPreparedStatement.html","kind":"class","full_name":"DB::PoolPreparedStatement","name":"PoolPreparedStatement","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolStatement","kind":"class","full_name":"DB::PoolStatement","name":"PoolStatement"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolStatement","kind":"class","full_name":"DB::PoolStatement","name":"PoolStatement"},{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/pool_prepared_statement.cr","line_number":7,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_prepared_statement.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Represents a statement to be executed in any of the connections\nof the pool. The statement is not be executed in a prepared fashion.\nThe execution of the statement is retried according to the pool configuration.\n\nSee `PoolStatement`","summary":"<p>Represents a statement to be executed in any of the connections of the pool.</p>","class_methods":[],"constructors":[{"id":"new(db:Database,query:String)-class-method","html_id":"new(db:Database,query:String)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"Database"},{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":"String"}],"args_string":"(db : Database, query : String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_prepared_statement.cr#L11","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"Database"},{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db, query)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded","path":"DB/PoolRetryAttemptsExceeded.html","kind":"class","full_name":"DB::PoolRetryAttemptsExceeded","name":"PoolRetryAttemptsExceeded","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/error.cr","line_number":11,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolStatement","path":"DB/PoolStatement.html","kind":"class","full_name":"DB::PoolStatement","name":"PoolStatement","abstract":true,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/pool_statement.cr","line_number":6,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods"}],"extended_modules":[],"subclasses":[{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement","kind":"class","full_name":"DB::PoolPreparedStatement","name":"PoolPreparedStatement"},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement","kind":"class","full_name":"DB::PoolUnpreparedStatement","name":"PoolUnpreparedStatement"}],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"When a statement is to be executed in a DB that has a connection pool\na statement from the DB needs to be able to represent a statement in any\nof the connections of the pool. Otherwise the user will need to deal with\nactual connections in some point.","summary":"<p>When a statement is to be executed in a DB that has a connection pool a statement from the DB needs to be able to represent a statement in any of the connections of the pool.</p>","class_methods":[],"constructors":[{"id":"new(db:Database,query:String)-class-method","html_id":"new(db:Database,query:String)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"Database"},{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":"String"}],"args_string":"(db : Database, query : String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L9","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"Database"},{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db, query)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"exec(args:Array):ExecResult-instance-method","html_id":"exec(args:Array):ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"args_string":"(args : Array) : ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L23","def":{"name":"exec","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ExecResult","visibility":"Public","body":"statement_with_retry(&.exec(args))"}},{"id":"exec:ExecResult-instance-method","html_id":"exec:ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":false,"args":[],"args_string":" : ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L13","def":{"name":"exec","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ExecResult","visibility":"Public","body":"statement_with_retry(&.exec)"}},{"id":"exec(*args):ExecResult-instance-method","html_id":"exec(*args):ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args) : ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L18","def":{"name":"exec","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"ExecResult","visibility":"Public","body":"statement_with_retry(&.exec(*args))"}},{"id":"query(args:Array):ResultSet-instance-method","html_id":"query(args:Array):ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"args_string":"(args : Array) : ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L38","def":{"name":"query","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ResultSet","visibility":"Public","body":"statement_with_retry(&.query(args))"}},{"id":"query:ResultSet-instance-method","html_id":"query:ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":false,"args":[],"args_string":" : ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L28","def":{"name":"query","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ResultSet","visibility":"Public","body":"statement_with_retry(&.query)"}},{"id":"query(*args):ResultSet-instance-method","html_id":"query(*args):ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args) : ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L33","def":{"name":"query","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"ResultSet","visibility":"Public","body":"statement_with_retry(&.query(*args))"}},{"id":"scalar(*args)-instance-method","html_id":"scalar(*args)-instance-method","name":"scalar","doc":"See `QueryMethods#scalar`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#scalar(query,*args)-instance-method\">QueryMethods#scalar</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L43","def":{"name":"scalar","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"statement_with_retry(&.scalar(*args))"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolTimeout","path":"DB/PoolTimeout.html","kind":"class","full_name":"DB::PoolTimeout","name":"PoolTimeout","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/error.cr","line_number":8,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement","path":"DB/PoolUnpreparedStatement.html","kind":"class","full_name":"DB::PoolUnpreparedStatement","name":"PoolUnpreparedStatement","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolStatement","kind":"class","full_name":"DB::PoolStatement","name":"PoolStatement"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolStatement","kind":"class","full_name":"DB::PoolStatement","name":"PoolStatement"},{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/pool_unprepared_statement.cr","line_number":7,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_unprepared_statement.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Represents a statement to be executed in any of the connections\nof the pool. The statement is not be executed in a non prepared fashion.\nThe execution of the statement is retried according to the pool configuration.\n\nSee `PoolStatement`","summary":"<p>Represents a statement to be executed in any of the connections of the pool.</p>","class_methods":[],"constructors":[{"id":"new(db:Database,query:String)-class-method","html_id":"new(db:Database,query:String)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"Database"},{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":"String"}],"args_string":"(db : Database, query : String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_unprepared_statement.cr#L8","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"Database"},{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db, query)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","path":"DB/QueryMethods.html","kind":"module","full_name":"DB::QueryMethods(Stmt)","name":"QueryMethods","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"db/query_methods.cr","line_number":20,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","kind":"module","full_name":"DB::SessionMethods(Session, Stmt)","name":"SessionMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery","kind":"struct","full_name":"DB::SessionMethods::PreparedQuery(Session, Stmt)","name":"PreparedQuery"},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery","kind":"struct","full_name":"DB::SessionMethods::UnpreparedQuery(Session, Stmt)","name":"UnpreparedQuery"}],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Methods to allow querying a database.\nAll methods accepts a `query : String` and a set arguments.\n\nThree kind of statements can be performed:\n 1. `#exec` waits no record response from the database. An `ExecResult` is returned.\n 2. `#scalar` reads a single value of the response. A union of possible values is returned.\n 3. `#query` returns a `ResultSet` that allows iteration over the rows in the response and column information.\n\nArguments can be passed by position\n\n```\ndb.query(\"SELECT name FROM ... WHERE age > ?\", age)\n```\n\nConvention of mapping how arguments are mapped to the query depends on each driver.\n\nIncluding `QueryMethods` requires a `build(query) : Statement` method that is not expected\nto be called directly.","summary":"<p>Methods to allow querying a database.</p>","class_methods":[],"constructors":[],"instance_methods":[{"id":"exec(query,*args)-instance-method","html_id":"exec(query,*args)-instance-method","name":"exec","doc":"Performs the `query` and returns an `ExecResult`","summary":"<p>Performs the <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">#query</a></code> and returns an <code><a href=\"../DB/ExecResult.html\">ExecResult</a></code></p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L262","def":{"name":"exec","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(build(query)).exec(*args)"}},{"id":"query(query,*args)-instance-method","html_id":"query(query,*args)-instance-method","name":"query","doc":"Executes a *query* and returns a `ResultSet` with the results.\nThe `ResultSet` must be closed manually.\n\n```\nresult = db.query \"select name from contacts where id = ?\", 10\nbegin\n if result.move_next\n id = result.read(Int32)\n end\nensure\n result.close\nend\n```","summary":"<p>Executes a <em>query</em> and returns a <code><a href=\"../DB/ResultSet.html\">ResultSet</a></code> with the results.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L37","def":{"name":"query","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(build(query)).query(*args)"}},{"id":"query(query,*args,&block)-instance-method","html_id":"query(query,*args,&block)-instance-method","name":"query","doc":"Executes a *query* and yields a `ResultSet` with the results.\nThe `ResultSet` is closed automatically.\n\n```\ndb.query(\"select name from contacts where age > ?\", 18) do |rs|\n rs.each do\n name = rs.read(String)\n end\nend\n```","summary":"<p>Executes a <em>query</em> and yields a <code><a href=\"../DB/ResultSet.html\">ResultSet</a></code> with the results.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args, &block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L51","def":{"name":"query","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"rs = query(query, *args)\nbegin\n yield rs\nensure\n rs.close\nend\n"}},{"id":"query_all(query,*args,astype:Class)-instance-method","html_id":"query_all(query,*args,astype:Class)-instance-method","name":"query_all","doc":"Executes a *query* and returns an array where the\nvalue of each row is read as the given *type*.\n\n```\nnames = db.query_all \"select name from contacts\", as: String\n```","summary":"<p>Executes a <em>query</em> and returns an array where the value of each row is read as the given <em>type</em>.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"as","restriction":"Class"}],"args_string":"(query, *args, as type : Class)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L239","def":{"name":"query_all","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"as","restriction":"Class"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_all(query, *args) do |rs|\n rs.read(type)\nend"}},{"id":"query_all(query,*args,astypes:NamedTuple)-instance-method","html_id":"query_all(query,*args,astypes:NamedTuple)-instance-method","name":"query_all","doc":"Executes a *query* and returns an array where each row is\nread as a named tuple of the given *types* (the keys of the named tuple\nare not necessarily the column names).\n\n```\ncontacts = db.query_all \"select name, age from contacts\", as: {name: String, age: Int32}\n```","summary":"<p>Executes a <em>query</em> and returns an array where each row is read as a named tuple of the given <em>types</em> (the keys of the named tuple are not necessarily the column names).</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"NamedTuple"}],"args_string":"(query, *args, as types : NamedTuple)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L227","def":{"name":"query_all","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"NamedTuple"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_all(query, *args) do |rs|\n rs.read(**types)\nend"}},{"id":"query_all(query,*args,&block:ResultSet->U):Array(U)forallU-instance-method","html_id":"query_all(query,*args,&block:ResultSet->U):Array(U)forallU-instance-method","name":"query_all","doc":"Executes a *query* and yield a `ResultSet` positioned at the beginning\nof each row, returning an array of the values of the blocks.\n\n```\nnames = db.query_all \"select name from contacts\", &.read(String)\n```","summary":"<p>Executes a <em>query</em> and yield a <code><a href=\"../DB/ResultSet.html\">ResultSet</a></code> positioned at the beginning of each row, returning an array of the values of the blocks.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args, &block : ResultSet -> U) : Array(U) forall U","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L200","def":{"name":"query_all","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":1,"block_arg":{"name":"block","doc":null,"default_value":"","external_name":"block","restriction":"(ResultSet -> U)"},"return_type":"Array(U)","visibility":"Public","body":"ary = [] of U\nquery_each(query, *args) do |rs|\n ary.push(yield rs)\nend\nary\n"}},{"id":"query_all(query,*args,astypes:Tuple)-instance-method","html_id":"query_all(query,*args,astypes:Tuple)-instance-method","name":"query_all","doc":"Executes a *query* and returns an array where each row is\nread as a tuple of the given *types*.\n\n```\ncontacts = db.query_all \"select name, age from contacts\", as: {String, Int32}\n```","summary":"<p>Executes a <em>query</em> and returns an array where each row is read as a tuple of the given <em>types</em>.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"Tuple"}],"args_string":"(query, *args, as types : Tuple)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L214","def":{"name":"query_all","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"Tuple"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_all(query, *args) do |rs|\n rs.read(*types)\nend"}},{"id":"query_each(query,*args,&block)-instance-method","html_id":"query_each(query,*args,&block)-instance-method","name":"query_each","doc":"Executes a *query* and yields the `ResultSet` once per each row.\nThe `ResultSet` is closed automatically.\n\n```\ndb.query_each \"select name from contacts\" do |rs|\n puts rs.read(String)\nend\n```","summary":"<p>Executes a <em>query</em> and yields the <code><a href=\"../DB/ResultSet.html\">ResultSet</a></code> once per each row.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args, &block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L253","def":{"name":"query_each","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"query(query, *args) do |rs|\n rs.each do\n yield rs\n end\nend"}},{"id":"query_one(query,*args,&block:ResultSet->U):UforallU-instance-method","html_id":"query_one(query,*args,&block:ResultSet->U):UforallU-instance-method","name":"query_one","doc":"Executes a *query* that expects a single row and yields a `ResultSet`\npositioned at that first row.\n\nThe given block must not invoke `move_next` on the yielded result set.\n\nRaises `DB::Error` if there were no rows, or if there were more than one row.\n\n```\nname = db.query_one \"select name from contacts where id = ?\", 18, &.read(String)\n```","summary":"<p>Executes a <em>query</em> that expects a single row and yields a <code><a href=\"../DB/ResultSet.html\">ResultSet</a></code> positioned at that first row.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args, &block : ResultSet -> U) : U forall U","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L67","def":{"name":"query_one","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":1,"block_arg":{"name":"block","doc":null,"default_value":"","external_name":"block","restriction":"(ResultSet -> U)"},"return_type":"U","visibility":"Public","body":"query(query, *args) do |rs|\n if rs.move_next\n else\n raise(DB::Error.new(\"no rows\"))\n end\n value = yield rs\n if rs.move_next\n raise(DB::Error.new(\"more than one row\"))\n end\n return value\nend"}},{"id":"query_one(query,*args,astypes:Tuple)-instance-method","html_id":"query_one(query,*args,astypes:Tuple)-instance-method","name":"query_one","doc":"Executes a *query* that expects a single row and returns it\nas a tuple of the given *types*.\n\nRaises `DB::Error` if there were no rows, or if there were more than one row.\n\n```\ndb.query_one \"select name, age from contacts where id = ?\", 1, as: {String, Int32}\n```","summary":"<p>Executes a <em>query</em> that expects a single row and returns it as a tuple of the given <em>types</em>.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"Tuple"}],"args_string":"(query, *args, as types : Tuple)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L85","def":{"name":"query_one","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"Tuple"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_one(query, *args) do |rs|\n rs.read(*types)\nend"}},{"id":"query_one(query,*args,astypes:NamedTuple)-instance-method","html_id":"query_one(query,*args,astypes:NamedTuple)-instance-method","name":"query_one","doc":"Executes a *query* that expects a single row and returns it\nas a named tuple of the given *types* (the keys of the named tuple\nare not necessarily the column names).\n\nRaises `DB::Error` if there were no rows, or if there were more than one row.\n\n```\ndb.query_one \"select name, age from contacts where id = ?\", 1, as: {name: String, age: Int32}\n```","summary":"<p>Executes a <em>query</em> that expects a single row and returns it as a named tuple of the given <em>types</em> (the keys of the named tuple are not necessarily the column names).</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"NamedTuple"}],"args_string":"(query, *args, as types : NamedTuple)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L100","def":{"name":"query_one","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"NamedTuple"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_one(query, *args) do |rs|\n rs.read(**types)\nend"}},{"id":"query_one(query,*args,astype:Class)-instance-method","html_id":"query_one(query,*args,astype:Class)-instance-method","name":"query_one","doc":"Executes a *query* that expects a single row\nand returns the first column's value as the given *type*.\n\nRaises `DB::Error` if there were no rows, or if there were more than one row.\n\n```\ndb.query_one \"select name from contacts where id = ?\", 1, as: String\n```","summary":"<p>Executes a <em>query</em> that expects a single row and returns the first column's value as the given <em>type</em>.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"as","restriction":"Class"}],"args_string":"(query, *args, as type : Class)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L114","def":{"name":"query_one","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"as","restriction":"Class"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_one(query, *args) do |rs|\n rs.read(type)\nend"}},{"id":"query_one?(query,*args,astype:Class)-instance-method","html_id":"query_one?(query,*args,astype:Class)-instance-method","name":"query_one?","doc":"Executes a *query* that expects a single row\nand returns the first column's value as the given *type*.\n\nReturns `nil` if there were no rows.\n\nRaises `DB::Error` if there were more than one row.\n\n```\nname = db.query_one? \"select name from contacts where id = ?\", 1, as: String\ntypeof(name) # => String?\n```","summary":"<p>Executes a <em>query</em> that expects a single row and returns the first column's value as the given <em>type</em>.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"as","restriction":"Class"}],"args_string":"(query, *args, as type : Class)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L188","def":{"name":"query_one?","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"as","restriction":"Class"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_one?(query, *args) do |rs|\n rs.read(type)\nend"}},{"id":"query_one?(query,*args,astypes:NamedTuple)-instance-method","html_id":"query_one?(query,*args,astypes:NamedTuple)-instance-method","name":"query_one?","doc":"Executes a *query* that expects a single row and returns it\nas a named tuple of the given *types* (the keys of the named tuple\nare not necessarily the column names).\n\nReturns `nil` if there were no rows.\n\nRaises `DB::Error` if there were more than one row.\n\n```\nresult = db.query_one? \"select name, age from contacts where id = ?\", 1, as: {age: String, name: Int32}\ntypeof(result) # => NamedTuple(age: String, name: Int32) | Nil\n```","summary":"<p>Executes a <em>query</em> that expects a single row and returns it as a named tuple of the given <em>types</em> (the keys of the named tuple are not necessarily the column names).</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"NamedTuple"}],"args_string":"(query, *args, as types : NamedTuple)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L171","def":{"name":"query_one?","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"NamedTuple"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_one?(query, *args) do |rs|\n rs.read(**types)\nend"}},{"id":"query_one?(query,*args,astypes:Tuple)-instance-method","html_id":"query_one?(query,*args,astypes:Tuple)-instance-method","name":"query_one?","doc":"Executes a *query* that expects a single row and returns it\nas a tuple of the given *types*.\n\nReturns `nil` if there were no rows.\n\nRaises `DB::Error` if there were more than one row.\n\n```\nresult = db.query_one? \"select name, age from contacts where id = ?\", 1, as: {String, Int32}\ntypeof(result) # => Tuple(String, Int32) | Nil\n```","summary":"<p>Executes a <em>query</em> that expects a single row and returns it as a tuple of the given <em>types</em>.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"Tuple"}],"args_string":"(query, *args, as types : Tuple)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L153","def":{"name":"query_one?","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"Tuple"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_one?(query, *args) do |rs|\n rs.read(*types)\nend"}},{"id":"query_one?(query,*args,&block:ResultSet->U):U?forallU-instance-method","html_id":"query_one?(query,*args,&block:ResultSet->U):U?forallU-instance-method","name":"query_one?","doc":"Executes a *query* that expects at most a single row and yields a `ResultSet`\npositioned at that first row.\n\nReturns `nil`, not invoking the block, if there were no rows.\n\nRaises `DB::Error` if there were more than one row\n(this ends up invoking the block once).\n\n```\nname = db.query_one? \"select name from contacts where id = ?\", 18, &.read(String)\ntypeof(name) # => String | Nil\n```","summary":"<p>Executes a <em>query</em> that expects at most a single row and yields a <code><a href=\"../DB/ResultSet.html\">ResultSet</a></code> positioned at that first row.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args, &block : ResultSet -> U) : U? forall U","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L132","def":{"name":"query_one?","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":1,"block_arg":{"name":"block","doc":null,"default_value":"","external_name":"block","restriction":"(ResultSet -> U)"},"return_type":"U | ::Nil","visibility":"Public","body":"query(query, *args) do |rs|\n if rs.move_next\n else\n return nil\n end\n value = yield rs\n if rs.move_next\n raise(DB::Error.new(\"more than one row\"))\n end\n return value\nend"}},{"id":"scalar(query,*args)-instance-method","html_id":"scalar(query,*args)-instance-method","name":"scalar","doc":"Performs the `query` and returns a single scalar value\n\n```\nputs db.scalar(\"SELECT MAX(name)\").as(String) # => (a String)\n```","summary":"<p>Performs the <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">#query</a></code> and returns a single scalar value</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L271","def":{"name":"scalar","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(build(query)).scalar(*args)"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/ResultSet","path":"DB/ResultSet.html","kind":"class","full_name":"DB::ResultSet","name":"ResultSet","abstract":true,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/result_set.cr","line_number":22,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"The response of a query performed on a `Database`.\n\nSee `DB` for a complete sample.\n\nEach `#read` call consumes the result and moves to the next column.\nEach column must be read in order.\nAt any moment a `#move_next` can be invoked, meaning to skip the\nremaining, or even all the columns, in the current row.\nAlso it is not mandatory to consume the whole `ResultSet`, hence an iteration\nthrough `#each` or `#move_next` can be stopped.\n\n**Note:** depending on how the `ResultSet` was obtained it might be mandatory an\nexplicit call to `#close`. Check `QueryMethods#query`.\n\n### Note to implementors\n\n1. Override `#move_next` to move to the next row.\n2. Override `#read` returning the next value in the row.\n3. (Optional) Override `#read(t)` for some types `t` for which custom logic other than a simple cast is needed.\n4. Override `#column_count`, `#column_name`.","summary":"<p>The response of a query performed on a <code><a href=\"../DB/Database.html\">Database</a></code>.</p>","class_methods":[],"constructors":[{"id":"new(statement:DB::Statement)-class-method","html_id":"new(statement:DB::Statement)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"statement","doc":null,"default_value":"","external_name":"statement","restriction":"DB::Statement"}],"args_string":"(statement : DB::Statement)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L28","def":{"name":"new","args":[{"name":"statement","doc":null,"default_value":"","external_name":"statement","restriction":"DB::Statement"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(statement)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"column_count:Int32-instance-method","html_id":"column_count:Int32-instance-method","name":"column_count","doc":"Returns the number of columns in the result","summary":"<p>Returns the number of columns in the result</p>","abstract":true,"args":[],"args_string":" : Int32","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L59","def":{"name":"column_count","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":""}},{"id":"column_name(index:Int32):String-instance-method","html_id":"column_name(index:Int32):String-instance-method","name":"column_name","doc":"Returns the name of the column in `index` 0-based position.","summary":"<p>Returns the name of the column in <code>index</code> 0-based position.</p>","abstract":true,"args":[{"name":"index","doc":null,"default_value":"","external_name":"index","restriction":"Int32"}],"args_string":"(index : Int32) : String","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L62","def":{"name":"column_name","args":[{"name":"index","doc":null,"default_value":"","external_name":"index","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":""}},{"id":"column_names-instance-method","html_id":"column_names-instance-method","name":"column_names","doc":"Returns the name of the columns.","summary":"<p>Returns the name of the columns.</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L65","def":{"name":"column_names","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Array(String).new(column_count) do |i|\n column_name(i)\nend"}},{"id":"each(&block)-instance-method","html_id":"each(&block)-instance-method","name":"each","doc":"Iterates over all the rows","summary":"<p>Iterates over all the rows</p>","abstract":false,"args":[],"args_string":"(&block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L38","def":{"name":"each","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":null,"return_type":"","visibility":"Public","body":"while move_next\n yield\nend"}},{"id":"each_column(&block)-instance-method","html_id":"each_column(&block)-instance-method","name":"each_column","doc":"Iterates over all the columns","summary":"<p>Iterates over all the columns</p>","abstract":false,"args":[],"args_string":"(&block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L45","def":{"name":"each_column","args":[],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"column_count.times do |x|\n yield column_name(x)\nend"}},{"id":"move_next:Bool-instance-method","html_id":"move_next:Bool-instance-method","name":"move_next","doc":"Move the next row in the result.\nReturn `false` if no more rows are available.\nSee `#each`","summary":"<p>Move the next row in the result.</p>","abstract":true,"args":[],"args_string":" : Bool","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L54","def":{"name":"move_next","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":""}},{"id":"read(type:DB::Mappable.class)-instance-method","html_id":"read(type:DB::Mappable.class)-instance-method","name":"read","doc":"Reads the next columns and maps them to a class","summary":"<p>Reads the next columns and maps them to a class</p>","abstract":false,"args":[{"name":"type","doc":null,"default_value":"","external_name":"type","restriction":"DB::Mappable.class"}],"args_string":"(type : <span class=\"t\">DB</span><span class=\"t\">::</span><span class=\"t\">Mappable</span>.<span class=\"k\">class</span>)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L73","def":{"name":"read","args":[{"name":"type","doc":null,"default_value":"","external_name":"type","restriction":"DB::Mappable.class"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"type.new(self)"}},{"id":"read(type:T.class):TforallT-instance-method","html_id":"read(type:T.class):TforallT-instance-method","name":"read","doc":"Reads the next column value as a **type**","summary":"<p>Reads the next column value as a <strong>type</strong></p>","abstract":false,"args":[{"name":"type","doc":null,"default_value":"","external_name":"type","restriction":"T.class"}],"args_string":"(type : <span class=\"t\">T</span>.<span class=\"k\">class</span>) : T forall T","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L78","def":{"name":"read","args":[{"name":"type","doc":null,"default_value":"","external_name":"type","restriction":"T.class"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"T","visibility":"Public","body":"value = read\nif value.is_a?(T)\n value\nelse\n raise(\"#{self.class}#read returned a #{value.class}. A #{T} was expected.\")\nend\n"}},{"id":"read(**types:Class)-instance-method","html_id":"read(**types:Class)-instance-method","name":"read","doc":"Reads the next columns and returns a named tuple of the values.","summary":"<p>Reads the next columns and returns a named tuple of the values.</p>","abstract":false,"args":[],"args_string":"(**types : Class)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L93","def":{"name":"read","args":[],"double_splat":{"name":"types","doc":null,"default_value":"","external_name":"types","restriction":"Class"},"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"internal_read(**types)"}},{"id":"read-instance-method","html_id":"read-instance-method","name":"read","doc":"Reads the next column value","summary":"<p>Reads the next column value</p>","abstract":true,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L70","def":{"name":"read","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"read(*types:Class)-instance-method","html_id":"read(*types:Class)-instance-method","name":"read","doc":"Reads the next columns and returns a tuple of the values.","summary":"<p>Reads the next columns and returns a tuple of the values.</p>","abstract":false,"args":[{"name":"types","doc":null,"default_value":"","external_name":"types","restriction":"Class"}],"args_string":"(*types : Class)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L88","def":{"name":"read","args":[{"name":"types","doc":null,"default_value":"","external_name":"types","restriction":"Class"}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"internal_read(*types)"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Rollback","path":"DB/Rollback.html","kind":"class","full_name":"DB::Rollback","name":"Rollback","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/error.cr","line_number":30,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/SavePointTransaction","path":"DB/SavePointTransaction.html","kind":"class","full_name":"DB::SavePointTransaction","name":"SavePointTransaction","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Transaction","kind":"class","full_name":"DB::Transaction","name":"Transaction"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Transaction","kind":"class","full_name":"DB::Transaction","name":"Transaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/BeginTransaction","kind":"module","full_name":"DB::BeginTransaction","name":"BeginTransaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/transaction.cr","line_number":94,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(parent:Transaction,savepoint_name:String)-class-method","html_id":"new(parent:Transaction,savepoint_name:String)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"parent","doc":null,"default_value":"","external_name":"parent","restriction":"Transaction"},{"name":"savepoint_name","doc":null,"default_value":"","external_name":"savepoint_name","restriction":"String"}],"args_string":"(parent : Transaction, savepoint_name : String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L97","def":{"name":"new","args":[{"name":"parent","doc":null,"default_value":"","external_name":"parent","restriction":"Transaction"},{"name":"savepoint_name","doc":null,"default_value":"","external_name":"savepoint_name","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(parent, savepoint_name)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"begin_transaction:Transaction-instance-method","html_id":"begin_transaction:Transaction-instance-method","name":"begin_transaction","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Transaction","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L117","def":{"name":"begin_transaction","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Transaction","visibility":"Public","body":"if @nested_transaction\n raise(DB::Error.new(\"There is an existing nested transaction in this transaction\"))\nend\n@nested_transaction = true\ncreate_save_point_transaction(self)\n"}},{"id":"commit-instance-method","html_id":"commit-instance-method","name":"commit","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L103","def":{"name":"commit","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@connection.perform_release_savepoint(@savepoint_name)\nsuper()\n"}},{"id":"connection:Connection-instance-method","html_id":"connection:Connection-instance-method","name":"connection","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Connection","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L97","def":{"name":"connection","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Connection","visibility":"Public","body":"@connection"}},{"id":"create_save_point_transaction(parent:Transaction)-instance-method","html_id":"create_save_point_transaction(parent:Transaction)-instance-method","name":"create_save_point_transaction","doc":null,"summary":null,"abstract":false,"args":[{"name":"parent","doc":null,"default_value":"","external_name":"parent","restriction":"Transaction"}],"args_string":"(parent : Transaction)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L123","def":{"name":"create_save_point_transaction","args":[{"name":"parent","doc":null,"default_value":"","external_name":"parent","restriction":"Transaction"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@parent.create_save_point_transaction(parent)"}},{"id":"release_from_nested_transaction-instance-method","html_id":"release_from_nested_transaction-instance-method","name":"release_from_nested_transaction","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L127","def":{"name":"release_from_nested_transaction","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@nested_transaction = false"}},{"id":"rollback-instance-method","html_id":"rollback-instance-method","name":"rollback","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L108","def":{"name":"rollback","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@connection.perform_rollback_savepoint(@savepoint_name)\nsuper()\n"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","path":"DB/SessionMethods.html","kind":"module","full_name":"DB::SessionMethods(Session, Stmt)","name":"SessionMethods","abstract":false,"superclass":null,"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"}],"locations":[{"filename":"db/session_methods.cr","line_number":10,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"}],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Connection","kind":"class","full_name":"DB::Connection","name":"Connection"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Database","kind":"class","full_name":"DB::Database","name":"Database"}],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Methods that are shared accross session like objects:\n - Database\n - Connection\n\nClasses that includes this module are able to execute\nqueries and statements in both prepared and unprepared fashion.\n\nThis module serves for dsl reuse over session like objects.","summary":"<p>Methods that are shared accross session like objects: - Database - Connection</p>","class_methods":[],"constructors":[],"instance_methods":[{"id":"build(query):Stmt-instance-method","html_id":"build(query):Stmt-instance-method","name":"build","doc":null,"summary":null,"abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"args_string":"(query) : Stmt","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L21","def":{"name":"build","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Stmt","visibility":"Public","body":"if prepared_statements?\n fetch_or_build_prepared_statement(query)\nelse\n build_unprepared_statement(query)\nend"}},{"id":"build_unprepared_statement(query):Stmt-instance-method","html_id":"build_unprepared_statement(query):Stmt-instance-method","name":"build_unprepared_statement","doc":null,"summary":null,"abstract":true,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"args_string":"(query) : Stmt","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L19","def":{"name":"build_unprepared_statement","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Stmt","visibility":"Public","body":""}},{"id":"fetch_or_build_prepared_statement(query):Stmt-instance-method","html_id":"fetch_or_build_prepared_statement(query):Stmt-instance-method","name":"fetch_or_build_prepared_statement","doc":null,"summary":null,"abstract":true,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"args_string":"(query) : Stmt","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L17","def":{"name":"fetch_or_build_prepared_statement","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Stmt","visibility":"Public","body":""}},{"id":"prepared(query)-instance-method","html_id":"prepared(query)-instance-method","name":"prepared","doc":"Returns a prepared `Statement` that has not been executed yet.","summary":"<p>Returns a prepared <code><a href=\"../DB/Statement.html\">Statement</a></code> that has not been executed yet.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"args_string":"(query)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L36","def":{"name":"prepared","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"prepared.build(query)"}},{"id":"prepared-instance-method","html_id":"prepared-instance-method","name":"prepared","doc":"dsl helper to build prepared statements\nreturns a value that includes `QueryMethods`","summary":"<p>dsl helper to build prepared statements returns a value that includes <code><a href=\"../DB/QueryMethods.html\">QueryMethods</a></code></p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L31","def":{"name":"prepared","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"PreparedQuery(Session, Stmt).new(self)"}},{"id":"prepared_statements?:Bool-instance-method","html_id":"prepared_statements?:Bool-instance-method","name":"prepared_statements?","doc":"Returns whether by default the statements should\nbe prepared or not.","summary":"<p>Returns whether by default the statements should be prepared or not.</p>","abstract":true,"args":[],"args_string":" : Bool","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L15","def":{"name":"prepared_statements?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":""}},{"id":"unprepared(query)-instance-method","html_id":"unprepared(query)-instance-method","name":"unprepared","doc":"Returns an unprepared `Statement` that has not been executed yet.","summary":"<p>Returns an unprepared <code><a href=\"../DB/Statement.html\">Statement</a></code> that has not been executed yet.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"args_string":"(query)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L47","def":{"name":"unprepared","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"unprepared.build(query)"}},{"id":"unprepared-instance-method","html_id":"unprepared-instance-method","name":"unprepared","doc":"dsl helper to build unprepared statements\nreturns a value that includes `QueryMethods`","summary":"<p>dsl helper to build unprepared statements returns a value that includes <code><a href=\"../DB/QueryMethods.html\">QueryMethods</a></code></p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L42","def":{"name":"unprepared","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"UnpreparedQuery(Session, Stmt).new(self)"}}],"macros":[],"types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery","path":"DB/SessionMethods/PreparedQuery.html","kind":"struct","full_name":"DB::SessionMethods::PreparedQuery(Session, Stmt)","name":"PreparedQuery","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"},{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"github.com/crystal-lang/crystal-db/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/session_methods.cr","line_number":51,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","kind":"module","full_name":"DB::SessionMethods(Session, Stmt)","name":"SessionMethods"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(session:Session)-class-method","html_id":"new(session:Session)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"session","doc":null,"default_value":"","external_name":"session","restriction":"Session"}],"args_string":"(session : Session)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L54","def":{"name":"new","args":[{"name":"session","doc":null,"default_value":"","external_name":"session","restriction":"Session"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = PreparedQuery(Session, Stmt).allocate\n_.initialize(session)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"build(query):Stmt-instance-method","html_id":"build(query):Stmt-instance-method","name":"build","doc":null,"summary":null,"abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"args_string":"(query) : Stmt","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L57","def":{"name":"build","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Stmt","visibility":"Public","body":"@session.fetch_or_build_prepared_statement(query)"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery","path":"DB/SessionMethods/UnpreparedQuery.html","kind":"struct","full_name":"DB::SessionMethods::UnpreparedQuery(Session, Stmt)","name":"UnpreparedQuery","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"},{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"github.com/crystal-lang/crystal-db/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/session_methods.cr","line_number":62,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","kind":"module","full_name":"DB::SessionMethods(Session, Stmt)","name":"SessionMethods"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(session:Session)-class-method","html_id":"new(session:Session)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"session","doc":null,"default_value":"","external_name":"session","restriction":"Session"}],"args_string":"(session : Session)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L65","def":{"name":"new","args":[{"name":"session","doc":null,"default_value":"","external_name":"session","restriction":"Session"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = UnpreparedQuery(Session, Stmt).allocate\n_.initialize(session)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"build(query):Stmt-instance-method","html_id":"build(query):Stmt-instance-method","name":"build","doc":null,"summary":null,"abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"args_string":"(query) : Stmt","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L68","def":{"name":"build","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Stmt","visibility":"Public","body":"@session.build_unprepared_statement(query)"}}],"macros":[],"types":[]}]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Statement","path":"DB/Statement.html","kind":"class","full_name":"DB::Statement","name":"Statement","abstract":true,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/statement.cr","line_number":52,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Represents a query in a `Connection`.\nIt should be created by `QueryMethods`.\n\n### Note to implementors\n\n1. Subclass `Statements`\n2. `Statements` are created from a custom driver `Connection#prepare` method.\n3. `#perform_query` executes a query that is expected to return a `ResultSet`\n4. `#perform_exec` executes a query that is expected to return an `ExecResult`\n6. `#do_close` is called to release the statement resources.","summary":"<p>Represents a query in a <code><a href=\"../DB/Connection.html\">Connection</a></code>.</p>","class_methods":[],"constructors":[{"id":"new(connection:Connection)-class-method","html_id":"new(connection:Connection)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"args_string":"(connection : Connection)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L58","def":{"name":"new","args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(connection)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"exec(args:Array):DB::ExecResult-instance-method","html_id":"exec(args:Array):DB::ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"args_string":"(args : Array) : DB::ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L71","def":{"name":"exec","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"DB::ExecResult","visibility":"Public","body":"perform_exec_and_release(args)"}},{"id":"exec:DB::ExecResult-instance-method","html_id":"exec:DB::ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":false,"args":[],"args_string":" : DB::ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L66","def":{"name":"exec","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"DB::ExecResult","visibility":"Public","body":"perform_exec_and_release(Slice(Any).empty)"}},{"id":"exec(*args)-instance-method","html_id":"exec(*args)-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L76","def":{"name":"exec","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"perform_exec_and_release(args)"}},{"id":"query(args:Array):DB::ResultSet-instance-method","html_id":"query(args:Array):DB::ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"args_string":"(args : Array) : DB::ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L87","def":{"name":"query","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"DB::ResultSet","visibility":"Public","body":"perform_query_with_rescue(args)"}},{"id":"query:DB::ResultSet-instance-method","html_id":"query:DB::ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":false,"args":[],"args_string":" : DB::ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L82","def":{"name":"query","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"DB::ResultSet","visibility":"Public","body":"perform_query_with_rescue(Tuple.new)"}},{"id":"query(*args)-instance-method","html_id":"query(*args)-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L92","def":{"name":"query","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"perform_query_with_rescue(args)"}},{"id":"release_connection-instance-method","html_id":"release_connection-instance-method","name":"release_connection","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L61","def":{"name":"release_connection","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@connection.release_from_statement"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","path":"DB/StatementMethods.html","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods","abstract":false,"superclass":null,"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"}],"locations":[{"filename":"db/statement.cr","line_number":4,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"}],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolStatement","kind":"class","full_name":"DB::PoolStatement","name":"PoolStatement"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Statement","kind":"class","full_name":"DB::Statement","name":"Statement"}],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Common interface for connection based statements\nand for connection pool statements.","summary":"<p>Common interface for connection based statements and for connection pool statements.</p>","class_methods":[],"constructors":[],"instance_methods":[{"id":"exec(args:Array):ExecResult-instance-method","html_id":"exec(args:Array):ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":true,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"args_string":"(args : Array) : ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L32","def":{"name":"exec","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ExecResult","visibility":"Public","body":""}},{"id":"exec:ExecResult-instance-method","html_id":"exec:ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":true,"args":[],"args_string":" : ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L28","def":{"name":"exec","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ExecResult","visibility":"Public","body":""}},{"id":"exec(*args):ExecResult-instance-method","html_id":"exec(*args):ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":true,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args) : ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L30","def":{"name":"exec","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"ExecResult","visibility":"Public","body":""}},{"id":"query(*args,&block)-instance-method","html_id":"query(*args,&block)-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, &block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L22","def":{"name":"query","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"rs = query(*args)\nbegin\n yield rs\nensure\n rs.close\nend\n"}},{"id":"query(args:Array):ResultSet-instance-method","html_id":"query(args:Array):ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":true,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"args_string":"(args : Array) : ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L39","def":{"name":"query","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ResultSet","visibility":"Public","body":""}},{"id":"query:ResultSet-instance-method","html_id":"query:ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":true,"args":[],"args_string":" : ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L35","def":{"name":"query","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ResultSet","visibility":"Public","body":""}},{"id":"query(*args):ResultSet-instance-method","html_id":"query(*args):ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":true,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args) : ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L37","def":{"name":"query","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"ResultSet","visibility":"Public","body":""}},{"id":"scalar(*args)-instance-method","html_id":"scalar(*args)-instance-method","name":"scalar","doc":"See `QueryMethods#scalar`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#scalar(query,*args)-instance-method\">QueryMethods#scalar</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L11","def":{"name":"scalar","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query(*args) do |rs|\n rs.each do\n return rs.read\n end\nend\nraise(\"no results\")\n"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/StringKeyCache","path":"DB/StringKeyCache.html","kind":"class","full_name":"DB::StringKeyCache(T)","name":"StringKeyCache","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/string_key_cache.cr","line_number":2,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/string_key_cache.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"id":"clear-instance-method","html_id":"clear-instance-method","name":"clear","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/string_key_cache.cr#L17","def":{"name":"clear","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@cache.clear"}},{"id":"each_value(&block)-instance-method","html_id":"each_value(&block)-instance-method","name":"each_value","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/string_key_cache.cr#L11","def":{"name":"each_value","args":[],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@cache.each do |_, value|\n yield value\nend"}},{"id":"fetch(key:String,&block):T-instance-method","html_id":"fetch(key:String,&block):T-instance-method","name":"fetch","doc":null,"summary":null,"abstract":false,"args":[{"name":"key","doc":null,"default_value":"","external_name":"key","restriction":"String"}],"args_string":"(key : String, &block) : T","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/string_key_cache.cr#L5","def":{"name":"fetch","args":[{"name":"key","doc":null,"default_value":"","external_name":"key","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":0,"block_arg":null,"return_type":"T","visibility":"Public","body":"value = @cache.fetch(key, nil)\nif value\nelse\n value = @cache[key] = yield\nend\nvalue\n"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/TopLevelTransaction","path":"DB/TopLevelTransaction.html","kind":"class","full_name":"DB::TopLevelTransaction","name":"TopLevelTransaction","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Transaction","kind":"class","full_name":"DB::Transaction","name":"Transaction"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Transaction","kind":"class","full_name":"DB::Transaction","name":"Transaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/BeginTransaction","kind":"module","full_name":"DB::BeginTransaction","name":"BeginTransaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/transaction.cr","line_number":38,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(connection:Connection)-class-method","html_id":"new(connection:Connection)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"args_string":"(connection : Connection)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L43","def":{"name":"new","args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(connection)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"begin_transaction:Transaction-instance-method","html_id":"begin_transaction:Transaction-instance-method","name":"begin_transaction","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Transaction","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L62","def":{"name":"begin_transaction","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Transaction","visibility":"Public","body":"if @nested_transaction\n raise(DB::Error.new(\"There is an existing nested transaction in this transaction\"))\nend\n@nested_transaction = true\ncreate_save_point_transaction(self)\n"}},{"id":"commit-instance-method","html_id":"commit-instance-method","name":"commit","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L48","def":{"name":"commit","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@connection.perform_commit_transaction\nsuper()\n"}},{"id":"connection:Connection-instance-method","html_id":"connection:Connection-instance-method","name":"connection","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Connection","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L41","def":{"name":"connection","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Connection","visibility":"Public","body":"@connection"}},{"id":"rollback-instance-method","html_id":"rollback-instance-method","name":"rollback","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L53","def":{"name":"rollback","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@connection.perform_rollback_transaction\nsuper()\n"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Transaction","path":"DB/Transaction.html","kind":"class","full_name":"DB::Transaction","name":"Transaction","abstract":true,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/BeginTransaction","kind":"module","full_name":"DB::BeginTransaction","name":"BeginTransaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/transaction.cr","line_number":14,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/BeginTransaction","kind":"module","full_name":"DB::BeginTransaction","name":"BeginTransaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"}],"extended_modules":[],"subclasses":[{"html_id":"github.com/crystal-lang/crystal-db/DB/SavePointTransaction","kind":"class","full_name":"DB::SavePointTransaction","name":"SavePointTransaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/TopLevelTransaction","kind":"class","full_name":"DB::TopLevelTransaction","name":"TopLevelTransaction"}],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Transactions should be started from `DB#transaction`, `Connection#transaction`\nor `Connection#begin_transaction`.\n\nUse `Transaction#connection` to submit statements to the database.\n\nUse `Transaction#commit` or `Transaction#rollback` to close the ongoing transaction\nexplicitly. Or refer to `BeginTransaction#transaction` for documentation on how to\nuse `#transaction(&block)` methods in `DB` and `Connection`.\n\nNested transactions are supported by using sql `SAVEPOINT`. To start a nested\ntransaction use `Transaction#transaction` or `Transaction#begin_transaction`.\n","summary":"<p>Transactions should be started from <code>DB#transaction</code>, <code>Connection#transaction</code> or <code><a href=\"../DB/Connection.html#begin_transaction:Transaction-instance-method\">Connection#begin_transaction</a></code>.</p>","class_methods":[],"constructors":[],"instance_methods":[{"id":"commit-instance-method","html_id":"commit-instance-method","name":"commit","doc":"commits the current transaction","summary":"<p>commits the current transaction</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L21","def":{"name":"commit","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"close!"}},{"id":"connection:Connection-instance-method","html_id":"connection:Connection-instance-method","name":"connection","doc":null,"summary":null,"abstract":true,"args":[],"args_string":" : Connection","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L18","def":{"name":"connection","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Connection","visibility":"Public","body":""}},{"id":"release_from_nested_transaction-instance-method","html_id":"release_from_nested_transaction-instance-method","name":"release_from_nested_transaction","doc":null,"summary":null,"abstract":true,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L35","def":{"name":"release_from_nested_transaction","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"rollback-instance-method","html_id":"rollback-instance-method","name":"rollback","doc":"rollbacks the current transaction","summary":"<p>rollbacks the current transaction</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L26","def":{"name":"rollback","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"close!"}}],"macros":[],"types":[]}]}]}} \ No newline at end of file diff --git a/api/0.6.0/js/doc.js b/api/0.6.0/js/doc.js new file mode 100644 index 0000000..8796e74 --- /dev/null +++ b/api/0.6.0/js/doc.js @@ -0,0 +1,1019 @@ +window.CrystalDoc = (window.CrystalDoc || {}); + +CrystalDoc.base_path = (CrystalDoc.base_path || ""); + +CrystalDoc.searchIndex = (CrystalDoc.searchIndex || false); +CrystalDoc.MAX_RESULTS_DISPLAY = 140; + +CrystalDoc.runQuery = function(query) { + function searchType(type, query, results) { + var matches = []; + var matchedFields = []; + var name = type.full_name; + var i = name.lastIndexOf("::"); + if (i > 0) { + name = name.substring(i + 2); + } + var nameMatches = query.matches(name); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + + var namespaceMatches = query.matchesNamespace(type.full_name); + if(namespaceMatches){ + matches = matches.concat(namespaceMatches); + matchedFields.push("name"); + } + + var docMatches = query.matches(type.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + if (matches.length > 0) { + results.push({ + id: type.id, + result_type: "type", + kind: type.kind, + name: name, + full_name: type.full_name, + href: type.path, + summary: type.summary, + matched_fields: matchedFields, + matched_terms: matches + }); + } + + type.instance_methods.forEach(function(method) { + searchMethod(method, type, "instance_method", query, results); + }) + type.class_methods.forEach(function(method) { + searchMethod(method, type, "class_method", query, results); + }) + type.constructors.forEach(function(constructor) { + searchMethod(constructor, type, "constructor", query, results); + }) + type.macros.forEach(function(macro) { + searchMethod(macro, type, "macro", query, results); + }) + type.constants.forEach(function(constant){ + searchConstant(constant, type, query, results); + }); + + type.types.forEach(function(subtype){ + searchType(subtype, query, results); + }); + }; + + function searchMethod(method, type, kind, query, results) { + var matches = []; + var matchedFields = []; + var nameMatches = query.matchesMethod(method.name, kind, type); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + + method.args.forEach(function(arg){ + var argMatches = query.matches(arg.external_name); + if (argMatches) { + matches = matches.concat(argMatches); + matchedFields.push("args"); + } + }); + + var docMatches = query.matches(type.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + + if (matches.length > 0) { + var typeMatches = query.matches(type.full_name); + if (typeMatches) { + matchedFields.push("type"); + matches = matches.concat(typeMatches); + } + results.push({ + id: method.id, + type: type.full_name, + result_type: kind, + name: method.name, + full_name: type.full_name + "#" + method.name, + args_string: method.args_string, + summary: method.summary, + href: type.path + "#" + method.id, + matched_fields: matchedFields, + matched_terms: matches + }); + } + } + + function searchConstant(constant, type, query, results) { + var matches = []; + var matchedFields = []; + var nameMatches = query.matches(constant.name); + if (nameMatches){ + matches = matches.concat(nameMatches); + matchedFields.push("name"); + } + var docMatches = query.matches(constant.doc); + if(docMatches){ + matches = matches.concat(docMatches); + matchedFields.push("doc"); + } + if (matches.length > 0) { + var typeMatches = query.matches(type.full_name); + if (typeMatches) { + matchedFields.push("type"); + matches = matches.concat(typeMatches); + } + results.push({ + id: constant.id, + type: type.full_name, + result_type: "constant", + name: constant.name, + full_name: type.full_name + "#" + constant.name, + value: constant.value, + summary: constant.summary, + href: type.path + "#" + constant.id, + matched_fields: matchedFields, + matched_terms: matches + }); + } + } + + var results = []; + searchType(CrystalDoc.searchIndex.program, query, results); + return results; +}; + +CrystalDoc.rankResults = function(results, query) { + function uniqueArray(ar) { + var j = {}; + + ar.forEach(function(v) { + j[v + "::" + typeof v] = v; + }); + + return Object.keys(j).map(function(v) { + return j[v]; + }); + } + + results = results.sort(function(a, b) { + var matchedTermsDiff = uniqueArray(b.matched_terms).length - uniqueArray(a.matched_terms).length; + var aHasDocs = b.matched_fields.includes("doc"); + var bHasDocs = b.matched_fields.includes("doc"); + + var aOnlyDocs = aHasDocs && a.matched_fields.length == 1; + var bOnlyDocs = bHasDocs && b.matched_fields.length == 1; + + if (a.result_type == "type" && b.result_type != "type" && !aOnlyDocs) { + if(CrystalDoc.DEBUG) { console.log("a is type b not"); } + return -1; + } else if (b.result_type == "type" && a.result_type != "type" && !bOnlyDocs) { + if(CrystalDoc.DEBUG) { console.log("b is type, a not"); } + return 1; + } + if (a.matched_fields.includes("name")) { + if (b.matched_fields.includes("name")) { + var a_name = (CrystalDoc.prefixForType(a.result_type) || "") + ((a.result_type == "type") ? a.full_name : a.name); + var b_name = (CrystalDoc.prefixForType(b.result_type) || "") + ((b.result_type == "type") ? b.full_name : b.name); + a_name = a_name.toLowerCase(); + b_name = b_name.toLowerCase(); + for(var i = 0; i < query.normalizedTerms.length; i++) { + var term = query.terms[i].replace(/^::?|::?$/, ""); + var a_orig_index = a_name.indexOf(term); + var b_orig_index = b_name.indexOf(term); + if(CrystalDoc.DEBUG) { console.log("term: " + term + " a: " + a_name + " b: " + b_name); } + if(CrystalDoc.DEBUG) { console.log(a_orig_index, b_orig_index, a_orig_index - b_orig_index); } + if (a_orig_index >= 0) { + if (b_orig_index >= 0) { + if(CrystalDoc.DEBUG) { console.log("both have exact match", a_orig_index > b_orig_index ? -1 : 1); } + if(a_orig_index != b_orig_index) { + if(CrystalDoc.DEBUG) { console.log("both have exact match at different positions", a_orig_index > b_orig_index ? 1 : -1); } + return a_orig_index > b_orig_index ? 1 : -1; + } + } else { + if(CrystalDoc.DEBUG) { console.log("a has exact match, b not"); } + return -1; + } + } else if (b_orig_index >= 0) { + if(CrystalDoc.DEBUG) { console.log("b has exact match, a not"); } + return 1; + } + } + } else { + if(CrystalDoc.DEBUG) { console.log("a has match in name, b not"); } + return -1; + } + } else if ( + !a.matched_fields.includes("name") && + b.matched_fields.includes("name") + ) { + return 1; + } + + if (matchedTermsDiff != 0 || (aHasDocs != bHasDocs)) { + if(CrystalDoc.DEBUG) { console.log("matchedTermsDiff: " + matchedTermsDiff, aHasDocs, bHasDocs); } + return matchedTermsDiff; + } + + var matchedFieldsDiff = b.matched_fields.length - a.matched_fields.length; + if (matchedFieldsDiff != 0) { + if(CrystalDoc.DEBUG) { console.log("matched to different number of fields: " + matchedFieldsDiff); } + return matchedFieldsDiff > 0 ? 1 : -1; + } + + var nameCompare = a.name.localeCompare(b.name); + if(nameCompare != 0){ + if(CrystalDoc.DEBUG) { console.log("nameCompare resulted in: " + a.name + "<=>" + b.name + ": " + nameCompare); } + return nameCompare > 0 ? 1 : -1; + } + + if(a.matched_fields.includes("args") && b.matched_fields.includes("args")) { + for(var i = 0; i < query.terms.length; i++) { + var term = query.terms[i]; + var aIndex = a.args_string.indexOf(term); + var bIndex = b.args_string.indexOf(term); + if(CrystalDoc.DEBUG) { console.log("index of " + term + " in args_string: " + aIndex + " - " + bIndex); } + if(aIndex >= 0){ + if(bIndex >= 0){ + if(aIndex != bIndex){ + return aIndex > bIndex ? 1 : -1; + } + }else{ + return -1; + } + }else if(bIndex >= 0) { + return 1; + } + } + } + + return 0; + }); + + if (results.length > 1) { + // if we have more than two search terms, only include results with the most matches + var bestMatchedTerms = uniqueArray(results[0].matched_terms).length; + + results = results.filter(function(result) { + return uniqueArray(result.matched_terms).length + 1 >= bestMatchedTerms; + }); + } + return results; +}; + +CrystalDoc.prefixForType = function(type) { + switch (type) { + case "instance_method": + return "#"; + + case "class_method": + case "macro": + case "constructor": + return "."; + + default: + return false; + } +}; + +CrystalDoc.displaySearchResults = function(results, query) { + function sanitize(html){ + return html.replace(/<(?!\/?code)[^>]+>/g, ""); + } + + // limit results + if (results.length > CrystalDoc.MAX_RESULTS_DISPLAY) { + results = results.slice(0, CrystalDoc.MAX_RESULTS_DISPLAY); + } + + var $frag = document.createDocumentFragment(); + var $resultsElem = document.querySelector(".search-list"); + $resultsElem.innerHTML = "<!--" + JSON.stringify(query) + "-->"; + + results.forEach(function(result, i) { + var url = CrystalDoc.base_path + result.href; + var type = false; + + var title = query.highlight(result.result_type == "type" ? result.full_name : result.name); + + var prefix = CrystalDoc.prefixForType(result.result_type); + if (prefix) { + title = "<b>" + prefix + "</b>" + title; + } + + title = "<strong>" + title + "</strong>"; + + if (result.args_string) { + title += + "<span class=\"args\">" + query.highlight(result.args_string) + "</span>"; + } + + $elem = document.createElement("li"); + $elem.className = "search-result search-result--" + result.result_type; + $elem.dataset.href = url; + $elem.setAttribute("title", result.full_name + " docs page"); + + var $title = document.createElement("div"); + $title.setAttribute("class", "search-result__title"); + var $titleLink = document.createElement("a"); + $titleLink.setAttribute("href", url); + + $titleLink.innerHTML = title; + $title.appendChild($titleLink); + $elem.appendChild($title); + $elem.addEventListener("click", function() { + $titleLink.click(); + }); + + if (result.result_type !== "type") { + var $type = document.createElement("div"); + $type.setAttribute("class", "search-result__type"); + $type.innerHTML = query.highlight(result.type); + $elem.appendChild($type); + } + + if(result.summary){ + var $doc = document.createElement("div"); + $doc.setAttribute("class", "search-result__doc"); + $doc.innerHTML = query.highlight(sanitize(result.summary)); + $elem.appendChild($doc); + } + + $elem.appendChild(document.createComment(JSON.stringify(result))); + $frag.appendChild($elem); + }); + + $resultsElem.appendChild($frag); + + CrystalDoc.toggleResultsList(true); +}; + +CrystalDoc.toggleResultsList = function(visible) { + if (visible) { + document.querySelector(".types-list").classList.add("hidden"); + document.querySelector(".search-results").classList.remove("hidden"); + } else { + document.querySelector(".types-list").classList.remove("hidden"); + document.querySelector(".search-results").classList.add("hidden"); + } +}; + +CrystalDoc.Query = function(string) { + this.original = string; + this.terms = string.split(/\s+/).filter(function(word) { + return CrystalDoc.Query.stripModifiers(word).length > 0; + }); + + var normalized = this.terms.map(CrystalDoc.Query.normalizeTerm); + this.normalizedTerms = normalized; + + function runMatcher(field, matcher) { + if (!field) { + return false; + } + var normalizedValue = CrystalDoc.Query.normalizeTerm(field); + + var matches = []; + normalized.forEach(function(term) { + if (matcher(normalizedValue, term)) { + matches.push(term); + } + }); + return matches.length > 0 ? matches : false; + } + + this.matches = function(field) { + return runMatcher(field, function(normalized, term) { + if (term[0] == "#" || term[0] == ".") { + return false; + } + return normalized.indexOf(term) >= 0; + }); + }; + + function namespaceMatcher(normalized, term){ + var i = term.indexOf(":"); + if(i >= 0){ + term = term.replace(/^::?|::?$/, ""); + var index = normalized.indexOf(term); + if((index == 0) || (index > 0 && normalized[index-1] == ":")){ + return true; + } + } + return false; + } + this.matchesMethod = function(name, kind, type) { + return runMatcher(name, function(normalized, term) { + var i = term.indexOf("#"); + if(i >= 0){ + if (kind != "instance_method") { + return false; + } + }else{ + i = term.indexOf("."); + if(i >= 0){ + if (kind != "class_method" && kind != "macro" && kind != "constructor") { + return false; + } + }else{ + //neither # nor . + if(term.indexOf(":") && namespaceMatcher(normalized, term)){ + return true; + } + } + } + + var methodName = term; + if(i >= 0){ + var termType = term.substring(0, i); + methodName = term.substring(i+1); + + if(termType != "") { + if(CrystalDoc.Query.normalizeTerm(type.full_name).indexOf(termType) < 0){ + return false; + } + } + } + return normalized.indexOf(methodName) >= 0; + }); + }; + + this.matchesNamespace = function(namespace){ + return runMatcher(namespace, namespaceMatcher); + }; + + this.highlight = function(string) { + if (typeof string == "undefined") { + return ""; + } + function escapeRegExp(s) { + return s.replace(/[.*+?\^${}()|\[\]\\]/g, "\\$&").replace(/^[#\.:]+/, ""); + } + return string.replace( + new RegExp("(" + this.normalizedTerms.map(escapeRegExp).join("|") + ")", "gi"), + "<mark>$1</mark>" + ); + }; +}; +CrystalDoc.Query.normalizeTerm = function(term) { + return term.toLowerCase(); +}; +CrystalDoc.Query.stripModifiers = function(term) { + switch (term[0]) { + case "#": + case ".": + case ":": + return term.substr(1); + + default: + return term; + } +} + +CrystalDoc.search = function(string) { + if(!CrystalDoc.searchIndex) { + console.log("CrystalDoc search index not initialized, delaying search"); + + document.addEventListener("CrystalDoc:loaded", function listener(){ + document.removeEventListener("CrystalDoc:loaded", listener); + CrystalDoc.search(string); + }); + return; + } + + document.dispatchEvent(new Event("CrystalDoc:searchStarted")); + + var query = new CrystalDoc.Query(string); + var results = CrystalDoc.runQuery(query); + results = CrystalDoc.rankResults(results, query); + CrystalDoc.displaySearchResults(results, query); + + document.dispatchEvent(new Event("CrystalDoc:searchPerformed")); +}; + +CrystalDoc.initializeIndex = function(data) { + CrystalDoc.searchIndex = data; + + document.dispatchEvent(new Event("CrystalDoc:loaded")); +}; + +CrystalDoc.loadIndex = function() { + function loadJSON(file, callback) { + var xobj = new XMLHttpRequest(); + xobj.overrideMimeType("application/json"); + xobj.open("GET", file, true); + xobj.onreadystatechange = function() { + if (xobj.readyState == 4 && xobj.status == "200") { + callback(xobj.responseText); + } + }; + xobj.send(null); + } + + function loadScript(file) { + script = document.createElement("script"); + script.src = file; + document.body.appendChild(script); + } + + function parseJSON(json) { + CrystalDoc.initializeIndex(JSON.parse(json)); + } + + for(var i = 0; i < document.scripts.length; i++){ + var script = document.scripts[i]; + if (script.src && script.src.indexOf("js/doc.js") >= 0) { + if (script.src.indexOf("file://") == 0) { + // We need to support JSONP files for the search to work on local file system. + var jsonPath = script.src.replace("js/doc.js", "search-index.js"); + loadScript(jsonPath); + return; + } else { + var jsonPath = script.src.replace("js/doc.js", "index.json"); + loadJSON(jsonPath, parseJSON); + return; + } + } + } + console.error("Could not find location of js/doc.js"); +}; + +// Callback for jsonp +function crystal_doc_search_index_callback(data) { + CrystalDoc.initializeIndex(data); +} + +Navigator = function(sidebar, searchInput, list, leaveSearchScope){ + this.list = list; + var self = this; + + var performingSearch = false; + + document.addEventListener('CrystalDoc:searchStarted', function(){ + performingSearch = true; + }); + document.addEventListener('CrystalDoc:searchDebounceStarted', function(){ + performingSearch = true; + }); + document.addEventListener('CrystalDoc:searchPerformed', function(){ + performingSearch = false; + }); + document.addEventListener('CrystalDoc:searchDebounceStopped', function(event){ + performingSearch = false; + }); + + function delayWhileSearching(callback) { + if(performingSearch){ + document.addEventListener('CrystalDoc:searchPerformed', function listener(){ + document.removeEventListener('CrystalDoc:searchPerformed', listener); + + // add some delay to let search results display kick in + setTimeout(callback, 100); + }); + }else{ + callback(); + } + } + + function clearMoveTimeout() { + clearTimeout(self.moveTimeout); + self.moveTimeout = null; + } + + function startMoveTimeout(upwards){ + /*if(self.moveTimeout) { + clearMoveTimeout(); + } + + var go = function() { + if (!self.moveTimeout) return; + self.move(upwards); + self.moveTimout = setTimeout(go, 600); + }; + self.moveTimeout = setTimeout(go, 800);*/ + } + + function scrollCenter(element) { + var rect = element.getBoundingClientRect(); + var middle = sidebar.clientHeight / 2; + sidebar.scrollTop += rect.top + rect.height / 2 - middle; + } + + var move = this.move = function(upwards){ + if(!this.current){ + this.highlightFirst(); + return true; + } + var next = upwards ? this.current.previousElementSibling : this.current.nextElementSibling; + if(next && next.classList) { + this.highlight(next); + scrollCenter(next); + return true; + } + return false; + }; + + this.moveRight = function(){ + }; + this.moveLeft = function(){ + }; + + this.highlight = function(elem) { + if(!elem){ + return; + } + this.removeHighlight(); + + this.current = elem; + this.current.classList.add("current"); + }; + + this.highlightFirst = function(){ + this.highlight(this.list.querySelector('li:first-child')); + }; + + this.removeHighlight = function() { + if(this.current){ + this.current.classList.remove("current"); + } + this.current = null; + } + + this.openSelectedResult = function() { + if(this.current) { + this.current.click(); + } + } + + this.focus = function() { + searchInput.focus(); + searchInput.select(); + this.highlightFirst(); + } + + function handleKeyUp(event) { + switch(event.key) { + case "ArrowUp": + case "ArrowDown": + case "i": + case "j": + case "k": + case "l": + case "c": + case "h": + case "t": + case "n": + event.stopPropagation(); + clearMoveTimeout(); + } + } + + function handleKeyDown(event) { + switch(event.key) { + case "Enter": + event.stopPropagation(); + event.preventDefault(); + leaveSearchScope(); + self.openSelectedResult(); + break; + case "Escape": + event.stopPropagation(); + event.preventDefault(); + leaveSearchScope(); + break; + case "j": + case "c": + case "ArrowUp": + if(event.ctrlKey || event.key == "ArrowUp") { + event.stopPropagation(); + self.move(true); + startMoveTimeout(true); + } + break; + case "k": + case "h": + case "ArrowDown": + if(event.ctrlKey || event.key == "ArrowDown") { + event.stopPropagation(); + self.move(false); + startMoveTimeout(false); + } + break; + case "k": + case "t": + case "ArrowLeft": + if(event.ctrlKey || event.key == "ArrowLeft") { + event.stopPropagation(); + self.moveLeft(); + } + break; + case "l": + case "n": + case "ArrowRight": + if(event.ctrlKey || event.key == "ArrowRight") { + event.stopPropagation(); + self.moveRight(); + } + break; + } + } + + function handleInputKeyUp(event) { + switch(event.key) { + case "ArrowUp": + case "ArrowDown": + event.stopPropagation(); + event.preventDefault(); + clearMoveTimeout(); + } + } + + function handleInputKeyDown(event) { + switch(event.key) { + case "Enter": + event.stopPropagation(); + event.preventDefault(); + delayWhileSearching(function(){ + self.openSelectedResult(); + leaveSearchScope(); + }); + break; + case "Escape": + event.stopPropagation(); + event.preventDefault(); + // remove focus from search input + leaveSearchScope(); + sidebar.focus(); + break; + case "ArrowUp": + event.stopPropagation(); + event.preventDefault(); + self.move(true); + startMoveTimeout(true); + break; + + case "ArrowDown": + event.stopPropagation(); + event.preventDefault(); + self.move(false); + startMoveTimeout(false); + break; + } + } + + sidebar.tabIndex = 100; // set tabIndex to enable keylistener + sidebar.addEventListener('keyup', function(event) { + handleKeyUp(event); + }); + sidebar.addEventListener('keydown', function(event) { + handleKeyDown(event); + }); + searchInput.addEventListener('keydown', function(event) { + handleInputKeyDown(event); + }); + searchInput.addEventListener('keyup', function(event) { + handleInputKeyUp(event); + }); + this.move(); +}; + +var UsageModal = function(title, content) { + var $body = document.body; + var self = this; + var $modalBackground = document.createElement("div"); + $modalBackground.classList.add("modal-background"); + var $usageModal = document.createElement("div"); + $usageModal.classList.add("usage-modal"); + $modalBackground.appendChild($usageModal); + var $title = document.createElement("h3"); + $title.classList.add("modal-title"); + $title.innerHTML = title + $usageModal.appendChild($title); + var $closeButton = document.createElement("span"); + $closeButton.classList.add("close-button"); + $closeButton.setAttribute("title", "Close modal"); + $closeButton.innerText = '×'; + $usageModal.appendChild($closeButton); + $usageModal.insertAdjacentHTML("beforeend", content); + + $modalBackground.addEventListener('click', function(event) { + var element = event.target || event.srcElement; + + if(element == $modalBackground) { + self.hide(); + } + }); + $closeButton.addEventListener('click', function(event) { + self.hide(); + }); + + $body.insertAdjacentElement('beforeend', $modalBackground); + + this.show = function(){ + $body.classList.add("js-modal-visible"); + }; + this.hide = function(){ + $body.classList.remove("js-modal-visible"); + }; + this.isVisible = function(){ + return $body.classList.contains("js-modal-visible"); + } +} + + +document.addEventListener('DOMContentLoaded', function() { + var sessionStorage; + try { + sessionStorage = window.sessionStorage; + } catch (e) { } + if(!sessionStorage) { + sessionStorage = { + setItem: function() {}, + getItem: function() {}, + removeItem: function() {} + }; + } + + var repositoryName = document.querySelector('#repository-name').getAttribute('content'); + var typesList = document.querySelector('.types-list'); + var searchInput = document.querySelector('.search-input'); + var parents = document.querySelectorAll('.types-list li.parent'); + + var scrollSidebarToOpenType = function(){ + var openTypes = typesList.querySelectorAll('.current'); + if (openTypes.length > 0) { + var lastOpenType = openTypes[openTypes.length - 1]; + lastOpenType.scrollIntoView(); + } + } + + scrollSidebarToOpenType(); + + var setPersistentSearchQuery = function(value){ + sessionStorage.setItem(repositoryName + '::search-input:value', value); + } + + for(var i = 0; i < parents.length; i++) { + var _parent = parents[i]; + _parent.addEventListener('click', function(e) { + e.stopPropagation(); + + if(e.target.tagName.toLowerCase() == 'li') { + if(e.target.className.match(/open/)) { + sessionStorage.removeItem(e.target.getAttribute('data-id')); + e.target.className = e.target.className.replace(/ +open/g, ''); + } else { + sessionStorage.setItem(e.target.getAttribute('data-id'), '1'); + if(e.target.className.indexOf('open') == -1) { + e.target.className += ' open'; + } + } + } + }); + + if(sessionStorage.getItem(_parent.getAttribute('data-id')) == '1') { + _parent.className += ' open'; + } + } + + var leaveSearchScope = function(){ + CrystalDoc.toggleResultsList(false); + window.focus(); + } + + var navigator = new Navigator(document.querySelector('.types-list'), searchInput, document.querySelector(".search-results"), leaveSearchScope); + + CrystalDoc.loadIndex(); + var searchTimeout; + var lastSearchText = false; + var performSearch = function() { + document.dispatchEvent(new Event("CrystalDoc:searchDebounceStarted")); + + clearTimeout(searchTimeout); + searchTimeout = setTimeout(function() { + var text = searchInput.value; + + if(text == "") { + CrystalDoc.toggleResultsList(false); + }else if(text == lastSearchText){ + document.dispatchEvent(new Event("CrystalDoc:searchDebounceStopped")); + }else{ + CrystalDoc.search(text); + navigator.highlightFirst(); + searchInput.focus(); + } + lastSearchText = text; + setPersistentSearchQuery(text); + }, 200); + }; + + if(location.hash.length > 3 && location.hash.substring(0,3) == "#q="){ + // allows directly linking a search query which is then executed on the client + // this comes handy for establishing a custom browser search engine with https://crystal-lang.org/api/#q=%s as a search URL + // TODO: Add OpenSearch description + var searchQuery = location.hash.substring(3); + history.pushState({searchQuery: searchQuery}, "Search for " + searchQuery, location.href.replace(/#q=.*/, "")); + searchInput.value = searchQuery; + document.addEventListener('CrystalDoc:loaded', performSearch); + } + + if (searchInput.value.length == 0) { + var searchText = sessionStorage.getItem(repositoryName + '::search-input:value'); + if(searchText){ + searchInput.value = searchText; + } + } + searchInput.addEventListener('keyup', performSearch); + searchInput.addEventListener('input', performSearch); + + var usageModal = new UsageModal('Keyboard Shortcuts', '' + + '<ul class="usage-list">' + + ' <li>' + + ' <span class="usage-key">' + + ' <kbd>s</kbd>,' + + ' <kbd>/</kbd>' + + ' </span>' + + ' Search' + + ' </li>' + + ' <li>' + + ' <kbd class="usage-key">Esc</kbd>' + + ' Abort search / Close modal' + + ' </li>' + + ' <li>' + + ' <span class="usage-key">' + + ' <kbd>⇨</kbd>,' + + ' <kbd>Enter</kbd>' + + ' </span>' + + ' Open highlighted result' + + ' </li>' + + ' <li>' + + ' <span class="usage-key">' + + ' <kbd>⇧</kbd>,' + + ' <kbd>Ctrl+j</kbd>' + + ' </span>' + + ' Select previous result' + + ' </li>' + + ' <li>' + + ' <span class="usage-key">' + + ' <kbd>⇩</kbd>,' + + ' <kbd>Ctrl+k</kbd>' + + ' </span>' + + ' Select next result' + + ' </li>' + + ' <li>' + + ' <kbd class="usage-key">?</kbd>' + + ' Show usage info' + + ' </li>' + + '</ul>' + ); + + function handleShortkeys(event) { + var element = event.target || event.srcElement; + + if(element.tagName == "INPUT" || element.tagName == "TEXTAREA" || element.parentElement.tagName == "TEXTAREA"){ + return; + } + + switch(event.key) { + case "?": + usageModal.show(); + break; + + case "Escape": + usageModal.hide(); + break; + + case "s": + case "/": + if(usageModal.isVisible()) { + return; + } + event.stopPropagation(); + navigator.focus(); + performSearch(); + break; + } + } + + document.addEventListener('keyup', handleShortkeys); + + var scrollToEntryFromLocationHash = function() { + var hash = window.location.hash; + if (hash) { + var targetAnchor = unescape(hash.substr(1)); + var targetEl = document.querySelectorAll('.entry-detail[id="' + targetAnchor + '"]'); + + if (targetEl && targetEl.length > 0) { + targetEl[0].offsetParent.scrollTop = targetEl[0].offsetTop; + } + } + }; + window.addEventListener("hashchange", scrollToEntryFromLocationHash, false); + scrollToEntryFromLocationHash(); +}); diff --git a/api/0.6.0/search-index.js b/api/0.6.0/search-index.js new file mode 100644 index 0000000..3a89ad8 --- /dev/null +++ b/api/0.6.0/search-index.js @@ -0,0 +1 @@ +crystal_doc_search_index_callback({"repository_name":"github.com/crystal-lang/crystal-db","body":"[](https://travis-ci.org/crystal-lang/crystal-db)\n\n# crystal-db\n\nCommon db api for crystal. You will need to have a specific driver to access a database.\n\n* [SQLite](https://github.com/crystal-lang/crystal-sqlite3)\n* [MySQL](https://github.com/crystal-lang/crystal-mysql)\n* [PostgreSQL](https://github.com/will/crystal-pg)\n* [Cassandra](https://github.com/kaukas/crystal-cassandra)\n\n## Installation\n\nIf you are creating a shard that will work with _any_ driver, then add `crystal-db` as a dependency in `shard.yml`:\n\n```yaml\ndependencies:\n db:\n github: crystal-lang/crystal-db\n```\n\nIf you are creating an application that will work with _some specific_ driver(s), then add them in `shard.yml`:\n\n```yaml\ndependencies:\n sqlite3:\n github: crystal-lang/crystal-sqlite3\n```\n\n`crystal-db` itself will be a nested dependency if drivers are included.\n\nNote: Multiple drivers can be included in the same application.\n\n## Documentation\n\n* [Latest API](http://crystal-lang.github.io/crystal-db/api/latest/)\n* [Crystal book](https://crystal-lang.org/docs/database/)\n\n## Usage\n\nThis shard only provides an abstract database API. In order to use it, a specific driver for the intended database has to be required as well:\n\nThe following example uses SQLite where `?` indicates the arguments. If PostgreSQL is used `$1`, `$2`, etc. should be used. `crystal-db` does not interpret the statements.\n\n```crystal\nrequire \"db\"\nrequire \"sqlite3\"\n\nDB.open \"sqlite3:./file.db\" do |db|\n # When using the pg driver, use $1, $2, etc. instead of ?\n db.exec \"create table contacts (name text, age integer)\"\n db.exec \"insert into contacts values (?, ?)\", \"John Doe\", 30\n\n args = [] of DB::Any\n args << \"Sarah\"\n args << 33\n db.exec \"insert into contacts values (?, ?)\", args\n\n puts \"max age:\"\n puts db.scalar \"select max(age) from contacts\" # => 33\n\n puts \"contacts:\"\n db.query \"select name, age from contacts order by age desc\" do |rs|\n puts \"#{rs.column_name(0)} (#{rs.column_name(1)})\"\n # => name (age)\n rs.each do\n puts \"#{rs.read(String)} (#{rs.read(Int32)})\"\n # => Sarah (33)\n # => John Doe (30)\n end\n end\nend\n```\n\n## Roadmap\n\nIssues not yet addressed:\n\n- [x] Support non prepared statements. [#25](https://github.com/crystal-lang/crystal-db/pull/25)\n- [x] Time data type. (implementation details depends on actual drivers)\n- [x] Data type extensibility. Allow each driver to extend the data types allowed.\n- [x] Transactions & nested transactions. [#27](https://github.com/crystal-lang/crystal-db/pull/27)\n- [x] Connection pool.\n- [ ] Logging\n- [ ] Direct access to `IO` to avoid memory allocation for blobs.\n\n## Contributing\n\n1. Fork it ( https://github.com/crystal-lang/crystal-db/fork )\n2. Create your feature branch (git checkout -b my-new-feature)\n3. Commit your changes (git commit -am 'Add some feature')\n4. Push to the branch (git push origin my-new-feature)\n5. Create a new Pull Request\n\n## Contributors\n\n- [bcardiff](https://github.com/bcardiff) Brian J. Cardiff - creator, maintainer\n","program":{"html_id":"github.com/crystal-lang/crystal-db/toplevel","path":"toplevel.html","kind":"module","full_name":"Top Level Namespace","name":"Top Level Namespace","abstract":false,"superclass":null,"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Spec/Methods","kind":"module","full_name":"Spec::Methods","name":"Methods"},{"html_id":"github.com/crystal-lang/crystal-db/Spec/Expectations","kind":"module","full_name":"Spec::Expectations","name":"Expectations"}],"locations":[],"repository_name":"github.com/crystal-lang/crystal-db","program":true,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/Spec/Expectations","kind":"module","full_name":"Spec::Expectations","name":"Expectations"},{"html_id":"github.com/crystal-lang/crystal-db/Spec/Methods","kind":"module","full_name":"Spec::Methods","name":"Methods"}],"extended_modules":[{"html_id":"github.com/crystal-lang/crystal-db/Spec/Expectations","kind":"module","full_name":"Spec::Expectations","name":"Expectations"},{"html_id":"github.com/crystal-lang/crystal-db/Spec/Methods","kind":"module","full_name":"Spec::Methods","name":"Methods"}],"subclasses":[],"including_types":[],"namespace":null,"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[{"html_id":"github.com/crystal-lang/crystal-db/DB","path":"DB.html","kind":"module","full_name":"DB","name":"DB","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"db.cr","line_number":77,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr"},{"filename":"db/pool.cr","line_number":3,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr"},{"filename":"db/string_key_cache.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/string_key_cache.cr"},{"filename":"db/query_methods.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr"},{"filename":"db/session_methods.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr"},{"filename":"db/disposable.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/disposable.cr"},{"filename":"db/driver.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/driver.cr"},{"filename":"db/statement.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr"},{"filename":"db/begin_transaction.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/begin_transaction.cr"},{"filename":"db/connection_context.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr"},{"filename":"db/connection.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr"},{"filename":"db/transaction.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr"},{"filename":"db/pool_statement.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr"},{"filename":"db/database.cr","line_number":4,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr"},{"filename":"db/pool_prepared_statement.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_prepared_statement.cr"},{"filename":"db/pool_unprepared_statement.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_unprepared_statement.cr"},{"filename":"db/result_set.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr"},{"filename":"db/error.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"},{"filename":"db/mapping.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/mapping.cr"},{"filename":"spec.cr","line_number":9,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr"},{"filename":"db/version.cr","line_number":1,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/version.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[{"id":"TYPES","name":"TYPES","value":"[Nil, String, Bool, Int32, Int64, Float32, Float64, Time, Bytes]","doc":"Types supported to interface with database driver.\nThese can be used in any `ResultSet#read` or any `Database#query` related\nmethod to be used as query parameters","summary":"<p>Types supported to interface with database driver.</p>"},{"id":"VERSION","name":"VERSION","value":"\"0.6.0\"","doc":null,"summary":null}],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":null,"doc":"The DB module is a unified interface for database access.\nIndividual database systems are supported by specific database driver shards.\n\nAvailable drivers include:\n* [crystal-lang/crystal-sqlite3](https://github.com/crystal-lang/crystal-sqlite3) for SQLite\n* [crystal-lang/crystal-mysql](https://github.com/crystal-lang/crystal-mysql) for MySQL and MariaDB\n* [will/crystal-pg](https://github.com/will/crystal-pg) for PostgreSQL\n* [kaukas/crystal-cassandra](https://github.com/kaukas/crystal-cassandra) for Cassandra\n\nFor basic instructions on implementing a new database driver, check `Driver` and the existing drivers.\n\nDB manages a connection pool. The connection pool can be configured by query parameters to the\nconnection `URI` as described in `Database`.\n\n### Usage\n\nAssuming `crystal-sqlite3` is included a SQLite3 database can be opened with `#open`.\n\n```\ndb = DB.open \"sqlite3:./path/to/db/file.db\"\ndb.close\n```\n\nIf a block is given to `#open` the database is closed automatically\n\n```\nDB.open \"sqlite3:./file.db\" do |db|\n # work with db\nend # db is closed\n```\n\nIn the code above `db` is a `Database`. Methods available for querying it are described in `QueryMethods`.\n\nThree kind of statements can be performed:\n1. `Database#exec` waits no response from the database.\n2. `Database#scalar` reads a single value of the response.\n3. `Database#query` returns a ResultSet that allows iteration over the rows in the response and column information.\n\nAll of the above methods allows parametrised query. Either positional or named arguments.\n\nCheck a full working version:\n\nThe following example uses SQLite where `?` indicates the arguments. If PostgreSQL is used `$1`, `$2`, etc. should be used. `crystal-db` does not interpret the statements.\n\n```\nrequire \"db\"\nrequire \"sqlite3\"\n\nDB.open \"sqlite3:./file.db\" do |db|\n # When using the pg driver, use $1, $2, etc. instead of ?\n db.exec \"create table contacts (name text, age integer)\"\n db.exec \"insert into contacts values (?, ?)\", \"John Doe\", 30\n\n args = [] of DB::Any\n args << \"Sarah\"\n args << 33\n db.exec \"insert into contacts values (?, ?)\", args\n\n puts \"max age:\"\n puts db.scalar \"select max(age) from contacts\" # => 33\n\n puts \"contacts:\"\n db.query \"select name, age from contacts order by age desc\" do |rs|\n puts \"#{rs.column_name(0)} (#{rs.column_name(1)})\"\n # => name (age)\n rs.each do\n puts \"#{rs.read(String)} (#{rs.read(Int32)})\"\n # => Sarah (33)\n # => John Doe (30)\n end\n end\nend\n```\n","summary":"<p>The DB module is a unified interface for database access.</p>","class_methods":[{"id":"connect(uri:URI|String)-class-method","html_id":"connect(uri:URI|String)-class-method","name":"connect","doc":"Opens a connection using the specified *uri*.\nThe scheme of the *uri* determines the driver to use.\nReturned connection must be closed by `Connection#close`.\nIf a block is used the connection is yielded and closed automatically.","summary":"<p>Opens a connection using the specified <em>uri</em>.</p>","abstract":false,"args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"args_string":"(uri : URI | String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L133","def":{"name":"connect","args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"build_connection(uri)"}},{"id":"connect(uri:URI|String,&block)-class-method","html_id":"connect(uri:URI|String,&block)-class-method","name":"connect","doc":"Opens a connection using the specified *uri*.\nThe scheme of the *uri* determines the driver to use.\nReturned connection must be closed by `Connection#close`.\nIf a block is used the connection is yielded and closed automatically.","summary":"<p>Opens a connection using the specified <em>uri</em>.</p>","abstract":false,"args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"args_string":"(uri : URI | String, &block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L138","def":{"name":"connect","args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"cnn = build_connection(uri)\nbegin\n yield cnn\nensure\n cnn.close\nend\n"}},{"id":"open(uri:URI|String)-class-method","html_id":"open(uri:URI|String)-class-method","name":"open","doc":"Creates a `Database` pool and opens initial connection(s) as specified in the connection *uri*.\nUse `DB#connect` to open a single connection.\n\nThe scheme of the *uri* determines the driver to use.\nConnection parameters such as hostname, user, database name, etc. are specified according\nto each database driver's specific format.\n\nThe returned database must be closed by `Database#close`.","summary":"<p>Creates a <code><a href=\"DB/Database.html\">Database</a></code> pool and opens initial connection(s) as specified in the connection <em>uri</em>.</p>","abstract":false,"args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"args_string":"(uri : URI | String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L115","def":{"name":"open","args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"build_database(uri)"}},{"id":"open(uri:URI|String,&block)-class-method","html_id":"open(uri:URI|String,&block)-class-method","name":"open","doc":"Same as `#open` but the database is yielded and closed automatically at the end of the block.","summary":"<p>Same as <code><a href=\"DB.html#open(uri:URI%7CString)-class-method\">#open</a></code> but the database is yielded and closed automatically at the end of the block.</p>","abstract":false,"args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"args_string":"(uri : URI | String, &block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L120","def":{"name":"open","args":[{"name":"uri","doc":null,"default_value":"","external_name":"uri","restriction":"URI | String"}],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"db = build_database(uri)\nbegin\n yield db\nensure\n db.close\nend\n"}},{"id":"register_driver(driver_name,driver_class:Driver.class)-class-method","html_id":"register_driver(driver_name,driver_class:Driver.class)-class-method","name":"register_driver","doc":"Registers a driver class for a given *driver_name*.\nShould be called by drivers implementors only.","summary":"<p>Registers a driver class for a given <em>driver_name</em>.</p>","abstract":false,"args":[{"name":"driver_name","doc":null,"default_value":"","external_name":"driver_name","restriction":""},{"name":"driver_class","doc":null,"default_value":"","external_name":"driver_class","restriction":"Driver.class"}],"args_string":"(driver_name, driver_class : <span class=\"t\">Driver</span>.<span class=\"k\">class</span>)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L99","def":{"name":"register_driver","args":[{"name":"driver_name","doc":null,"default_value":"","external_name":"driver_name","restriction":""},{"name":"driver_class","doc":null,"default_value":"","external_name":"driver_class","restriction":"Driver.class"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"drivers[driver_name] = driver_class"}}],"constructors":[],"instance_methods":[],"macros":[{"id":"mapping(properties,strict=true)-macro","html_id":"mapping(properties,strict=true)-macro","name":"mapping","doc":"The `DB.mapping` macro defines how an object is built from a `ResultSet`.\n\nIt takes hash literal as argument, in which attributes and types are defined.\nOnce defined, `ResultSet#read(t)` populates properties of the class from the\n`ResultSet`.\n\n```crystal\nrequire \"db\"\n\nclass Employee\n DB.mapping({\n title: String,\n name: String,\n })\nend\n\nemployees = Employee.from_rs(db.query(\"SELECT title, name FROM employees\"))\nemployees[0].title # => \"Manager\"\nemployees[0].name # => \"John\"\n```\n\nAttributes not mapped with `DB.mapping` are not defined as properties.\nAlso, missing attributes raise a `DB::MappingException`.\n\nYou can also define attributes for each property.\n\n```crystal\nclass Employee\n DB.mapping({\n title: String,\n name: {\n type: String,\n nilable: true,\n key: \"firstname\",\n },\n })\nend\n```\n\nAvailable attributes:\n\n* *type* (required) defines its type. In the example above, *title: String* is a shortcut to *title: {type: String}*.\n* *nilable* defines if a property can be a `Nil`.\n* **default**: value to use if the property is missing in the result set, or if it's `null` and `nilable` was not set to `true`. If the default value creates a new instance of an object (for example `[1, 2, 3]` or `SomeObject.new`), a different instance will be used each time a row is parsed.\n* *key* defines which column to read from a `ResultSet`. It defaults to the name of the property.\n* *converter* takes an alternate type for parsing. It requires a `#from_rs` method in that class, and returns an instance of the given type.\n\nThe mapping also automatically defines Crystal properties (getters and setters) for each\nof the keys. It doesn't define a constructor accepting those arguments, but you can provide\nan overload.\n\nThe macro basically defines a constructor accepting a `ResultSet` that reads from\nit and initializes this type's instance variables.\n\nThis macro also declares instance variables of the types given in the mapping.","summary":"<p>The <code><a href=\"DB.html#mapping(**properties)-macro\">DB.mapping</a></code> macro defines how an object is built from a <code><a href=\"DB/ResultSet.html\">ResultSet</a></code>.</p>","abstract":false,"args":[{"name":"properties","doc":null,"default_value":"","external_name":"properties","restriction":""},{"name":"strict","doc":null,"default_value":"true","external_name":"strict","restriction":""}],"args_string":"(properties, strict = <span class=\"n\">true</span>)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/mapping.cr#L60","def":{"name":"mapping","args":[{"name":"properties","doc":null,"default_value":"","external_name":"properties","restriction":""},{"name":"strict","doc":null,"default_value":"true","external_name":"strict","restriction":""}],"double_splat":null,"splat_index":null,"block_arg":null,"visibility":"Public","body":" include ::DB::Mappable\n\n \n{% for key, value in properties %}\n {% unless value.is_a?(HashLiteral) || value.is_a?(NamedTupleLiteral)\n properties[key] = {type: value}\nend %}\n {% end %}\n\n\n \n{% for key, value in properties %}\n {% if value[:type].is_a?(Generic) && (value[:type].type_vars.map(&.resolve).includes?(Nil))\n value[:nilable] = true\nend %}\n\n {% if (value[:type].is_a?(Call) && (value[:type].name == \"|\")) && ((value[:type].receiver.resolve == Nil) || value[:type].args.map(&.resolve).any?(&.==(Nil))) %}\n {% value[:nilable] = true %}\n {% end %}\n {% end %}\n\n\n \n{% for key, value in properties %}\n @{{ key.id }} : {{ value[:type] }} {{ (value[:nilable] ? \"?\" : \"\").id }}\n\n def {{ key.id }}=(_{{ key.id }} : {{ value[:type] }} {{ (value[:nilable] ? \"?\" : \"\").id }})\n @{{ key.id }} = _{{ key.id }}\n end\n\n def {{ key.id }}\n @{{ key.id }}\n end\n {% end %}\n\n\n def self.from_rs(\n%rs\n : ::DB::ResultSet)\n \n%objs\n = Array(self).new\n \n%rs\n.each do\n \n%objs\n << self.new(\n%rs\n)\n \nend\n \n%objs\n\n \nensure\n \n%rs\n.close\n \nend\n\n def initialize(\n%rs\n : ::DB::ResultSet)\n \n{% for key, value in properties %}\n %var{key.id} = nil\n %found{key.id} = false\n {% end %}\n\n\n \n%rs\n.each_column do |col_name|\n case col_name\n \n{% for key, value in properties %}\n when {{ value[:key] || key.id.stringify }}\n %found{key.id} = true\n %var{key.id} =\n {% if value[:converter] %}\n {{ value[:converter] }}.from_rs(%rs)\n {% else %}{% if value[:nilable] || (value[:default] != nil) %}\n %rs.read(::Union({{ value[:type] }} | Nil))\n {% else %}\n %rs.read({{ value[:type] }})\n {% end %}{% end %}\n {% end %}\n\n \nelse\n \n{% if strict %}\n raise ::DB::MappingException.new(\"unknown result set attribute: #{col_name}\")\n {% else %}\n %rs.read\n {% end %}\n\n \nend\n \nend\n\n \n{% for key, value in properties %}\n {% if value[:nilable] || (value[:default] != nil) %}{% else %}\n if %var{key.id}.is_a?(Nil) && !%found{key.id}\n raise ::DB::MappingException.new(\"missing result set attribute: {{ (value[:key] || key).id }}\")\n end\n {% end %}\n {% end %}\n\n\n \n{% for key, value in properties %}\n {% if value[:nilable] %}\n {% if value[:default] != nil %}\n @{{ key.id }} = %found{key.id} ? %var{key.id} : {{ value[:default] }}\n {% else %}\n @{{ key.id }} = %var{key.id}\n {% end %}\n {% else %}{% if value[:default] != nil %}\n @{{ key.id }} = %var{key.id}.is_a?(Nil) ? {{ value[:default] }} : %var{key.id}\n {% else %}\n @{{ key.id }} = %var{key.id}.as({{ value[:type] }})\n {% end %}{% end %}\n {% end %}\n\n \nend\n \n"}},{"id":"mapping(**properties)-macro","html_id":"mapping(**properties)-macro","name":"mapping","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(**properties)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/mapping.cr#L151","def":{"name":"mapping","args":[],"double_splat":{"name":"properties","doc":null,"default_value":"","external_name":"properties","restriction":""},"splat_index":null,"block_arg":null,"visibility":"Public","body":" ::DB.mapping(\n{{ properties }}\n)\n \n"}}],"types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Any","path":"DB/Any.html","kind":"alias","full_name":"DB::Any","name":"Any","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"db.cr","line_number":84,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":true,"aliased":"(Bool | Float32 | Float64 | Int32 | Int64 | Slice(UInt8) | String | Time | Nil)","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/BeginTransaction","path":"DB/BeginTransaction.html","kind":"module","full_name":"DB::BeginTransaction","name":"BeginTransaction","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"db/begin_transaction.cr","line_number":2,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/begin_transaction.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Connection","kind":"class","full_name":"DB::Connection","name":"Connection"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Transaction","kind":"class","full_name":"DB::Transaction","name":"Transaction"}],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"id":"begin_transaction:Transaction-instance-method","html_id":"begin_transaction:Transaction-instance-method","name":"begin_transaction","doc":"Creates a transaction from the current context.\nIf is expected that either `Transaction#commit` or `Transaction#rollback`\nare called explicitly to release the context.","summary":"<p>Creates a transaction from the current context.</p>","abstract":true,"args":[],"args_string":" : Transaction","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/begin_transaction.cr#L6","def":{"name":"begin_transaction","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Transaction","visibility":"Public","body":""}},{"id":"transaction(&block)-instance-method","html_id":"transaction(&block)-instance-method","name":"transaction","doc":"yields a transaction from the current context.\nQuery the database through `Transaction#connection` object.\nIf an exception is thrown within the block a rollback is performed.\nThe exception thrown is bubbled unless it is a `DB::Rollback`.\nFrom the yielded object `Transaction#commit` or `Transaction#rollback`\ncan be called explicitly.","summary":"<p>yields a transaction from the current context.</p>","abstract":false,"args":[],"args_string":"(&block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/begin_transaction.cr#L14","def":{"name":"transaction","args":[],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"tx = begin_transaction\nbegin\n yield tx\nrescue DB::Rollback\n if tx.closed?\n else\n tx.rollback\n end\nrescue e\n if tx.closed?\n else\n begin\n tx.rollback\n rescue\n nil\n end\n end\n raise(e)\nelse\n if tx.closed?\n else\n tx.commit\n end\nend\n"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Connection","path":"DB/Connection.html","kind":"class","full_name":"DB::Connection","name":"Connection","abstract":true,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/BeginTransaction","kind":"module","full_name":"DB::BeginTransaction","name":"BeginTransaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","kind":"module","full_name":"DB::SessionMethods","name":"SessionMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/connection.cr","line_number":21,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/BeginTransaction","kind":"module","full_name":"DB::BeginTransaction","name":"BeginTransaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","kind":"module","full_name":"DB::SessionMethods","name":"SessionMethods"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Database driver implementors must subclass `Connection`.\n\nRepresents one active connection to a database.\n\nUsers should never instantiate a `Connection` manually. Use `DB#open` or `Database#connection`.\n\nRefer to `QueryMethods` for documentation about querying the database through this connection.\n\n### Note to implementors\n\nThe connection must be initialized in `#initialize` and closed in `#do_close`.\n\nOverride `#build_prepared_statement` method in order to return a prepared `Statement` to allow querying.\nOverride `#build_unprepared_statement` method in order to return a unprepared `Statement` to allow querying.\nSee also `Statement` to define how the statements are executed.\n\nIf at any give moment the connection is lost a DB::ConnectionLost should be raised. This will\nallow the connection pool to try to reconnect or use another connection if available.\n","summary":"<p>Database driver implementors must subclass <code><a href=\"../DB/Connection.html\">Connection</a></code>.</p>","class_methods":[],"constructors":[{"id":"new(context:ConnectionContext)-class-method","html_id":"new(context:ConnectionContext)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"ConnectionContext"}],"args_string":"(context : ConnectionContext)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr#L34","def":{"name":"new","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"ConnectionContext"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(context)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"begin_transaction:Transaction-instance-method","html_id":"begin_transaction:Transaction-instance-method","name":"begin_transaction","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Transaction","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr#L49","def":{"name":"begin_transaction","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Transaction","visibility":"Public","body":"if @transaction\n raise(DB::Error.new(\"There is an existing transaction in this connection\"))\nend\n@transaction = true\ncreate_transaction\n"}},{"id":"prepared_statements?:Bool-instance-method","html_id":"prepared_statements?:Bool-instance-method","name":"prepared_statements?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr#L32","def":{"name":"prepared_statements?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@prepared_statements"}},{"id":"release-instance-method","html_id":"release-instance-method","name":"release","doc":"return this connection to the pool\nmanaged by the database. Should be used\nonly if the connection was obtained by `Database#checkout`.","summary":"<p>return this connection to the pool managed by the database.</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection.cr#L77","def":{"name":"release","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@context.release(self)"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/ConnectionContext","path":"DB/ConnectionContext.html","kind":"module","full_name":"DB::ConnectionContext","name":"ConnectionContext","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"db/connection_context.cr","line_number":2,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Database","kind":"class","full_name":"DB::Database","name":"Database"}],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"id":"discard(connection:Connection)-instance-method","html_id":"discard(connection:Connection)-instance-method","name":"discard","doc":"Indicates that the *connection* was permanently closed\nand should not be used in the future.","summary":"<p>Indicates that the <em>connection</em> was permanently closed and should not be used in the future.</p>","abstract":true,"args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"args_string":"(connection : Connection)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr#L11","def":{"name":"discard","args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"prepared_statements?:Bool-instance-method","html_id":"prepared_statements?:Bool-instance-method","name":"prepared_statements?","doc":"Return whether the statements should be prepared by default","summary":"<p>Return whether the statements should be prepared by default</p>","abstract":true,"args":[],"args_string":" : Bool","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr#L7","def":{"name":"prepared_statements?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":""}},{"id":"release(connection:Connection)-instance-method","html_id":"release(connection:Connection)-instance-method","name":"release","doc":"Indicates that the *connection* is no longer needed\nand can be reused in the future.","summary":"<p>Indicates that the <em>connection</em> is no longer needed and can be reused in the future.</p>","abstract":true,"args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"args_string":"(connection : Connection)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr#L15","def":{"name":"release","args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"uri:URI-instance-method","html_id":"uri:URI-instance-method","name":"uri","doc":"Returns the uri with the connection settings to the database","summary":"<p>Returns the uri with the connection settings to the database</p>","abstract":true,"args":[],"args_string":" : URI","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/connection_context.cr#L4","def":{"name":"uri","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"URI","visibility":"Public","body":""}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/ConnectionLost","path":"DB/ConnectionLost.html","kind":"class","full_name":"DB::ConnectionLost","name":"ConnectionLost","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/error.cr","line_number":17,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Raised when an established connection is lost\nprobably due to socket/network issues.\nIt is used by the connection pool retry logic.","summary":"<p>Raised when an established connection is lost probably due to socket/network issues.</p>","class_methods":[],"constructors":[{"id":"new(connection)-class-method","html_id":"new(connection)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":""}],"args_string":"(connection)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr#L20","def":{"name":"new","args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(connection)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"connection:Connection-instance-method","html_id":"connection:Connection-instance-method","name":"connection","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Connection","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr#L20","def":{"name":"connection","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Connection","visibility":"Public","body":"@connection"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/ConnectionRefused","path":"DB/ConnectionRefused.html","kind":"class","full_name":"DB::ConnectionRefused","name":"ConnectionRefused","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/error.cr","line_number":27,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Raised when a connection is unable to be established\nprobably due to socket/network or configuration issues.\nIt is used by the connection pool retry logic.","summary":"<p>Raised when a connection is unable to be established probably due to socket/network or configuration issues.</p>","class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Database","path":"DB/Database.html","kind":"class","full_name":"DB::Database","name":"Database","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/ConnectionContext","kind":"module","full_name":"DB::ConnectionContext","name":"ConnectionContext"},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","kind":"module","full_name":"DB::SessionMethods","name":"SessionMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/database.cr","line_number":30,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/ConnectionContext","kind":"module","full_name":"DB::ConnectionContext","name":"ConnectionContext"},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","kind":"module","full_name":"DB::SessionMethods","name":"SessionMethods"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Acts as an entry point for database access.\nConnections are managed by a pool.\nUse `DB#open` to create a `Database` instance.\n\nRefer to `QueryMethods` and `SessionMethods` for documentation about querying the database.\n\n## Database URI\n\nConnection parameters are configured in a URI. The format is specified by the individual\ndatabase drivers. See the [reference book](https://crystal-lang.org/reference/database/) for examples.\n\nThe connection pool can be configured from URI parameters:\n\n - `initial_pool_size` (default 1)\n - `max_pool_size` (default 0 = unlimited)\n - `max_idle_pool_size` (default 1)\n - `checkout_timeout` (default 5.0)\n - `retry_attempts` (default 1)\n - `retry_delay` (in seconds, default 1.0)\n\nWhen querying a database, prepared statements are used by default.\nThis can be changed from the `prepared_statements` URI parameter:\n\n - `prepared_statements` (true, or false, default true)\n","summary":"<p>Acts as an entry point for database access.</p>","class_methods":[],"constructors":[],"instance_methods":[{"id":"checkout-instance-method","html_id":"checkout-instance-method","name":"checkout","doc":"returns a connection from the pool\nthe returned connection must be returned\nto the pool by explictly calling `Connection#release`","summary":"<p>returns a connection from the pool the returned connection must be returned to the pool by explictly calling <code><a href=\"../DB/Connection.html#release-instance-method\">Connection#release</a></code></p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L123","def":{"name":"checkout","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"connection = @pool.checkout\nconnection.auto_release = false\nconnection\n"}},{"id":"close-instance-method","html_id":"close-instance-method","name":"close","doc":"Closes all connection to the database.","summary":"<p>Closes all connection to the database.</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L71","def":{"name":"close","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@statements_cache.each_value(&.close)\n@statements_cache.clear\n@pool.close\n"}},{"id":"prepared_statements?:Bool-instance-method","html_id":"prepared_statements?:Bool-instance-method","name":"prepared_statements?","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L44","def":{"name":"prepared_statements?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@prepared_statements"}},{"id":"setup_connection(&proc:Connection->Nil)-instance-method","html_id":"setup_connection(&proc:Connection->Nil)-instance-method","name":"setup_connection","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&proc : Connection -> Nil)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L63","def":{"name":"setup_connection","args":[],"double_splat":null,"splat_index":null,"yields":1,"block_arg":{"name":"proc","doc":null,"default_value":"","external_name":"proc","restriction":"(Connection -> Nil)"},"return_type":"","visibility":"Public","body":"@setup_connection = proc\n@pool.each_resource do |conn|\n @setup_connection.call(conn)\nend\n"}},{"id":"transaction(&block)-instance-method","html_id":"transaction(&block)-instance-method","name":"transaction","doc":"yields a `Transaction` from a connection of the pool\nRefer to `BeginTransaction#transaction` for documentation.","summary":"<p>yields a <code><a href=\"../DB/Transaction.html\">Transaction</a></code> from a connection of the pool Refer to <code><a href=\"../DB/BeginTransaction.html#transaction(&block)-instance-method\">BeginTransaction#transaction</a></code> for documentation.</p>","abstract":false,"args":[],"args_string":"(&block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L131","def":{"name":"transaction","args":[],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"using_connection do |cnn|\n cnn.transaction do |tx|\n yield tx\n end\nend"}},{"id":"uri:URI-instance-method","html_id":"uri:URI-instance-method","name":"uri","doc":"Returns the uri with the connection settings to the database","summary":"<p>Returns the uri with the connection settings to the database</p>","abstract":false,"args":[],"args_string":" : URI","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L42","def":{"name":"uri","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"URI","visibility":"Public","body":"@uri"}},{"id":"using_connection(&block)-instance-method","html_id":"using_connection(&block)-instance-method","name":"using_connection","doc":"yields a connection from the pool\nthe connection is returned to the pool\nwhen the block ends","summary":"<p>yields a connection from the pool the connection is returned to the pool when the block ends</p>","abstract":false,"args":[],"args_string":"(&block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/database.cr#L111","def":{"name":"using_connection","args":[],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"connection = self.checkout\nbegin\n yield connection\nensure\n connection.release\nend\n"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","path":"DB/Disposable.html","kind":"module","full_name":"DB::Disposable","name":"Disposable","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"db/disposable.cr","line_number":3,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/disposable.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Connection","kind":"class","full_name":"DB::Connection","name":"Connection"},{"html_id":"github.com/crystal-lang/crystal-db/DB/ResultSet","kind":"class","full_name":"DB::ResultSet","name":"ResultSet"},{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Transaction","kind":"class","full_name":"DB::Transaction","name":"Transaction"}],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Generic module to encapsulate disposable db resources.","summary":"<p>Generic module to encapsulate disposable db resources.</p>","class_methods":[],"constructors":[],"instance_methods":[{"id":"close-instance-method","html_id":"close-instance-method","name":"close","doc":"Closes this object.","summary":"<p>Closes this object.</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/disposable.cr#L9","def":{"name":"close","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"if @closed\n return\nend\ndo_close\n@closed = true\n"}},{"id":"closed?-instance-method","html_id":"closed?-instance-method","name":"closed?","doc":"Returns `true` if this object is closed. See `#close`.","summary":"<p>Returns <code>true</code> if this object is closed.</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/disposable.cr#L16","def":{"name":"closed?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@closed"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Driver","path":"DB/Driver.html","kind":"class","full_name":"DB::Driver","name":"Driver","abstract":true,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/driver.cr","line_number":28,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/driver.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Database driver implementors must subclass `Driver`,\nregister with a driver_name using `DB#register_driver` and\noverride the factory method `#build_connection`.\n\n```\nrequire \"db\"\n\nclass FakeDriver < DB::Driver\n def build_connection(context : DB::ConnectionContext)\n FakeConnection.new context\n end\nend\n\nDB.register_driver \"fake\", FakeDriver\n```\n\nAccess to this fake datbase will be available with\n\n```\nDB.open \"fake://...\" do |db|\n # ... use db ...\nend\n```\n\nRefer to `Connection`, `Statement` and `ResultSet` for further\ndriver implementation instructions.","summary":"<p>Database driver implementors must subclass <code><a href=\"../DB/Driver.html\">Driver</a></code>, register with a driver_name using <code><a href=\"../DB.html#register_driver(driver_name,driver_class:Driver.class)-class-method\">DB#register_driver</a></code> and override the factory method <code><a href=\"../DB/Driver.html#build_connection(context:ConnectionContext):Connection-instance-method\">#build_connection</a></code>.</p>","class_methods":[],"constructors":[],"instance_methods":[{"id":"build_connection(context:ConnectionContext):Connection-instance-method","html_id":"build_connection(context:ConnectionContext):Connection-instance-method","name":"build_connection","doc":null,"summary":null,"abstract":true,"args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"ConnectionContext"}],"args_string":"(context : ConnectionContext) : Connection","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/driver.cr#L29","def":{"name":"build_connection","args":[{"name":"context","doc":null,"default_value":"","external_name":"context","restriction":"ConnectionContext"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Connection","visibility":"Public","body":""}},{"id":"connection_pool_options(params:HTTP::Params)-instance-method","html_id":"connection_pool_options(params:HTTP::Params)-instance-method","name":"connection_pool_options","doc":null,"summary":null,"abstract":false,"args":[{"name":"params","doc":null,"default_value":"","external_name":"params","restriction":"HTTP::Params"}],"args_string":"(params : HTTP::Params)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/driver.cr#L31","def":{"name":"connection_pool_options","args":[{"name":"params","doc":null,"default_value":"","external_name":"params","restriction":"HTTP::Params"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"{initial_pool_size: (params.fetch(\"initial_pool_size\", 1)).to_i, max_pool_size: (params.fetch(\"max_pool_size\", 0)).to_i, max_idle_pool_size: (params.fetch(\"max_idle_pool_size\", 1)).to_i, checkout_timeout: (params.fetch(\"checkout_timeout\", 5.0)).to_f, retry_attempts: (params.fetch(\"retry_attempts\", 1)).to_i, retry_delay: (params.fetch(\"retry_delay\", 1.0)).to_f}"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/DriverSpecs","path":"DB/DriverSpecs.html","kind":"class","full_name":"DB::DriverSpecs(DBAnyType)","name":"DriverSpecs","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"spec.cr","line_number":51,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Helper class to ensure behaviour of custom drivers\n\n```\nrequire \"db/spec\"\n\nDB::DriverSpecs(DB::Any).run do\n # How to connect to database\n connection_string \"scheme://database_url\"\n\n # Clean up database if needed using before/after callbacks\n before do\n # ...\n end\n\n after do\n # ...\n end\n\n # Sample values that will be stored, retrieved across many specs\n sample_value \"hello\", \"varchar(25)\", \"'hello'\"\n\n it \"custom spec with a db initialized\" do |db|\n # assert something using *db*\n end\n\n # Configure the appropiate syntax for different commands needed to run the specs\n binding_syntax do |index|\n \"?\"\n end\n\n create_table_1column_syntax do |table_name, col1|\n \"create table #{table_name} (#{col1.name} #{col1.sql_type} #{col1.null ? \"NULL\" : \"NOT NULL\"})\"\n end\nend\n```\n\nThe following methods needs to be called to configure the appropiate syntax\nfor different commands and allow all the specs to run: `binding_syntax`, `create_table_1column_syntax`,\n`create_table_2columns_syntax`, `select_1column_syntax`, `select_2columns_syntax`, `select_count_syntax`,\n`select_scalar_syntax`, `insert_1column_syntax`, `insert_2columns_syntax`, `drop_table_if_exists_syntax`.\n","summary":"<p>Helper class to ensure behaviour of custom drivers</p>","class_methods":[{"id":"run(description="asadb",&block)-class-method","html_id":"run(description=&quot;asadb&quot;,&block)-class-method","name":"run","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"\"as a db\"","external_name":"description","restriction":""}],"args_string":"(description = <span class=\"s\">"as a db"</span>, &block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L469","def":{"name":"run","args":[{"name":"description","doc":null,"default_value":"\"as a db\"","external_name":"description","restriction":""}],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"ctx = self.new\nwith ctx yield\ndescribe(description) do\n ctx.include_shared_specs\n ctx.its.each do |db_it|\n case db_it.prepared\n when :default\n it(db_it.description, db_it.file, db_it.line, db_it.end_line) do\n ctx.with_db do |db|\n db_it.block.call(db)\n nil\n end\n end\n when :both\n values = [] of Bool\n if ctx.support_prepared\n values << true\n end\n if ctx.support_unprepared\n values << false\n end\n case values.size\n when 0\n raise(\"Neither prepared non unprepared statements allowed\")\n when 1\n it(db_it.description, db_it.file, db_it.line, db_it.end_line) do\n ctx.with_db do |db|\n db_it.block.call(db)\n nil\n end\n end\n else\n values.each do |prepared_statements|\n it(\"#{db_it.description} (prepared_statements=#{prepared_statements})\", db_it.file, db_it.line, db_it.end_line) do\n ctx.with_db(\"prepared_statements=#{prepared_statements}\") do |db|\n db_it.block.call(db)\n nil\n end\n end\n end\n end\n end\n end\nend\n"}}],"constructors":[],"instance_methods":[{"id":"after(&after:->Nil)-instance-method","html_id":"after(&after:->Nil)-instance-method","name":"after","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&after : -> Nil)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L63","def":{"name":"after","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"after","doc":null,"default_value":"","external_name":"after","restriction":"(-> Nil)"},"return_type":"","visibility":"Public","body":"@after = after"}},{"id":"before(&before:->Nil)-instance-method","html_id":"before(&before:->Nil)-instance-method","name":"before","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&before : -> Nil)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L60","def":{"name":"before","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"before","doc":null,"default_value":"","external_name":"before","restriction":"(-> Nil)"},"return_type":"","visibility":"Public","body":"@before = before"}},{"id":"binding_syntax(&binding_syntax:Proc(Int32,String))-instance-method","html_id":"binding_syntax(&binding_syntax:Proc(Int32,String))-instance-method","name":"binding_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&binding_syntax : Proc(Int32, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L110","def":{"name":"binding_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"binding_syntax","doc":null,"default_value":"","external_name":"binding_syntax","restriction":"Proc(Int32, String)"},"return_type":"","visibility":"Public","body":"@binding_syntax = binding_syntax"}},{"id":"connection_string(connection_string:String)-instance-method","html_id":"connection_string(connection_string:String)-instance-method","name":"connection_string","doc":null,"summary":null,"abstract":false,"args":[{"name":"connection_string","doc":null,"default_value":"","external_name":"connection_string","restriction":"String"}],"args_string":"(connection_string : String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L109","def":{"name":"connection_string","args":[{"name":"connection_string","doc":null,"default_value":"","external_name":"connection_string","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@connection_string = connection_string"}},{"id":"create_table_1column_syntax(&create_table_1column_syntax:Proc(String,ColumnDef,String))-instance-method","html_id":"create_table_1column_syntax(&create_table_1column_syntax:Proc(String,ColumnDef,String))-instance-method","name":"create_table_1column_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&create_table_1column_syntax : Proc(String, ColumnDef, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L112","def":{"name":"create_table_1column_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"create_table_1column_syntax","doc":null,"default_value":"","external_name":"create_table_1column_syntax","restriction":"Proc(String, ColumnDef, String)"},"return_type":"","visibility":"Public","body":"@create_table_1column_syntax = create_table_1column_syntax"}},{"id":"create_table_2columns_syntax(&create_table_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method","html_id":"create_table_2columns_syntax(&create_table_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method","name":"create_table_2columns_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&create_table_2columns_syntax : Proc(String, ColumnDef, ColumnDef, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L113","def":{"name":"create_table_2columns_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"create_table_2columns_syntax","doc":null,"default_value":"","external_name":"create_table_2columns_syntax","restriction":"Proc(String, ColumnDef, ColumnDef, String)"},"return_type":"","visibility":"Public","body":"@create_table_2columns_syntax = create_table_2columns_syntax"}},{"id":"drop_table_if_exists_syntax(&drop_table_if_exists_syntax:Proc(String,String))-instance-method","html_id":"drop_table_if_exists_syntax(&drop_table_if_exists_syntax:Proc(String,String))-instance-method","name":"drop_table_if_exists_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&drop_table_if_exists_syntax : Proc(String, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L119","def":{"name":"drop_table_if_exists_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"drop_table_if_exists_syntax","doc":null,"default_value":"","external_name":"drop_table_if_exists_syntax","restriction":"Proc(String, String)"},"return_type":"","visibility":"Public","body":"@drop_table_if_exists_syntax = drop_table_if_exists_syntax"}},{"id":"encode_null(encode_null:String)-instance-method","html_id":"encode_null(encode_null:String)-instance-method","name":"encode_null","doc":null,"summary":null,"abstract":false,"args":[{"name":"encode_null","doc":null,"default_value":"","external_name":"encode_null","restriction":"String"}],"args_string":"(encode_null : String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L66","def":{"name":"encode_null","args":[{"name":"encode_null","doc":null,"default_value":"","external_name":"encode_null","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@encode_null = encode_null"}},{"id":"insert_1column_syntax(&insert_1column_syntax:Proc(String,ColumnDef,String,String))-instance-method","html_id":"insert_1column_syntax(&insert_1column_syntax:Proc(String,ColumnDef,String,String))-instance-method","name":"insert_1column_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&insert_1column_syntax : Proc(String, ColumnDef, String, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L114","def":{"name":"insert_1column_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"insert_1column_syntax","doc":null,"default_value":"","external_name":"insert_1column_syntax","restriction":"Proc(String, ColumnDef, String, String)"},"return_type":"","visibility":"Public","body":"@insert_1column_syntax = insert_1column_syntax"}},{"id":"insert_2columns_syntax(&insert_2columns_syntax:Proc(String,ColumnDef,String,ColumnDef,String,String))-instance-method","html_id":"insert_2columns_syntax(&insert_2columns_syntax:Proc(String,ColumnDef,String,ColumnDef,String,String))-instance-method","name":"insert_2columns_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&insert_2columns_syntax : Proc(String, ColumnDef, String, ColumnDef, String, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L115","def":{"name":"insert_2columns_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"insert_2columns_syntax","doc":null,"default_value":"","external_name":"insert_2columns_syntax","restriction":"Proc(String, ColumnDef, String, ColumnDef, String, String)"},"return_type":"","visibility":"Public","body":"@insert_2columns_syntax = insert_2columns_syntax"}},{"id":"it(description="assert",prepared=:default,file=__FILE__,line=__LINE__,end_line=__END_LINE__,&block:DB::Database->)-instance-method","html_id":"it(description=&quot;assert&quot;,prepared=:default,file=__FILE__,line=__LINE__,end_line=__END_LINE__,&block:DB::Database->)-instance-method","name":"it","doc":null,"summary":null,"abstract":false,"args":[{"name":"description","doc":null,"default_value":"\"assert\"","external_name":"description","restriction":""},{"name":"prepared","doc":null,"default_value":":default","external_name":"prepared","restriction":""},{"name":"file","doc":null,"default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","doc":null,"default_value":"__LINE__","external_name":"line","restriction":""},{"name":"end_line","doc":null,"default_value":"__END_LINE__","external_name":"end_line","restriction":""}],"args_string":"(description = <span class=\"s\">"assert"</span>, prepared = <span class=\"n\">:default</span>, file = __FILE__, line = __LINE__, end_line = __END_LINE__, &block : DB::Database -> )","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L125","def":{"name":"it","args":[{"name":"description","doc":null,"default_value":"\"assert\"","external_name":"description","restriction":""},{"name":"prepared","doc":null,"default_value":":default","external_name":"prepared","restriction":""},{"name":"file","doc":null,"default_value":"__FILE__","external_name":"file","restriction":""},{"name":"line","doc":null,"default_value":"__LINE__","external_name":"line","restriction":""},{"name":"end_line","doc":null,"default_value":"__END_LINE__","external_name":"end_line","restriction":""}],"double_splat":null,"splat_index":null,"yields":1,"block_arg":{"name":"block","doc":null,"default_value":"","external_name":"block","restriction":"(DB::Database -> )"},"return_type":"","visibility":"Public","body":"if Spec.matches?(description, file, line, end_line)\nelse\n return\nend\n@its << (SpecIt.new(description, prepared, file, line, end_line, block))\n"}},{"id":"its-instance-method","html_id":"its-instance-method","name":"its","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L125","def":{"name":"its","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@its"}},{"id":"sample_value(value,sql_type,value_encoded,*,type_safe_value=true)-instance-method","html_id":"sample_value(value,sql_type,value_encoded,*,type_safe_value=true)-instance-method","name":"sample_value","doc":"Use *value* as sample value that should be stored in columns of type *sql_type*.\n*value_encoded* is driver specific expression that should generate that value in the database.\n*type_safe_value* indicates whether *value_encoded* is expected to generate the *value* even without\nbeen stored in a table (default `true`).","summary":"<p>Use <em>value</em> as sample value that should be stored in columns of type <em>sql_type</em>.</p>","abstract":false,"args":[{"name":"value","doc":null,"default_value":"","external_name":"value","restriction":""},{"name":"sql_type","doc":null,"default_value":"","external_name":"sql_type","restriction":""},{"name":"value_encoded","doc":null,"default_value":"","external_name":"value_encoded","restriction":""},{"name":"","doc":null,"default_value":"","external_name":"","restriction":""},{"name":"type_safe_value","doc":null,"default_value":"true","external_name":"type_safe_value","restriction":""}],"args_string":"(value, sql_type, value_encoded, *, type_safe_value = <span class=\"n\">true</span>)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L139","def":{"name":"sample_value","args":[{"name":"value","doc":null,"default_value":"","external_name":"value","restriction":""},{"name":"sql_type","doc":null,"default_value":"","external_name":"sql_type","restriction":""},{"name":"value_encoded","doc":null,"default_value":"","external_name":"value_encoded","restriction":""},{"name":"","doc":null,"default_value":"","external_name":"","restriction":""},{"name":"type_safe_value","doc":null,"default_value":"true","external_name":"type_safe_value","restriction":""}],"double_splat":null,"splat_index":3,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@values << (ValueDef(DBAnyType).new(value, sql_type, value_encoded))\nit(\"select nil as (#{typeof(value)} | Nil)\", prepared: :both) do |db|\n db.query(select_scalar(encode_null, nil)) do |rs|\n assert_single_read(rs, typeof(value || nil), nil)\n end\nend\nvalue_desc = value.to_s\nif value_desc.size > 25\n value_desc = \"#{value_desc[0..25]}...(#{value_desc.size})\"\nend\nvalue_desc = \"#{value_desc} as #{sql_type}\"\nif type_safe_value\n it(\"executes with bind #{value_desc}\") do |db|\n (db.scalar(select_scalar(param(1), sql_type), value)).should(eq(value))\n end\n it(\"executes with bind #{value_desc} as array\") do |db|\n (db.scalar(select_scalar(param(1), sql_type), [value])).should(eq(value))\n end\n it(\"select #{value_desc} as literal\") do |db|\n (db.scalar(select_scalar(value_encoded, sql_type))).should(eq(value))\n db.query(select_scalar(value_encoded, sql_type)) do |rs|\n assert_single_read(rs, typeof(value), value)\n end\n end\nend\nit(\"insert/get value #{value_desc} from table\", prepared: :both) do |db|\n db.exec(sql_create_table_table1(c1 = col1(sql_type)))\n db.exec(sql_insert_table1(c1, value_encoded))\n (db.query_one(sql_select_table1(c1), as: typeof(value))).should(eq(value))\nend\nit(\"insert/get value #{value_desc} from table as nillable\", prepared: :both) do |db|\n db.exec(sql_create_table_table1(c1 = col1(sql_type)))\n db.exec(sql_insert_table1(c1, value_encoded))\n (db.query_one(sql_select_table1(c1), as: ::Union(typeof(value) | Nil))).should(eq(value))\nend\nit(\"insert/get value nil from table as nillable #{sql_type}\", prepared: :both) do |db|\n db.exec(sql_create_table_table1(c1 = col1(sql_type, null: true)))\n db.exec(sql_insert_table1(c1, encode_null))\n (db.query_one(sql_select_table1(c1), as: ::Union(typeof(value) | Nil))).should(eq(nil))\nend\nit(\"insert/get value #{value_desc} from table with binding\") do |db|\n db.exec(sql_create_table_table2(c1 = col1(sql_type_for(String)), c2 = col2(sql_type)))\n db.exec(sql_insert_table2(c1, param(1), c2, param(2)), value_for(String), value)\n (db.query_one(sql_select_table2(c2), as: typeof(value))).should(eq(value))\nend\nit(\"insert/get value #{value_desc} from table as nillable with binding\") do |db|\n db.exec(sql_create_table_table2(c1 = col1(sql_type_for(String)), c2 = col2(sql_type)))\n db.exec(sql_insert_table2(c1, param(1), c2, param(2)), value_for(String), value)\n (db.query_one(sql_select_table2(c2), as: ::Union(typeof(value) | Nil))).should(eq(value))\nend\nit(\"insert/get value nil from table as nillable #{sql_type} with binding\") do |db|\n db.exec(sql_create_table_table2(c1 = col1(sql_type_for(String)), c2 = col2(sql_type, null: true)))\n db.exec(sql_insert_table2(c1, param(1), c2, param(2)), value_for(String), nil)\n (db.query_one(sql_select_table2(c2), as: ::Union(typeof(value) | Nil))).should(eq(nil))\nend\nit(\"can use read(#{typeof(value)}) with DB::ResultSet\", prepared: :both) do |db|\n db.exec(sql_create_table_table1(c1 = col1(sql_type)))\n db.exec(sql_insert_table1(c1, value_encoded))\n db.query(sql_select_table1(c1)) do |rs|\n assert_single_read(rs.as(DB::ResultSet), typeof(value), value)\n end\nend\nit(\"can use read(#{typeof(value)}?) with DB::ResultSet\", prepared: :both) do |db|\n db.exec(sql_create_table_table1(c1 = col1(sql_type)))\n db.exec(sql_insert_table1(c1, value_encoded))\n db.query(sql_select_table1(c1)) do |rs|\n assert_single_read(rs.as(DB::ResultSet), ::Union(typeof(value) | Nil), value)\n end\nend\nit(\"can use read(#{typeof(value)}?) with DB::ResultSet for nil\", prepared: :both) do |db|\n db.exec(sql_create_table_table1(c1 = col1(sql_type, null: true)))\n db.exec(sql_insert_table1(c1, encode_null))\n db.query(sql_select_table1(c1)) do |rs|\n assert_single_read(rs.as(DB::ResultSet), ::Union(typeof(value) | Nil), nil)\n end\nend\n"}},{"id":"select_1column_syntax(&select_1column_syntax:Proc(String,ColumnDef,String))-instance-method","html_id":"select_1column_syntax(&select_1column_syntax:Proc(String,ColumnDef,String))-instance-method","name":"select_1column_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&select_1column_syntax : Proc(String, ColumnDef, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L116","def":{"name":"select_1column_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"select_1column_syntax","doc":null,"default_value":"","external_name":"select_1column_syntax","restriction":"Proc(String, ColumnDef, String)"},"return_type":"","visibility":"Public","body":"@select_1column_syntax = select_1column_syntax"}},{"id":"select_2columns_syntax(&select_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method","html_id":"select_2columns_syntax(&select_2columns_syntax:Proc(String,ColumnDef,ColumnDef,String))-instance-method","name":"select_2columns_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&select_2columns_syntax : Proc(String, ColumnDef, ColumnDef, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L117","def":{"name":"select_2columns_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"select_2columns_syntax","doc":null,"default_value":"","external_name":"select_2columns_syntax","restriction":"Proc(String, ColumnDef, ColumnDef, String)"},"return_type":"","visibility":"Public","body":"@select_2columns_syntax = select_2columns_syntax"}},{"id":"select_count_syntax(&select_count_syntax:Proc(String,String))-instance-method","html_id":"select_count_syntax(&select_count_syntax:Proc(String,String))-instance-method","name":"select_count_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&select_count_syntax : Proc(String, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L118","def":{"name":"select_count_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"select_count_syntax","doc":null,"default_value":"","external_name":"select_count_syntax","restriction":"Proc(String, String)"},"return_type":"","visibility":"Public","body":"@select_count_syntax = select_count_syntax"}},{"id":"select_scalar_syntax(&select_scalar_syntax:Proc(String,String?,String))-instance-method","html_id":"select_scalar_syntax(&select_scalar_syntax:Proc(String,String?,String))-instance-method","name":"select_scalar_syntax","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&select_scalar_syntax : Proc(String, String?, String))","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L111","def":{"name":"select_scalar_syntax","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"select_scalar_syntax","doc":null,"default_value":"","external_name":"select_scalar_syntax","restriction":"Proc(String, String | ::Nil, String)"},"return_type":"","visibility":"Public","body":"@select_scalar_syntax = select_scalar_syntax"}},{"id":"support_prepared(support_prepared:Bool)-instance-method","html_id":"support_prepared(support_prepared:Bool)-instance-method","name":"support_prepared","doc":"Allow specs that uses prepared statements (default `true`)","summary":"<p>Allow specs that uses prepared statements (default <code>true</code>)</p>","abstract":false,"args":[{"name":"support_prepared","doc":null,"default_value":"","external_name":"support_prepared","restriction":"Bool"}],"args_string":"(support_prepared : Bool)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L70","def":{"name":"support_prepared","args":[{"name":"support_prepared","doc":null,"default_value":"","external_name":"support_prepared","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@support_prepared = support_prepared"}},{"id":"support_unprepared(support_unprepared:Bool)-instance-method","html_id":"support_unprepared(support_unprepared:Bool)-instance-method","name":"support_unprepared","doc":"Allow specs that uses unprepared statements (default `true`)","summary":"<p>Allow specs that uses unprepared statements (default <code>true</code>)</p>","abstract":false,"args":[{"name":"support_unprepared","doc":null,"default_value":"","external_name":"support_unprepared","restriction":"Bool"}],"args_string":"(support_unprepared : Bool)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L79","def":{"name":"support_unprepared","args":[{"name":"support_unprepared","doc":null,"default_value":"","external_name":"support_unprepared","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@support_unprepared = support_unprepared"}}],"macros":[],"types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/DriverSpecs/ColumnDef","path":"DB/DriverSpecs/ColumnDef.html","kind":"struct","full_name":"DB::DriverSpecs::ColumnDef","name":"ColumnDef","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"github.com/crystal-lang/crystal-db/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"spec.cr","line_number":52,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB/DriverSpecs","kind":"class","full_name":"DB::DriverSpecs(DBAnyType)","name":"DriverSpecs"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(name:String,sql_type:String,null:Bool)-class-method","html_id":"new(name:String,sql_type:String,null:Bool)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"},{"name":"sql_type","doc":null,"default_value":"","external_name":"sql_type","restriction":"String"},{"name":"null","doc":null,"default_value":"","external_name":"null","restriction":"Bool"}],"args_string":"(name : String, sql_type : String, null : Bool)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L52","def":{"name":"new","args":[{"name":"name","doc":null,"default_value":"","external_name":"name","restriction":"String"},{"name":"sql_type","doc":null,"default_value":"","external_name":"sql_type","restriction":"String"},{"name":"null","doc":null,"default_value":"","external_name":"null","restriction":"Bool"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(name, sql_type, null)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"clone-instance-method","html_id":"clone-instance-method","name":"clone","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L52","def":{"name":"clone","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.class.new(@name.clone, @sql_type.clone, @null.clone)"}},{"id":"copy_with(name_name=@name,sql_type_sql_type=@sql_type,null_null=@null)-instance-method","html_id":"copy_with(name_name=@name,sql_type_sql_type=@sql_type,null_null=@null)-instance-method","name":"copy_with","doc":null,"summary":null,"abstract":false,"args":[{"name":"_name","doc":null,"default_value":"@name","external_name":"name","restriction":""},{"name":"_sql_type","doc":null,"default_value":"@sql_type","external_name":"sql_type","restriction":""},{"name":"_null","doc":null,"default_value":"@null","external_name":"null","restriction":""}],"args_string":"(name _name = @name, sql_type _sql_type = @sql_type, null _null = @null)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/spec.cr#L52","def":{"name":"copy_with","args":[{"name":"_name","doc":null,"default_value":"@name","external_name":"name","restriction":""},{"name":"_sql_type","doc":null,"default_value":"@sql_type","external_name":"sql_type","restriction":""},{"name":"_null","doc":null,"default_value":"@null","external_name":"null","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.class.new(_name, _sql_type, _null)"}},{"id":"name:String-instance-method","html_id":"name:String-instance-method","name":"name","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":null,"def":{"name":"name","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@name"}},{"id":"null:Bool-instance-method","html_id":"null:Bool-instance-method","name":"null","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Bool","source_link":null,"def":{"name":"null","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":"@null"}},{"id":"sql_type:String-instance-method","html_id":"sql_type:String-instance-method","name":"sql_type","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : String","source_link":null,"def":{"name":"sql_type","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":"@sql_type"}}],"macros":[],"types":[]}]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","path":"DB/Error.html","kind":"class","full_name":"DB::Error","name":"Error","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/error.cr","line_number":2,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[{"html_id":"github.com/crystal-lang/crystal-db/DB/ConnectionLost","kind":"class","full_name":"DB::ConnectionLost","name":"ConnectionLost"},{"html_id":"github.com/crystal-lang/crystal-db/DB/ConnectionRefused","kind":"class","full_name":"DB::ConnectionRefused","name":"ConnectionRefused"},{"html_id":"github.com/crystal-lang/crystal-db/DB/MappingException","kind":"class","full_name":"DB::MappingException","name":"MappingException"},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded","kind":"class","full_name":"DB::PoolRetryAttemptsExceeded","name":"PoolRetryAttemptsExceeded"},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolTimeout","kind":"class","full_name":"DB::PoolTimeout","name":"PoolTimeout"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Rollback","kind":"class","full_name":"DB::Rollback","name":"Rollback"}],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/ExecResult","path":"DB/ExecResult.html","kind":"struct","full_name":"DB::ExecResult","name":"ExecResult","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"github.com/crystal-lang/crystal-db/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db.cr","line_number":89,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Result of a `#exec` statement.","summary":"<p>Result of a <code>#exec</code> statement.</p>","class_methods":[],"constructors":[{"id":"new(rows_affected:Int64,last_insert_id:Int64)-class-method","html_id":"new(rows_affected:Int64,last_insert_id:Int64)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"rows_affected","doc":null,"default_value":"","external_name":"rows_affected","restriction":"Int64"},{"name":"last_insert_id","doc":null,"default_value":"","external_name":"last_insert_id","restriction":"Int64"}],"args_string":"(rows_affected : Int64, last_insert_id : Int64)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L89","def":{"name":"new","args":[{"name":"rows_affected","doc":null,"default_value":"","external_name":"rows_affected","restriction":"Int64"},{"name":"last_insert_id","doc":null,"default_value":"","external_name":"last_insert_id","restriction":"Int64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(rows_affected, last_insert_id)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"clone-instance-method","html_id":"clone-instance-method","name":"clone","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L89","def":{"name":"clone","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.class.new(@rows_affected.clone, @last_insert_id.clone)"}},{"id":"copy_with(rows_affected_rows_affected=@rows_affected,last_insert_id_last_insert_id=@last_insert_id)-instance-method","html_id":"copy_with(rows_affected_rows_affected=@rows_affected,last_insert_id_last_insert_id=@last_insert_id)-instance-method","name":"copy_with","doc":null,"summary":null,"abstract":false,"args":[{"name":"_rows_affected","doc":null,"default_value":"@rows_affected","external_name":"rows_affected","restriction":""},{"name":"_last_insert_id","doc":null,"default_value":"@last_insert_id","external_name":"last_insert_id","restriction":""}],"args_string":"(rows_affected _rows_affected = @rows_affected, last_insert_id _last_insert_id = @last_insert_id)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db.cr#L89","def":{"name":"copy_with","args":[{"name":"_rows_affected","doc":null,"default_value":"@rows_affected","external_name":"rows_affected","restriction":""},{"name":"_last_insert_id","doc":null,"default_value":"@last_insert_id","external_name":"last_insert_id","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"self.class.new(_rows_affected, _last_insert_id)"}},{"id":"last_insert_id:Int64-instance-method","html_id":"last_insert_id:Int64-instance-method","name":"last_insert_id","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int64","source_link":null,"def":{"name":"last_insert_id","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int64","visibility":"Public","body":"@last_insert_id"}},{"id":"rows_affected:Int64-instance-method","html_id":"rows_affected:Int64-instance-method","name":"rows_affected","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Int64","source_link":null,"def":{"name":"rows_affected","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int64","visibility":"Public","body":"@rows_affected"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Mappable","path":"DB/Mappable.html","kind":"module","full_name":"DB::Mappable","name":"Mappable","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"db/mapping.cr","line_number":3,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/mapping.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Empty module used for marking a class as supporting DB:Mapping","summary":"<p>Empty module used for marking a class as supporting DB:Mapping</p>","class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/MappingException","path":"DB/MappingException.html","kind":"class","full_name":"DB::MappingException","name":"MappingException","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/error.cr","line_number":5,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Pool","path":"DB/Pool.html","kind":"class","full_name":"DB::Pool(T)","name":"Pool","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/pool.cr","line_number":4,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(initial_pool_size=1,max_pool_size=0,max_idle_pool_size=1,checkout_timeout=5.0,retry_attempts=1,retry_delay=0.2,&factory:->T)-class-method","html_id":"new(initial_pool_size=1,max_pool_size=0,max_idle_pool_size=1,checkout_timeout=5.0,retry_attempts=1,retry_delay=0.2,&factory:->T)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"initial_pool_size","doc":null,"default_value":"1","external_name":"initial_pool_size","restriction":""},{"name":"max_pool_size","doc":null,"default_value":"0","external_name":"max_pool_size","restriction":""},{"name":"max_idle_pool_size","doc":null,"default_value":"1","external_name":"max_idle_pool_size","restriction":""},{"name":"checkout_timeout","doc":null,"default_value":"5.0","external_name":"checkout_timeout","restriction":""},{"name":"retry_attempts","doc":null,"default_value":"1","external_name":"retry_attempts","restriction":""},{"name":"retry_delay","doc":null,"default_value":"0.2","external_name":"retry_delay","restriction":""}],"args_string":"(initial_pool_size = <span class=\"n\">1</span>, max_pool_size = <span class=\"n\">0</span>, max_idle_pool_size = <span class=\"n\">1</span>, checkout_timeout = <span class=\"n\">5.0</span>, retry_attempts = <span class=\"n\">1</span>, retry_delay = <span class=\"n\">0.2</span>, &factory : -> T)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L15","def":{"name":"new","args":[{"name":"initial_pool_size","doc":null,"default_value":"1","external_name":"initial_pool_size","restriction":""},{"name":"max_pool_size","doc":null,"default_value":"0","external_name":"max_pool_size","restriction":""},{"name":"max_idle_pool_size","doc":null,"default_value":"1","external_name":"max_idle_pool_size","restriction":""},{"name":"checkout_timeout","doc":null,"default_value":"5.0","external_name":"checkout_timeout","restriction":""},{"name":"retry_attempts","doc":null,"default_value":"1","external_name":"retry_attempts","restriction":""},{"name":"retry_delay","doc":null,"default_value":"0.2","external_name":"retry_delay","restriction":""}],"double_splat":null,"splat_index":null,"yields":0,"block_arg":{"name":"factory","doc":null,"default_value":"","external_name":"factory","restriction":"(-> T)"},"return_type":"","visibility":"Public","body":"_ = Pool(T).allocate\n_.initialize(initial_pool_size, max_pool_size, max_idle_pool_size, checkout_timeout, retry_attempts, retry_delay, &factory) do\n yield\nend\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"checkout:T-instance-method","html_id":"checkout:T-instance-method","name":"checkout","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : T","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L31","def":{"name":"checkout","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"T","visibility":"Public","body":"resource = if @available.empty?\n if can_increase_pool\n build_resource\n else\n wait_for_available\n pick_available\n end\nelse\n pick_available\nend\n@available.delete(resource)\nresource.before_checkout\nresource\n"}},{"id":"checkout_some(candidates:Enumerable(WeakRef(T))):::Tuple(T,Bool)-instance-method","html_id":"checkout_some(candidates:Enumerable(WeakRef(T))):::Tuple(T,Bool)-instance-method","name":"checkout_some","doc":"```\nselected, is_candidate = pool.checkout_some(candidates)\n```\n`selected` be a resource from the `candidates` list and `is_candidate` == `true`\nor `selected` will be a new resource and `is_candidate` == `false`","summary":"<p><code></code>` selected, is_candidate = pool.checkout_some(candidates) <code></code>` <code>selected</code> be a resource from the <code>candidates</code> list and <code>is_candidate</code> == <code>true</code> or <code>selected</code> will be a new resource and <code>is_candidate</code> == <code>false</code></p>","abstract":false,"args":[{"name":"candidates","doc":null,"default_value":"","external_name":"candidates","restriction":"Enumerable(WeakRef(T))"}],"args_string":"(candidates : Enumerable(WeakRef(T))) : ::Tuple(T, Bool)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L53","def":{"name":"checkout_some","args":[{"name":"candidates","doc":null,"default_value":"","external_name":"candidates","restriction":"Enumerable(WeakRef(T))"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"::Tuple(T, Bool)","visibility":"Public","body":"candidates.each do |ref|\n resource = ref.value\n if resource && (is_available?(resource))\n @available.delete(resource)\n resource.before_checkout\n return {resource, true}\n end\nend\nresource = checkout\n{resource, candidates.any? do |ref|\n ref.value == resource\nend}\n"}},{"id":"close:Nil-instance-method","html_id":"close:Nil-instance-method","name":"close","doc":"close all resources in the pool","summary":"<p>close all resources in the pool</p>","abstract":false,"args":[],"args_string":" : Nil","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L25","def":{"name":"close","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Nil","visibility":"Public","body":"@total.each(&.close)\n@total.clear\n@available.clear\n"}},{"id":"release(resource:T):Nil-instance-method","html_id":"release(resource:T):Nil-instance-method","name":"release","doc":null,"summary":null,"abstract":false,"args":[{"name":"resource","doc":null,"default_value":"","external_name":"resource","restriction":"T"}],"args_string":"(resource : T) : Nil","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L69","def":{"name":"release","args":[{"name":"resource","doc":null,"default_value":"","external_name":"resource","restriction":"T"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Nil","visibility":"Public","body":"if can_increase_idle_pool\n @available << resource\n resource.after_release\n if are_waiting_for_resource?\n @availability_channel.send(nil)\n end\nelse\n resource.close\n @total.delete(resource)\nend"}}],"macros":[],"types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Pool/TimeoutHelper","path":"DB/Pool/TimeoutHelper.html","kind":"class","full_name":"DB::Pool::TimeoutHelper","name":"TimeoutHelper","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/pool.cr","line_number":183,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB/Pool","kind":"class","full_name":"DB::Pool(T)","name":"Pool"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(timeout:Float64)-class-method","html_id":"new(timeout:Float64)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"timeout","doc":null,"default_value":"","external_name":"timeout","restriction":"Float64"}],"args_string":"(timeout : Float64)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L184","def":{"name":"new","args":[{"name":"timeout","doc":null,"default_value":"","external_name":"timeout","restriction":"Float64"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(timeout)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"cancel-instance-method","html_id":"cancel-instance-method","name":"cancel","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L202","def":{"name":"cancel","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@abort_timeout = true"}},{"id":"receive_select_action-instance-method","html_id":"receive_select_action-instance-method","name":"receive_select_action","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L189","def":{"name":"receive_select_action","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@timeout_channel.receive_select_action"}},{"id":"start-instance-method","html_id":"start-instance-method","name":"start","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool.cr#L193","def":{"name":"start","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"spawn do\n sleep(@timeout)\n if @abort_timeout\n else\n @timeout_channel.send(nil)\n end\nend"}}],"macros":[],"types":[]}]},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement","path":"DB/PoolPreparedStatement.html","kind":"class","full_name":"DB::PoolPreparedStatement","name":"PoolPreparedStatement","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolStatement","kind":"class","full_name":"DB::PoolStatement","name":"PoolStatement"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolStatement","kind":"class","full_name":"DB::PoolStatement","name":"PoolStatement"},{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/pool_prepared_statement.cr","line_number":7,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_prepared_statement.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Represents a statement to be executed in any of the connections\nof the pool. The statement is not be executed in a prepared fashion.\nThe execution of the statement is retried according to the pool configuration.\n\nSee `PoolStatement`","summary":"<p>Represents a statement to be executed in any of the connections of the pool.</p>","class_methods":[],"constructors":[{"id":"new(db:Database,query:String)-class-method","html_id":"new(db:Database,query:String)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"Database"},{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":"String"}],"args_string":"(db : Database, query : String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_prepared_statement.cr#L11","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"Database"},{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db, query)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolRetryAttemptsExceeded","path":"DB/PoolRetryAttemptsExceeded.html","kind":"class","full_name":"DB::PoolRetryAttemptsExceeded","name":"PoolRetryAttemptsExceeded","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/error.cr","line_number":11,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolStatement","path":"DB/PoolStatement.html","kind":"class","full_name":"DB::PoolStatement","name":"PoolStatement","abstract":true,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/pool_statement.cr","line_number":6,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods"}],"extended_modules":[],"subclasses":[{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolPreparedStatement","kind":"class","full_name":"DB::PoolPreparedStatement","name":"PoolPreparedStatement"},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement","kind":"class","full_name":"DB::PoolUnpreparedStatement","name":"PoolUnpreparedStatement"}],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"When a statement is to be executed in a DB that has a connection pool\na statement from the DB needs to be able to represent a statement in any\nof the connections of the pool. Otherwise the user will need to deal with\nactual connections in some point.","summary":"<p>When a statement is to be executed in a DB that has a connection pool a statement from the DB needs to be able to represent a statement in any of the connections of the pool.</p>","class_methods":[],"constructors":[{"id":"new(db:Database,query:String)-class-method","html_id":"new(db:Database,query:String)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"Database"},{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":"String"}],"args_string":"(db : Database, query : String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L9","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"Database"},{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db, query)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"exec(args:Array):ExecResult-instance-method","html_id":"exec(args:Array):ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"args_string":"(args : Array) : ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L23","def":{"name":"exec","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ExecResult","visibility":"Public","body":"statement_with_retry(&.exec(args))"}},{"id":"exec:ExecResult-instance-method","html_id":"exec:ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":false,"args":[],"args_string":" : ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L13","def":{"name":"exec","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ExecResult","visibility":"Public","body":"statement_with_retry(&.exec)"}},{"id":"exec(*args):ExecResult-instance-method","html_id":"exec(*args):ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args) : ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L18","def":{"name":"exec","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"ExecResult","visibility":"Public","body":"statement_with_retry(&.exec(*args))"}},{"id":"query(args:Array):ResultSet-instance-method","html_id":"query(args:Array):ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"args_string":"(args : Array) : ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L38","def":{"name":"query","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ResultSet","visibility":"Public","body":"statement_with_retry(&.query(args))"}},{"id":"query:ResultSet-instance-method","html_id":"query:ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":false,"args":[],"args_string":" : ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L28","def":{"name":"query","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ResultSet","visibility":"Public","body":"statement_with_retry(&.query)"}},{"id":"query(*args):ResultSet-instance-method","html_id":"query(*args):ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args) : ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L33","def":{"name":"query","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"ResultSet","visibility":"Public","body":"statement_with_retry(&.query(*args))"}},{"id":"scalar(*args)-instance-method","html_id":"scalar(*args)-instance-method","name":"scalar","doc":"See `QueryMethods#scalar`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#scalar(query,*args)-instance-method\">QueryMethods#scalar</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_statement.cr#L43","def":{"name":"scalar","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"statement_with_retry(&.scalar(*args))"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolTimeout","path":"DB/PoolTimeout.html","kind":"class","full_name":"DB::PoolTimeout","name":"PoolTimeout","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/error.cr","line_number":8,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolUnpreparedStatement","path":"DB/PoolUnpreparedStatement.html","kind":"class","full_name":"DB::PoolUnpreparedStatement","name":"PoolUnpreparedStatement","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolStatement","kind":"class","full_name":"DB::PoolStatement","name":"PoolStatement"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolStatement","kind":"class","full_name":"DB::PoolStatement","name":"PoolStatement"},{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/pool_unprepared_statement.cr","line_number":7,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_unprepared_statement.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Represents a statement to be executed in any of the connections\nof the pool. The statement is not be executed in a non prepared fashion.\nThe execution of the statement is retried according to the pool configuration.\n\nSee `PoolStatement`","summary":"<p>Represents a statement to be executed in any of the connections of the pool.</p>","class_methods":[],"constructors":[{"id":"new(db:Database,query:String)-class-method","html_id":"new(db:Database,query:String)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"Database"},{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":"String"}],"args_string":"(db : Database, query : String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/pool_unprepared_statement.cr#L8","def":{"name":"new","args":[{"name":"db","doc":null,"default_value":"","external_name":"db","restriction":"Database"},{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(db, query)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","path":"DB/QueryMethods.html","kind":"module","full_name":"DB::QueryMethods(Stmt)","name":"QueryMethods","abstract":false,"superclass":null,"ancestors":[],"locations":[{"filename":"db/query_methods.cr","line_number":20,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","kind":"module","full_name":"DB::SessionMethods(Session, Stmt)","name":"SessionMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery","kind":"struct","full_name":"DB::SessionMethods::PreparedQuery(Session, Stmt)","name":"PreparedQuery"},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery","kind":"struct","full_name":"DB::SessionMethods::UnpreparedQuery(Session, Stmt)","name":"UnpreparedQuery"}],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Methods to allow querying a database.\nAll methods accepts a `query : String` and a set arguments.\n\nThree kind of statements can be performed:\n 1. `#exec` waits no record response from the database. An `ExecResult` is returned.\n 2. `#scalar` reads a single value of the response. A union of possible values is returned.\n 3. `#query` returns a `ResultSet` that allows iteration over the rows in the response and column information.\n\nArguments can be passed by position\n\n```\ndb.query(\"SELECT name FROM ... WHERE age > ?\", age)\n```\n\nConvention of mapping how arguments are mapped to the query depends on each driver.\n\nIncluding `QueryMethods` requires a `build(query) : Statement` method that is not expected\nto be called directly.","summary":"<p>Methods to allow querying a database.</p>","class_methods":[],"constructors":[],"instance_methods":[{"id":"exec(query,*args)-instance-method","html_id":"exec(query,*args)-instance-method","name":"exec","doc":"Performs the `query` and returns an `ExecResult`","summary":"<p>Performs the <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">#query</a></code> and returns an <code><a href=\"../DB/ExecResult.html\">ExecResult</a></code></p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L262","def":{"name":"exec","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(build(query)).exec(*args)"}},{"id":"query(query,*args)-instance-method","html_id":"query(query,*args)-instance-method","name":"query","doc":"Executes a *query* and returns a `ResultSet` with the results.\nThe `ResultSet` must be closed manually.\n\n```\nresult = db.query \"select name from contacts where id = ?\", 10\nbegin\n if result.move_next\n id = result.read(Int32)\n end\nensure\n result.close\nend\n```","summary":"<p>Executes a <em>query</em> and returns a <code><a href=\"../DB/ResultSet.html\">ResultSet</a></code> with the results.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L37","def":{"name":"query","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(build(query)).query(*args)"}},{"id":"query(query,*args,&block)-instance-method","html_id":"query(query,*args,&block)-instance-method","name":"query","doc":"Executes a *query* and yields a `ResultSet` with the results.\nThe `ResultSet` is closed automatically.\n\n```\ndb.query(\"select name from contacts where age > ?\", 18) do |rs|\n rs.each do\n name = rs.read(String)\n end\nend\n```","summary":"<p>Executes a <em>query</em> and yields a <code><a href=\"../DB/ResultSet.html\">ResultSet</a></code> with the results.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args, &block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L51","def":{"name":"query","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"rs = query(query, *args)\nbegin\n yield rs\nensure\n rs.close\nend\n"}},{"id":"query_all(query,*args,astype:Class)-instance-method","html_id":"query_all(query,*args,astype:Class)-instance-method","name":"query_all","doc":"Executes a *query* and returns an array where the\nvalue of each row is read as the given *type*.\n\n```\nnames = db.query_all \"select name from contacts\", as: String\n```","summary":"<p>Executes a <em>query</em> and returns an array where the value of each row is read as the given <em>type</em>.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"as","restriction":"Class"}],"args_string":"(query, *args, as type : Class)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L239","def":{"name":"query_all","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"as","restriction":"Class"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_all(query, *args) do |rs|\n rs.read(type)\nend"}},{"id":"query_all(query,*args,astypes:NamedTuple)-instance-method","html_id":"query_all(query,*args,astypes:NamedTuple)-instance-method","name":"query_all","doc":"Executes a *query* and returns an array where each row is\nread as a named tuple of the given *types* (the keys of the named tuple\nare not necessarily the column names).\n\n```\ncontacts = db.query_all \"select name, age from contacts\", as: {name: String, age: Int32}\n```","summary":"<p>Executes a <em>query</em> and returns an array where each row is read as a named tuple of the given <em>types</em> (the keys of the named tuple are not necessarily the column names).</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"NamedTuple"}],"args_string":"(query, *args, as types : NamedTuple)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L227","def":{"name":"query_all","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"NamedTuple"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_all(query, *args) do |rs|\n rs.read(**types)\nend"}},{"id":"query_all(query,*args,&block:ResultSet->U):Array(U)forallU-instance-method","html_id":"query_all(query,*args,&block:ResultSet->U):Array(U)forallU-instance-method","name":"query_all","doc":"Executes a *query* and yield a `ResultSet` positioned at the beginning\nof each row, returning an array of the values of the blocks.\n\n```\nnames = db.query_all \"select name from contacts\", &.read(String)\n```","summary":"<p>Executes a <em>query</em> and yield a <code><a href=\"../DB/ResultSet.html\">ResultSet</a></code> positioned at the beginning of each row, returning an array of the values of the blocks.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args, &block : ResultSet -> U) : Array(U) forall U","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L200","def":{"name":"query_all","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":1,"block_arg":{"name":"block","doc":null,"default_value":"","external_name":"block","restriction":"(ResultSet -> U)"},"return_type":"Array(U)","visibility":"Public","body":"ary = [] of U\nquery_each(query, *args) do |rs|\n ary.push(yield rs)\nend\nary\n"}},{"id":"query_all(query,*args,astypes:Tuple)-instance-method","html_id":"query_all(query,*args,astypes:Tuple)-instance-method","name":"query_all","doc":"Executes a *query* and returns an array where each row is\nread as a tuple of the given *types*.\n\n```\ncontacts = db.query_all \"select name, age from contacts\", as: {String, Int32}\n```","summary":"<p>Executes a <em>query</em> and returns an array where each row is read as a tuple of the given <em>types</em>.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"Tuple"}],"args_string":"(query, *args, as types : Tuple)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L214","def":{"name":"query_all","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"Tuple"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_all(query, *args) do |rs|\n rs.read(*types)\nend"}},{"id":"query_each(query,*args,&block)-instance-method","html_id":"query_each(query,*args,&block)-instance-method","name":"query_each","doc":"Executes a *query* and yields the `ResultSet` once per each row.\nThe `ResultSet` is closed automatically.\n\n```\ndb.query_each \"select name from contacts\" do |rs|\n puts rs.read(String)\nend\n```","summary":"<p>Executes a <em>query</em> and yields the <code><a href=\"../DB/ResultSet.html\">ResultSet</a></code> once per each row.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args, &block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L253","def":{"name":"query_each","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"query(query, *args) do |rs|\n rs.each do\n yield rs\n end\nend"}},{"id":"query_one(query,*args,&block:ResultSet->U):UforallU-instance-method","html_id":"query_one(query,*args,&block:ResultSet->U):UforallU-instance-method","name":"query_one","doc":"Executes a *query* that expects a single row and yields a `ResultSet`\npositioned at that first row.\n\nThe given block must not invoke `move_next` on the yielded result set.\n\nRaises `DB::Error` if there were no rows, or if there were more than one row.\n\n```\nname = db.query_one \"select name from contacts where id = ?\", 18, &.read(String)\n```","summary":"<p>Executes a <em>query</em> that expects a single row and yields a <code><a href=\"../DB/ResultSet.html\">ResultSet</a></code> positioned at that first row.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args, &block : ResultSet -> U) : U forall U","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L67","def":{"name":"query_one","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":1,"block_arg":{"name":"block","doc":null,"default_value":"","external_name":"block","restriction":"(ResultSet -> U)"},"return_type":"U","visibility":"Public","body":"query(query, *args) do |rs|\n if rs.move_next\n else\n raise(DB::Error.new(\"no rows\"))\n end\n value = yield rs\n if rs.move_next\n raise(DB::Error.new(\"more than one row\"))\n end\n return value\nend"}},{"id":"query_one(query,*args,astypes:Tuple)-instance-method","html_id":"query_one(query,*args,astypes:Tuple)-instance-method","name":"query_one","doc":"Executes a *query* that expects a single row and returns it\nas a tuple of the given *types*.\n\nRaises `DB::Error` if there were no rows, or if there were more than one row.\n\n```\ndb.query_one \"select name, age from contacts where id = ?\", 1, as: {String, Int32}\n```","summary":"<p>Executes a <em>query</em> that expects a single row and returns it as a tuple of the given <em>types</em>.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"Tuple"}],"args_string":"(query, *args, as types : Tuple)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L85","def":{"name":"query_one","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"Tuple"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_one(query, *args) do |rs|\n rs.read(*types)\nend"}},{"id":"query_one(query,*args,astypes:NamedTuple)-instance-method","html_id":"query_one(query,*args,astypes:NamedTuple)-instance-method","name":"query_one","doc":"Executes a *query* that expects a single row and returns it\nas a named tuple of the given *types* (the keys of the named tuple\nare not necessarily the column names).\n\nRaises `DB::Error` if there were no rows, or if there were more than one row.\n\n```\ndb.query_one \"select name, age from contacts where id = ?\", 1, as: {name: String, age: Int32}\n```","summary":"<p>Executes a <em>query</em> that expects a single row and returns it as a named tuple of the given <em>types</em> (the keys of the named tuple are not necessarily the column names).</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"NamedTuple"}],"args_string":"(query, *args, as types : NamedTuple)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L100","def":{"name":"query_one","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"NamedTuple"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_one(query, *args) do |rs|\n rs.read(**types)\nend"}},{"id":"query_one(query,*args,astype:Class)-instance-method","html_id":"query_one(query,*args,astype:Class)-instance-method","name":"query_one","doc":"Executes a *query* that expects a single row\nand returns the first column's value as the given *type*.\n\nRaises `DB::Error` if there were no rows, or if there were more than one row.\n\n```\ndb.query_one \"select name from contacts where id = ?\", 1, as: String\n```","summary":"<p>Executes a <em>query</em> that expects a single row and returns the first column's value as the given <em>type</em>.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"as","restriction":"Class"}],"args_string":"(query, *args, as type : Class)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L114","def":{"name":"query_one","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"as","restriction":"Class"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_one(query, *args) do |rs|\n rs.read(type)\nend"}},{"id":"query_one?(query,*args,astype:Class)-instance-method","html_id":"query_one?(query,*args,astype:Class)-instance-method","name":"query_one?","doc":"Executes a *query* that expects a single row\nand returns the first column's value as the given *type*.\n\nReturns `nil` if there were no rows.\n\nRaises `DB::Error` if there were more than one row.\n\n```\nname = db.query_one? \"select name from contacts where id = ?\", 1, as: String\ntypeof(name) # => String?\n```","summary":"<p>Executes a <em>query</em> that expects a single row and returns the first column's value as the given <em>type</em>.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"as","restriction":"Class"}],"args_string":"(query, *args, as type : Class)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L188","def":{"name":"query_one?","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"type","doc":null,"default_value":"","external_name":"as","restriction":"Class"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_one?(query, *args) do |rs|\n rs.read(type)\nend"}},{"id":"query_one?(query,*args,astypes:NamedTuple)-instance-method","html_id":"query_one?(query,*args,astypes:NamedTuple)-instance-method","name":"query_one?","doc":"Executes a *query* that expects a single row and returns it\nas a named tuple of the given *types* (the keys of the named tuple\nare not necessarily the column names).\n\nReturns `nil` if there were no rows.\n\nRaises `DB::Error` if there were more than one row.\n\n```\nresult = db.query_one? \"select name, age from contacts where id = ?\", 1, as: {age: String, name: Int32}\ntypeof(result) # => NamedTuple(age: String, name: Int32) | Nil\n```","summary":"<p>Executes a <em>query</em> that expects a single row and returns it as a named tuple of the given <em>types</em> (the keys of the named tuple are not necessarily the column names).</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"NamedTuple"}],"args_string":"(query, *args, as types : NamedTuple)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L171","def":{"name":"query_one?","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"NamedTuple"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_one?(query, *args) do |rs|\n rs.read(**types)\nend"}},{"id":"query_one?(query,*args,astypes:Tuple)-instance-method","html_id":"query_one?(query,*args,astypes:Tuple)-instance-method","name":"query_one?","doc":"Executes a *query* that expects a single row and returns it\nas a tuple of the given *types*.\n\nReturns `nil` if there were no rows.\n\nRaises `DB::Error` if there were more than one row.\n\n```\nresult = db.query_one? \"select name, age from contacts where id = ?\", 1, as: {String, Int32}\ntypeof(result) # => Tuple(String, Int32) | Nil\n```","summary":"<p>Executes a <em>query</em> that expects a single row and returns it as a tuple of the given <em>types</em>.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"Tuple"}],"args_string":"(query, *args, as types : Tuple)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L153","def":{"name":"query_one?","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""},{"name":"types","doc":null,"default_value":"","external_name":"as","restriction":"Tuple"}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query_one?(query, *args) do |rs|\n rs.read(*types)\nend"}},{"id":"query_one?(query,*args,&block:ResultSet->U):U?forallU-instance-method","html_id":"query_one?(query,*args,&block:ResultSet->U):U?forallU-instance-method","name":"query_one?","doc":"Executes a *query* that expects at most a single row and yields a `ResultSet`\npositioned at that first row.\n\nReturns `nil`, not invoking the block, if there were no rows.\n\nRaises `DB::Error` if there were more than one row\n(this ends up invoking the block once).\n\n```\nname = db.query_one? \"select name from contacts where id = ?\", 18, &.read(String)\ntypeof(name) # => String | Nil\n```","summary":"<p>Executes a <em>query</em> that expects at most a single row and yields a <code><a href=\"../DB/ResultSet.html\">ResultSet</a></code> positioned at that first row.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args, &block : ResultSet -> U) : U? forall U","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L132","def":{"name":"query_one?","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":1,"block_arg":{"name":"block","doc":null,"default_value":"","external_name":"block","restriction":"(ResultSet -> U)"},"return_type":"U | ::Nil","visibility":"Public","body":"query(query, *args) do |rs|\n if rs.move_next\n else\n return nil\n end\n value = yield rs\n if rs.move_next\n raise(DB::Error.new(\"more than one row\"))\n end\n return value\nend"}},{"id":"scalar(query,*args)-instance-method","html_id":"scalar(query,*args)-instance-method","name":"scalar","doc":"Performs the `query` and returns a single scalar value\n\n```\nputs db.scalar(\"SELECT MAX(name)\").as(String) # => (a String)\n```","summary":"<p>Performs the <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">#query</a></code> and returns a single scalar value</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(query, *args)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/query_methods.cr#L271","def":{"name":"scalar","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""},{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":1,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"(build(query)).scalar(*args)"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/ResultSet","path":"DB/ResultSet.html","kind":"class","full_name":"DB::ResultSet","name":"ResultSet","abstract":true,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/result_set.cr","line_number":22,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"The response of a query performed on a `Database`.\n\nSee `DB` for a complete sample.\n\nEach `#read` call consumes the result and moves to the next column.\nEach column must be read in order.\nAt any moment a `#move_next` can be invoked, meaning to skip the\nremaining, or even all the columns, in the current row.\nAlso it is not mandatory to consume the whole `ResultSet`, hence an iteration\nthrough `#each` or `#move_next` can be stopped.\n\n**Note:** depending on how the `ResultSet` was obtained it might be mandatory an\nexplicit call to `#close`. Check `QueryMethods#query`.\n\n### Note to implementors\n\n1. Override `#move_next` to move to the next row.\n2. Override `#read` returning the next value in the row.\n3. (Optional) Override `#read(t)` for some types `t` for which custom logic other than a simple cast is needed.\n4. Override `#column_count`, `#column_name`.","summary":"<p>The response of a query performed on a <code><a href=\"../DB/Database.html\">Database</a></code>.</p>","class_methods":[],"constructors":[{"id":"new(statement:DB::Statement)-class-method","html_id":"new(statement:DB::Statement)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"statement","doc":null,"default_value":"","external_name":"statement","restriction":"DB::Statement"}],"args_string":"(statement : DB::Statement)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L28","def":{"name":"new","args":[{"name":"statement","doc":null,"default_value":"","external_name":"statement","restriction":"DB::Statement"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(statement)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"column_count:Int32-instance-method","html_id":"column_count:Int32-instance-method","name":"column_count","doc":"Returns the number of columns in the result","summary":"<p>Returns the number of columns in the result</p>","abstract":true,"args":[],"args_string":" : Int32","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L59","def":{"name":"column_count","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Int32","visibility":"Public","body":""}},{"id":"column_name(index:Int32):String-instance-method","html_id":"column_name(index:Int32):String-instance-method","name":"column_name","doc":"Returns the name of the column in `index` 0-based position.","summary":"<p>Returns the name of the column in <code>index</code> 0-based position.</p>","abstract":true,"args":[{"name":"index","doc":null,"default_value":"","external_name":"index","restriction":"Int32"}],"args_string":"(index : Int32) : String","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L62","def":{"name":"column_name","args":[{"name":"index","doc":null,"default_value":"","external_name":"index","restriction":"Int32"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"String","visibility":"Public","body":""}},{"id":"column_names-instance-method","html_id":"column_names-instance-method","name":"column_names","doc":"Returns the name of the columns.","summary":"<p>Returns the name of the columns.</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L65","def":{"name":"column_names","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"Array(String).new(column_count) do |i|\n column_name(i)\nend"}},{"id":"each(&block)-instance-method","html_id":"each(&block)-instance-method","name":"each","doc":"Iterates over all the rows","summary":"<p>Iterates over all the rows</p>","abstract":false,"args":[],"args_string":"(&block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L38","def":{"name":"each","args":[],"double_splat":null,"splat_index":null,"yields":0,"block_arg":null,"return_type":"","visibility":"Public","body":"while move_next\n yield\nend"}},{"id":"each_column(&block)-instance-method","html_id":"each_column(&block)-instance-method","name":"each_column","doc":"Iterates over all the columns","summary":"<p>Iterates over all the columns</p>","abstract":false,"args":[],"args_string":"(&block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L45","def":{"name":"each_column","args":[],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"column_count.times do |x|\n yield column_name(x)\nend"}},{"id":"move_next:Bool-instance-method","html_id":"move_next:Bool-instance-method","name":"move_next","doc":"Move the next row in the result.\nReturn `false` if no more rows are available.\nSee `#each`","summary":"<p>Move the next row in the result.</p>","abstract":true,"args":[],"args_string":" : Bool","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L54","def":{"name":"move_next","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":""}},{"id":"read(type:DB::Mappable.class)-instance-method","html_id":"read(type:DB::Mappable.class)-instance-method","name":"read","doc":"Reads the next columns and maps them to a class","summary":"<p>Reads the next columns and maps them to a class</p>","abstract":false,"args":[{"name":"type","doc":null,"default_value":"","external_name":"type","restriction":"DB::Mappable.class"}],"args_string":"(type : <span class=\"t\">DB</span><span class=\"t\">::</span><span class=\"t\">Mappable</span>.<span class=\"k\">class</span>)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L73","def":{"name":"read","args":[{"name":"type","doc":null,"default_value":"","external_name":"type","restriction":"DB::Mappable.class"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"type.new(self)"}},{"id":"read(type:T.class):TforallT-instance-method","html_id":"read(type:T.class):TforallT-instance-method","name":"read","doc":"Reads the next column value as a **type**","summary":"<p>Reads the next column value as a <strong>type</strong></p>","abstract":false,"args":[{"name":"type","doc":null,"default_value":"","external_name":"type","restriction":"T.class"}],"args_string":"(type : <span class=\"t\">T</span>.<span class=\"k\">class</span>) : T forall T","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L78","def":{"name":"read","args":[{"name":"type","doc":null,"default_value":"","external_name":"type","restriction":"T.class"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"T","visibility":"Public","body":"value = read\nif value.is_a?(T)\n value\nelse\n raise(\"#{self.class}#read returned a #{value.class}. A #{T} was expected.\")\nend\n"}},{"id":"read(**types:Class)-instance-method","html_id":"read(**types:Class)-instance-method","name":"read","doc":"Reads the next columns and returns a named tuple of the values.","summary":"<p>Reads the next columns and returns a named tuple of the values.</p>","abstract":false,"args":[],"args_string":"(**types : Class)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L93","def":{"name":"read","args":[],"double_splat":{"name":"types","doc":null,"default_value":"","external_name":"types","restriction":"Class"},"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"internal_read(**types)"}},{"id":"read-instance-method","html_id":"read-instance-method","name":"read","doc":"Reads the next column value","summary":"<p>Reads the next column value</p>","abstract":true,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L70","def":{"name":"read","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"read(*types:Class)-instance-method","html_id":"read(*types:Class)-instance-method","name":"read","doc":"Reads the next columns and returns a tuple of the values.","summary":"<p>Reads the next columns and returns a tuple of the values.</p>","abstract":false,"args":[{"name":"types","doc":null,"default_value":"","external_name":"types","restriction":"Class"}],"args_string":"(*types : Class)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/result_set.cr#L88","def":{"name":"read","args":[{"name":"types","doc":null,"default_value":"","external_name":"types","restriction":"Class"}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"internal_read(*types)"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Rollback","path":"DB/Rollback.html","kind":"class","full_name":"DB::Rollback","name":"Rollback","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Error","kind":"class","full_name":"DB::Error","name":"Error"},{"html_id":"github.com/crystal-lang/crystal-db/Exception","kind":"class","full_name":"Exception","name":"Exception"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/error.cr","line_number":30,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/error.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/SavePointTransaction","path":"DB/SavePointTransaction.html","kind":"class","full_name":"DB::SavePointTransaction","name":"SavePointTransaction","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Transaction","kind":"class","full_name":"DB::Transaction","name":"Transaction"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Transaction","kind":"class","full_name":"DB::Transaction","name":"Transaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/BeginTransaction","kind":"module","full_name":"DB::BeginTransaction","name":"BeginTransaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/transaction.cr","line_number":94,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(parent:Transaction,savepoint_name:String)-class-method","html_id":"new(parent:Transaction,savepoint_name:String)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"parent","doc":null,"default_value":"","external_name":"parent","restriction":"Transaction"},{"name":"savepoint_name","doc":null,"default_value":"","external_name":"savepoint_name","restriction":"String"}],"args_string":"(parent : Transaction, savepoint_name : String)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L97","def":{"name":"new","args":[{"name":"parent","doc":null,"default_value":"","external_name":"parent","restriction":"Transaction"},{"name":"savepoint_name","doc":null,"default_value":"","external_name":"savepoint_name","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(parent, savepoint_name)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"begin_transaction:Transaction-instance-method","html_id":"begin_transaction:Transaction-instance-method","name":"begin_transaction","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Transaction","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L117","def":{"name":"begin_transaction","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Transaction","visibility":"Public","body":"if @nested_transaction\n raise(DB::Error.new(\"There is an existing nested transaction in this transaction\"))\nend\n@nested_transaction = true\ncreate_save_point_transaction(self)\n"}},{"id":"commit-instance-method","html_id":"commit-instance-method","name":"commit","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L103","def":{"name":"commit","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@connection.perform_release_savepoint(@savepoint_name)\nsuper()\n"}},{"id":"connection:Connection-instance-method","html_id":"connection:Connection-instance-method","name":"connection","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Connection","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L97","def":{"name":"connection","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Connection","visibility":"Public","body":"@connection"}},{"id":"create_save_point_transaction(parent:Transaction)-instance-method","html_id":"create_save_point_transaction(parent:Transaction)-instance-method","name":"create_save_point_transaction","doc":null,"summary":null,"abstract":false,"args":[{"name":"parent","doc":null,"default_value":"","external_name":"parent","restriction":"Transaction"}],"args_string":"(parent : Transaction)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L123","def":{"name":"create_save_point_transaction","args":[{"name":"parent","doc":null,"default_value":"","external_name":"parent","restriction":"Transaction"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@parent.create_save_point_transaction(parent)"}},{"id":"release_from_nested_transaction-instance-method","html_id":"release_from_nested_transaction-instance-method","name":"release_from_nested_transaction","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L127","def":{"name":"release_from_nested_transaction","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@nested_transaction = false"}},{"id":"rollback-instance-method","html_id":"rollback-instance-method","name":"rollback","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L108","def":{"name":"rollback","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@connection.perform_rollback_savepoint(@savepoint_name)\nsuper()\n"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","path":"DB/SessionMethods.html","kind":"module","full_name":"DB::SessionMethods(Session, Stmt)","name":"SessionMethods","abstract":false,"superclass":null,"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"}],"locations":[{"filename":"db/session_methods.cr","line_number":10,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"}],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Connection","kind":"class","full_name":"DB::Connection","name":"Connection"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Database","kind":"class","full_name":"DB::Database","name":"Database"}],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Methods that are shared accross session like objects:\n - Database\n - Connection\n\nClasses that includes this module are able to execute\nqueries and statements in both prepared and unprepared fashion.\n\nThis module serves for dsl reuse over session like objects.","summary":"<p>Methods that are shared accross session like objects: - Database - Connection</p>","class_methods":[],"constructors":[],"instance_methods":[{"id":"build(query):Stmt-instance-method","html_id":"build(query):Stmt-instance-method","name":"build","doc":null,"summary":null,"abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"args_string":"(query) : Stmt","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L21","def":{"name":"build","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Stmt","visibility":"Public","body":"if prepared_statements?\n fetch_or_build_prepared_statement(query)\nelse\n build_unprepared_statement(query)\nend"}},{"id":"build_unprepared_statement(query):Stmt-instance-method","html_id":"build_unprepared_statement(query):Stmt-instance-method","name":"build_unprepared_statement","doc":null,"summary":null,"abstract":true,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"args_string":"(query) : Stmt","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L19","def":{"name":"build_unprepared_statement","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Stmt","visibility":"Public","body":""}},{"id":"fetch_or_build_prepared_statement(query):Stmt-instance-method","html_id":"fetch_or_build_prepared_statement(query):Stmt-instance-method","name":"fetch_or_build_prepared_statement","doc":null,"summary":null,"abstract":true,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"args_string":"(query) : Stmt","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L17","def":{"name":"fetch_or_build_prepared_statement","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Stmt","visibility":"Public","body":""}},{"id":"prepared(query)-instance-method","html_id":"prepared(query)-instance-method","name":"prepared","doc":"Returns a prepared `Statement` that has not been executed yet.","summary":"<p>Returns a prepared <code><a href=\"../DB/Statement.html\">Statement</a></code> that has not been executed yet.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"args_string":"(query)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L36","def":{"name":"prepared","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"prepared.build(query)"}},{"id":"prepared-instance-method","html_id":"prepared-instance-method","name":"prepared","doc":"dsl helper to build prepared statements\nreturns a value that includes `QueryMethods`","summary":"<p>dsl helper to build prepared statements returns a value that includes <code><a href=\"../DB/QueryMethods.html\">QueryMethods</a></code></p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L31","def":{"name":"prepared","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"PreparedQuery(Session, Stmt).new(self)"}},{"id":"prepared_statements?:Bool-instance-method","html_id":"prepared_statements?:Bool-instance-method","name":"prepared_statements?","doc":"Returns whether by default the statements should\nbe prepared or not.","summary":"<p>Returns whether by default the statements should be prepared or not.</p>","abstract":true,"args":[],"args_string":" : Bool","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L15","def":{"name":"prepared_statements?","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Bool","visibility":"Public","body":""}},{"id":"unprepared(query)-instance-method","html_id":"unprepared(query)-instance-method","name":"unprepared","doc":"Returns an unprepared `Statement` that has not been executed yet.","summary":"<p>Returns an unprepared <code><a href=\"../DB/Statement.html\">Statement</a></code> that has not been executed yet.</p>","abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"args_string":"(query)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L47","def":{"name":"unprepared","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"unprepared.build(query)"}},{"id":"unprepared-instance-method","html_id":"unprepared-instance-method","name":"unprepared","doc":"dsl helper to build unprepared statements\nreturns a value that includes `QueryMethods`","summary":"<p>dsl helper to build unprepared statements returns a value that includes <code><a href=\"../DB/QueryMethods.html\">QueryMethods</a></code></p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L42","def":{"name":"unprepared","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"UnpreparedQuery(Session, Stmt).new(self)"}}],"macros":[],"types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods/PreparedQuery","path":"DB/SessionMethods/PreparedQuery.html","kind":"struct","full_name":"DB::SessionMethods::PreparedQuery(Session, Stmt)","name":"PreparedQuery","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"},{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"github.com/crystal-lang/crystal-db/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/session_methods.cr","line_number":51,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","kind":"module","full_name":"DB::SessionMethods(Session, Stmt)","name":"SessionMethods"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(session:Session)-class-method","html_id":"new(session:Session)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"session","doc":null,"default_value":"","external_name":"session","restriction":"Session"}],"args_string":"(session : Session)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L54","def":{"name":"new","args":[{"name":"session","doc":null,"default_value":"","external_name":"session","restriction":"Session"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = PreparedQuery(Session, Stmt).allocate\n_.initialize(session)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"build(query):Stmt-instance-method","html_id":"build(query):Stmt-instance-method","name":"build","doc":null,"summary":null,"abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"args_string":"(query) : Stmt","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L57","def":{"name":"build","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Stmt","visibility":"Public","body":"@session.fetch_or_build_prepared_statement(query)"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods/UnpreparedQuery","path":"DB/SessionMethods/UnpreparedQuery.html","kind":"struct","full_name":"DB::SessionMethods::UnpreparedQuery(Session, Stmt)","name":"UnpreparedQuery","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"},{"html_id":"github.com/crystal-lang/crystal-db/Struct","kind":"struct","full_name":"Struct","name":"Struct"},{"html_id":"github.com/crystal-lang/crystal-db/Value","kind":"struct","full_name":"Value","name":"Value"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/session_methods.cr","line_number":62,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/QueryMethods","kind":"module","full_name":"DB::QueryMethods","name":"QueryMethods"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB/SessionMethods","kind":"module","full_name":"DB::SessionMethods(Session, Stmt)","name":"SessionMethods"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(session:Session)-class-method","html_id":"new(session:Session)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"session","doc":null,"default_value":"","external_name":"session","restriction":"Session"}],"args_string":"(session : Session)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L65","def":{"name":"new","args":[{"name":"session","doc":null,"default_value":"","external_name":"session","restriction":"Session"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = UnpreparedQuery(Session, Stmt).allocate\n_.initialize(session)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"build(query):Stmt-instance-method","html_id":"build(query):Stmt-instance-method","name":"build","doc":null,"summary":null,"abstract":false,"args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"args_string":"(query) : Stmt","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/session_methods.cr#L68","def":{"name":"build","args":[{"name":"query","doc":null,"default_value":"","external_name":"query","restriction":""}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Stmt","visibility":"Public","body":"@session.build_unprepared_statement(query)"}}],"macros":[],"types":[]}]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Statement","path":"DB/Statement.html","kind":"class","full_name":"DB::Statement","name":"Statement","abstract":true,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/statement.cr","line_number":52,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods"}],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Represents a query in a `Connection`.\nIt should be created by `QueryMethods`.\n\n### Note to implementors\n\n1. Subclass `Statements`\n2. `Statements` are created from a custom driver `Connection#prepare` method.\n3. `#perform_query` executes a query that is expected to return a `ResultSet`\n4. `#perform_exec` executes a query that is expected to return an `ExecResult`\n6. `#do_close` is called to release the statement resources.","summary":"<p>Represents a query in a <code><a href=\"../DB/Connection.html\">Connection</a></code>.</p>","class_methods":[],"constructors":[{"id":"new(connection:Connection)-class-method","html_id":"new(connection:Connection)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"args_string":"(connection : Connection)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L58","def":{"name":"new","args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(connection)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"exec(args:Array):DB::ExecResult-instance-method","html_id":"exec(args:Array):DB::ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"args_string":"(args : Array) : DB::ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L71","def":{"name":"exec","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"DB::ExecResult","visibility":"Public","body":"perform_exec_and_release(args)"}},{"id":"exec:DB::ExecResult-instance-method","html_id":"exec:DB::ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":false,"args":[],"args_string":" : DB::ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L66","def":{"name":"exec","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"DB::ExecResult","visibility":"Public","body":"perform_exec_and_release(Slice(Any).empty)"}},{"id":"exec(*args)-instance-method","html_id":"exec(*args)-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L76","def":{"name":"exec","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"perform_exec_and_release(args)"}},{"id":"query(args:Array):DB::ResultSet-instance-method","html_id":"query(args:Array):DB::ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"args_string":"(args : Array) : DB::ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L87","def":{"name":"query","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"DB::ResultSet","visibility":"Public","body":"perform_query_with_rescue(args)"}},{"id":"query:DB::ResultSet-instance-method","html_id":"query:DB::ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":false,"args":[],"args_string":" : DB::ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L82","def":{"name":"query","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"DB::ResultSet","visibility":"Public","body":"perform_query_with_rescue(Tuple.new)"}},{"id":"query(*args)-instance-method","html_id":"query(*args)-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L92","def":{"name":"query","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"perform_query_with_rescue(args)"}},{"id":"release_connection-instance-method","html_id":"release_connection-instance-method","name":"release_connection","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L61","def":{"name":"release_connection","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@connection.release_from_statement"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/StatementMethods","path":"DB/StatementMethods.html","kind":"module","full_name":"DB::StatementMethods","name":"StatementMethods","abstract":false,"superclass":null,"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"}],"locations":[{"filename":"db/statement.cr","line_number":4,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"}],"extended_modules":[],"subclasses":[],"including_types":[{"html_id":"github.com/crystal-lang/crystal-db/DB/PoolStatement","kind":"class","full_name":"DB::PoolStatement","name":"PoolStatement"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Statement","kind":"class","full_name":"DB::Statement","name":"Statement"}],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Common interface for connection based statements\nand for connection pool statements.","summary":"<p>Common interface for connection based statements and for connection pool statements.</p>","class_methods":[],"constructors":[],"instance_methods":[{"id":"exec(args:Array):ExecResult-instance-method","html_id":"exec(args:Array):ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":true,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"args_string":"(args : Array) : ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L32","def":{"name":"exec","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ExecResult","visibility":"Public","body":""}},{"id":"exec:ExecResult-instance-method","html_id":"exec:ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":true,"args":[],"args_string":" : ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L28","def":{"name":"exec","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ExecResult","visibility":"Public","body":""}},{"id":"exec(*args):ExecResult-instance-method","html_id":"exec(*args):ExecResult-instance-method","name":"exec","doc":"See `QueryMethods#exec`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#exec(query,*args)-instance-method\">QueryMethods#exec</a></code></p>","abstract":true,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args) : ExecResult","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L30","def":{"name":"exec","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"ExecResult","visibility":"Public","body":""}},{"id":"query(*args,&block)-instance-method","html_id":"query(*args,&block)-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args, &block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L22","def":{"name":"query","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"rs = query(*args)\nbegin\n yield rs\nensure\n rs.close\nend\n"}},{"id":"query(args:Array):ResultSet-instance-method","html_id":"query(args:Array):ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":true,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"args_string":"(args : Array) : ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L39","def":{"name":"query","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":"Array"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ResultSet","visibility":"Public","body":""}},{"id":"query:ResultSet-instance-method","html_id":"query:ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":true,"args":[],"args_string":" : ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L35","def":{"name":"query","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"ResultSet","visibility":"Public","body":""}},{"id":"query(*args):ResultSet-instance-method","html_id":"query(*args):ResultSet-instance-method","name":"query","doc":"See `QueryMethods#query`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#query(query,*args)-instance-method\">QueryMethods#query</a></code></p>","abstract":true,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args) : ResultSet","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L37","def":{"name":"query","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"ResultSet","visibility":"Public","body":""}},{"id":"scalar(*args)-instance-method","html_id":"scalar(*args)-instance-method","name":"scalar","doc":"See `QueryMethods#scalar`","summary":"<p>See <code><a href=\"../DB/QueryMethods.html#scalar(query,*args)-instance-method\">QueryMethods#scalar</a></code></p>","abstract":false,"args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"args_string":"(*args)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/statement.cr#L11","def":{"name":"scalar","args":[{"name":"args","doc":null,"default_value":"","external_name":"args","restriction":""}],"double_splat":null,"splat_index":0,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"query(*args) do |rs|\n rs.each do\n return rs.read\n end\nend\nraise(\"no results\")\n"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/StringKeyCache","path":"DB/StringKeyCache.html","kind":"class","full_name":"DB::StringKeyCache(T)","name":"StringKeyCache","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/string_key_cache.cr","line_number":2,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/string_key_cache.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[],"instance_methods":[{"id":"clear-instance-method","html_id":"clear-instance-method","name":"clear","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/string_key_cache.cr#L17","def":{"name":"clear","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@cache.clear"}},{"id":"each_value(&block)-instance-method","html_id":"each_value(&block)-instance-method","name":"each_value","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"(&block)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/string_key_cache.cr#L11","def":{"name":"each_value","args":[],"double_splat":null,"splat_index":null,"yields":1,"block_arg":null,"return_type":"","visibility":"Public","body":"@cache.each do |_, value|\n yield value\nend"}},{"id":"fetch(key:String,&block):T-instance-method","html_id":"fetch(key:String,&block):T-instance-method","name":"fetch","doc":null,"summary":null,"abstract":false,"args":[{"name":"key","doc":null,"default_value":"","external_name":"key","restriction":"String"}],"args_string":"(key : String, &block) : T","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/string_key_cache.cr#L5","def":{"name":"fetch","args":[{"name":"key","doc":null,"default_value":"","external_name":"key","restriction":"String"}],"double_splat":null,"splat_index":null,"yields":0,"block_arg":null,"return_type":"T","visibility":"Public","body":"value = @cache.fetch(key, nil)\nif value\nelse\n value = @cache[key] = yield\nend\nvalue\n"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/TopLevelTransaction","path":"DB/TopLevelTransaction.html","kind":"class","full_name":"DB::TopLevelTransaction","name":"TopLevelTransaction","abstract":false,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/DB/Transaction","kind":"class","full_name":"DB::Transaction","name":"Transaction"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/Transaction","kind":"class","full_name":"DB::Transaction","name":"Transaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/BeginTransaction","kind":"module","full_name":"DB::BeginTransaction","name":"BeginTransaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/transaction.cr","line_number":38,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[],"extended_modules":[],"subclasses":[],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":null,"summary":null,"class_methods":[],"constructors":[{"id":"new(connection:Connection)-class-method","html_id":"new(connection:Connection)-class-method","name":"new","doc":null,"summary":null,"abstract":false,"args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"args_string":"(connection : Connection)","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L43","def":{"name":"new","args":[{"name":"connection","doc":null,"default_value":"","external_name":"connection","restriction":"Connection"}],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"_ = allocate\n_.initialize(connection)\nif _.responds_to?(:finalize)\n ::GC.add_finalizer(_)\nend\n_\n"}}],"instance_methods":[{"id":"begin_transaction:Transaction-instance-method","html_id":"begin_transaction:Transaction-instance-method","name":"begin_transaction","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Transaction","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L62","def":{"name":"begin_transaction","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Transaction","visibility":"Public","body":"if @nested_transaction\n raise(DB::Error.new(\"There is an existing nested transaction in this transaction\"))\nend\n@nested_transaction = true\ncreate_save_point_transaction(self)\n"}},{"id":"commit-instance-method","html_id":"commit-instance-method","name":"commit","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L48","def":{"name":"commit","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@connection.perform_commit_transaction\nsuper()\n"}},{"id":"connection:Connection-instance-method","html_id":"connection:Connection-instance-method","name":"connection","doc":null,"summary":null,"abstract":false,"args":[],"args_string":" : Connection","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L41","def":{"name":"connection","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Connection","visibility":"Public","body":"@connection"}},{"id":"rollback-instance-method","html_id":"rollback-instance-method","name":"rollback","doc":null,"summary":null,"abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L53","def":{"name":"rollback","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"@connection.perform_rollback_transaction\nsuper()\n"}}],"macros":[],"types":[]},{"html_id":"github.com/crystal-lang/crystal-db/DB/Transaction","path":"DB/Transaction.html","kind":"class","full_name":"DB::Transaction","name":"Transaction","abstract":true,"superclass":{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},"ancestors":[{"html_id":"github.com/crystal-lang/crystal-db/DB/BeginTransaction","kind":"module","full_name":"DB::BeginTransaction","name":"BeginTransaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"},{"html_id":"github.com/crystal-lang/crystal-db/Reference","kind":"class","full_name":"Reference","name":"Reference"},{"html_id":"github.com/crystal-lang/crystal-db/Object","kind":"class","full_name":"Object","name":"Object"}],"locations":[{"filename":"db/transaction.cr","line_number":14,"url":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr"}],"repository_name":"github.com/crystal-lang/crystal-db","program":false,"enum":false,"alias":false,"aliased":"","const":false,"constants":[],"included_modules":[{"html_id":"github.com/crystal-lang/crystal-db/DB/BeginTransaction","kind":"module","full_name":"DB::BeginTransaction","name":"BeginTransaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/Disposable","kind":"module","full_name":"DB::Disposable","name":"Disposable"}],"extended_modules":[],"subclasses":[{"html_id":"github.com/crystal-lang/crystal-db/DB/SavePointTransaction","kind":"class","full_name":"DB::SavePointTransaction","name":"SavePointTransaction"},{"html_id":"github.com/crystal-lang/crystal-db/DB/TopLevelTransaction","kind":"class","full_name":"DB::TopLevelTransaction","name":"TopLevelTransaction"}],"including_types":[],"namespace":{"html_id":"github.com/crystal-lang/crystal-db/DB","kind":"module","full_name":"DB","name":"DB"},"doc":"Transactions should be started from `DB#transaction`, `Connection#transaction`\nor `Connection#begin_transaction`.\n\nUse `Transaction#connection` to submit statements to the database.\n\nUse `Transaction#commit` or `Transaction#rollback` to close the ongoing transaction\nexplicitly. Or refer to `BeginTransaction#transaction` for documentation on how to\nuse `#transaction(&block)` methods in `DB` and `Connection`.\n\nNested transactions are supported by using sql `SAVEPOINT`. To start a nested\ntransaction use `Transaction#transaction` or `Transaction#begin_transaction`.\n","summary":"<p>Transactions should be started from <code>DB#transaction</code>, <code>Connection#transaction</code> or <code><a href=\"../DB/Connection.html#begin_transaction:Transaction-instance-method\">Connection#begin_transaction</a></code>.</p>","class_methods":[],"constructors":[],"instance_methods":[{"id":"commit-instance-method","html_id":"commit-instance-method","name":"commit","doc":"commits the current transaction","summary":"<p>commits the current transaction</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L21","def":{"name":"commit","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"close!"}},{"id":"connection:Connection-instance-method","html_id":"connection:Connection-instance-method","name":"connection","doc":null,"summary":null,"abstract":true,"args":[],"args_string":" : Connection","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L18","def":{"name":"connection","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"Connection","visibility":"Public","body":""}},{"id":"release_from_nested_transaction-instance-method","html_id":"release_from_nested_transaction-instance-method","name":"release_from_nested_transaction","doc":null,"summary":null,"abstract":true,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L35","def":{"name":"release_from_nested_transaction","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":""}},{"id":"rollback-instance-method","html_id":"rollback-instance-method","name":"rollback","doc":"rollbacks the current transaction","summary":"<p>rollbacks the current transaction</p>","abstract":false,"args":[],"args_string":"","source_link":"https://github.com/crystal-lang/crystal-db/blob/dcd0af5ce81b5a43305e02846106633373f65004/src/db/transaction.cr#L26","def":{"name":"rollback","args":[],"double_splat":null,"splat_index":null,"yields":null,"block_arg":null,"return_type":"","visibility":"Public","body":"close!"}}],"macros":[],"types":[]}]}]}}) \ No newline at end of file