<!DOCTYPE html> <html><head> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link href="../sqlite.css" rel="stylesheet"> <title>Database Connection Handle</title> <!-- path=../ --> </head> <body> <div class=nosearch> <a href="../index.html"> <img class="logo" src="../images/sqlite370_banner.gif" alt="SQLite" border="0"> </a> <div><!-- IE hack to prevent disappearing logo --></div> <div class="tagline desktoponly"> Small. Fast. Reliable.<br>Choose any three. </div> <div class="menu mainmenu"> <ul> <li><a href="../index.html">Home</a> <li class='mobileonly'><a href="javascript:void(0)" onclick='toggle_div("submenu")'>Menu</a> <li class='wideonly'><a href='../about.html'>About</a> <li class='desktoponly'><a href="../docs.html">Documentation</a> <li class='desktoponly'><a href="../download.html">Download</a> <li class='wideonly'><a href='../copyright.html'>License</a> <li class='desktoponly'><a href="../support.html">Support</a> <li class='desktoponly'><a href="../prosupport.html">Purchase</a> <li class='search' id='search_menubutton'> <a href="javascript:void(0)" onclick='toggle_search()'>Search</a> </ul> </div> <div class="menu submenu" id="submenu"> <ul> <li><a href='../about.html'>About</a> <li><a href='../docs.html'>Documentation</a> <li><a href='../download.html'>Download</a> <li><a href='../support.html'>Support</a> <li><a href='../prosupport.html'>Purchase</a> </ul> </div> <div class="searchmenu" id="searchmenu"> <form method="GET" action="../search"> <select name="s" id="searchtype"> <option value="d">Search Documentation</option> <option value="c">Search Changelog</option> </select> <input type="text" name="q" id="searchbox" value=""> <input type="submit" value="Go"> </form> </div> </div> <script> function toggle_div(nm) { var w = document.getElementById(nm); if( w.style.display=="block" ){ w.style.display = "none"; }else{ w.style.display = "block"; } } function toggle_search() { var w = document.getElementById("searchmenu"); if( w.style.display=="block" ){ w.style.display = "none"; } else { w.style.display = "block"; setTimeout(function(){ document.getElementById("searchbox").focus() }, 30); } } function div_off(nm){document.getElementById(nm).style.display="none";} window.onbeforeunload = function(e){div_off("submenu");} /* Disable the Search feature if we are not operating from CGI, since */ /* Search is accomplished using CGI and will not work without it. */ if( !location.origin || !location.origin.match || !location.origin.match(/http/) ){ document.getElementById("search_menubutton").style.display = "none"; } /* Used by the Hide/Show button beside syntax diagrams, to toggle the */ function hideorshow(btn,obj){ var x = document.getElementById(obj); var b = document.getElementById(btn); if( x.style.display!='none' ){ x.style.display = 'none'; b.innerHTML='show'; }else{ x.style.display = ''; b.innerHTML='hide'; } return false; } var antiRobot = 0; function antiRobotGo(){ if( antiRobot!=3 ) return; antiRobot = 7; var j = document.getElementById("mtimelink"); if(j && j.hasAttribute("data-href")) j.href=j.getAttribute("data-href"); } function antiRobotDefense(){ document.body.onmousedown=function(){ antiRobot |= 2; antiRobotGo(); document.body.onmousedown=null; } document.body.onmousemove=function(){ antiRobot |= 2; antiRobotGo(); document.body.onmousemove=null; } setTimeout(function(){ antiRobot |= 1; antiRobotGo(); }, 100) antiRobotGo(); } antiRobotDefense(); </script> <!-- keywords: {database connection} {database connections} sqlite3 --> <div class=nosearch> <a href="intro.html"><h2>SQLite C Interface</h2></a> <h2>Database Connection Handle</h2> </div> <blockquote><pre> typedef struct sqlite3 sqlite3; </pre></blockquote> <p> Each open SQLite database is represented by a pointer to an instance of the opaque structure named "sqlite3". It is useful to think of an sqlite3 pointer as an object. The <a href="../c3ref/open.html">sqlite3_open()</a>, <a href="../c3ref/open.html">sqlite3_open16()</a>, and <a href="../c3ref/open.html">sqlite3_open_v2()</a> interfaces are its constructors, and <a href="../c3ref/close.html">sqlite3_close()</a> and <a href="../c3ref/close.html">sqlite3_close_v2()</a> are its destructors. There are many other interfaces (such as <a href="../c3ref/prepare.html">sqlite3_prepare_v2()</a>, <a href="../c3ref/create_function.html">sqlite3_create_function()</a>, and <a href="../c3ref/busy_timeout.html">sqlite3_busy_timeout()</a> to name but three) that are methods on an sqlite3 object. </p><p>3 Constructors: <a href="../c3ref/open.html">sqlite3_open()</a>, <a href="../c3ref/open.html">sqlite3_open16()</a>, <a href="../c3ref/open.html">sqlite3_open_v2()</a></p> <p>2 Destructors: <a href="../c3ref/close.html">sqlite3_close()</a>, <a href="../c3ref/close.html">sqlite3_close_v2()</a></p> <p>76 Methods: <div class='columns' style='columns: 17em auto;'> <ul style='padding-top:0;'> <li><a href='../c3ref/autovacuum_pages.html'>sqlite3_autovacuum_pages</a></li> <li><a href='../c3ref/blob_open.html'>sqlite3_blob_open</a></li> <li><a href='../c3ref/busy_handler.html'>sqlite3_busy_handler</a></li> <li><a href='../c3ref/busy_timeout.html'>sqlite3_busy_timeout</a></li> <li><a href='../c3ref/changes.html'>sqlite3_changes</a></li> <li><a href='../c3ref/changes.html'>sqlite3_changes64</a></li> <li><a href='../c3ref/collation_needed.html'>sqlite3_collation_needed</a></li> <li><a href='../c3ref/collation_needed.html'>sqlite3_collation_needed16</a></li> <li><a href='../c3ref/commit_hook.html'>sqlite3_commit_hook</a></li> <li><a href='../c3ref/create_collation.html'>sqlite3_create_collation</a></li> <li><a href='../c3ref/create_collation.html'>sqlite3_create_collation16</a></li> <li><a href='../c3ref/create_collation.html'>sqlite3_create_collation_v2</a></li> <li><a href='../c3ref/create_function.html'>sqlite3_create_function</a></li> <li><a href='../c3ref/create_function.html'>sqlite3_create_function16</a></li> <li><a href='../c3ref/create_function.html'>sqlite3_create_function_v2</a></li> <li><a href='../c3ref/create_module.html'>sqlite3_create_module</a></li> <li><a href='../c3ref/create_module.html'>sqlite3_create_module_v2</a></li> <li><a href='../c3ref/create_function.html'>sqlite3_create_window_function</a></li> <li><a href='../c3ref/db_cacheflush.html'>sqlite3_db_cacheflush</a></li> <li><a href='../c3ref/db_config.html'>sqlite3_db_config</a></li> <li><a href='../c3ref/db_filename.html'>sqlite3_db_filename</a></li> <li><a href='../c3ref/db_mutex.html'>sqlite3_db_mutex</a></li> <li><a href='../c3ref/db_name.html'>sqlite3_db_name</a></li> <li><a href='../c3ref/db_readonly.html'>sqlite3_db_readonly</a></li> <li><a href='../c3ref/db_release_memory.html'>sqlite3_db_release_memory</a></li> <li><a href='../c3ref/db_status.html'>sqlite3_db_status</a></li> <li><a href='../c3ref/drop_modules.html'>sqlite3_drop_modules</a></li> <li><a href='../c3ref/enable_load_extension.html'>sqlite3_enable_load_extension</a></li> <li><a href='../c3ref/errcode.html'>sqlite3_errcode</a></li> <li><a href='../c3ref/errcode.html'>sqlite3_errmsg</a></li> <li><a href='../c3ref/errcode.html'>sqlite3_errmsg16</a></li> <li><a href='../c3ref/errcode.html'>sqlite3_error_offset</a></li> <li><a href='../c3ref/errcode.html'>sqlite3_errstr</a></li> <li><a href='../c3ref/exec.html'>sqlite3_exec</a></li> <li><a href='../c3ref/errcode.html'>sqlite3_extended_errcode</a></li> <li><a href='../c3ref/extended_result_codes.html'>sqlite3_extended_result_codes</a></li> <li><a href='../c3ref/file_control.html'>sqlite3_file_control</a></li> <li><a href='../c3ref/free_table.html'>sqlite3_free_table</a></li> <li><a href='../c3ref/get_autocommit.html'>sqlite3_get_autocommit</a></li> <li><a href='../c3ref/free_table.html'>sqlite3_get_table</a></li> <li><a href='../c3ref/interrupt.html'>sqlite3_interrupt</a></li> <li><a href='../c3ref/last_insert_rowid.html'>sqlite3_last_insert_rowid</a></li> <li><a href='../c3ref/limit.html'>sqlite3_limit</a></li> <li><a href='../c3ref/load_extension.html'>sqlite3_load_extension</a></li> <li><a href='../c3ref/next_stmt.html'>sqlite3_next_stmt</a></li> <li><a href='../c3ref/overload_function.html'>sqlite3_overload_function</a></li> <li><a href='../c3ref/prepare.html'>sqlite3_prepare</a></li> <li><a href='../c3ref/prepare.html'>sqlite3_prepare16</a></li> <li><a href='../c3ref/prepare.html'>sqlite3_prepare16_v2</a></li> <li><a href='../c3ref/prepare.html'>sqlite3_prepare16_v3</a></li> <li><a href='../c3ref/prepare.html'>sqlite3_prepare_v2</a></li> <li><a href='../c3ref/prepare.html'>sqlite3_prepare_v3</a></li> <li><a href='../c3ref/preupdate_blobwrite.html'>sqlite3_preupdate_blobwrite</a></li> <li><a href='../c3ref/preupdate_blobwrite.html'>sqlite3_preupdate_count</a></li> <li><a href='../c3ref/preupdate_blobwrite.html'>sqlite3_preupdate_depth</a></li> <li><a href='../c3ref/preupdate_blobwrite.html'>sqlite3_preupdate_hook</a></li> <li><a href='../c3ref/preupdate_blobwrite.html'>sqlite3_preupdate_new</a></li> <li><a href='../c3ref/preupdate_blobwrite.html'>sqlite3_preupdate_old</a></li> <li><a href='../c3ref/profile.html'>sqlite3_profile</a></li> <li><a href='../c3ref/progress_handler.html'>sqlite3_progress_handler</a></li> <li><a href='../c3ref/commit_hook.html'>sqlite3_rollback_hook</a></li> <li><a href='../c3ref/set_authorizer.html'>sqlite3_set_authorizer</a></li> <li><a href='../c3ref/set_last_insert_rowid.html'>sqlite3_set_last_insert_rowid</a></li> <li><a href='../c3ref/system_errno.html'>sqlite3_system_errno</a></li> <li><a href='../c3ref/table_column_metadata.html'>sqlite3_table_column_metadata</a></li> <li><a href='../c3ref/total_changes.html'>sqlite3_total_changes</a></li> <li><a href='../c3ref/total_changes.html'>sqlite3_total_changes64</a></li> <li><a href='../c3ref/profile.html'>sqlite3_trace</a></li> <li><a href='../c3ref/trace_v2.html'>sqlite3_trace_v2</a></li> <li><a href='../c3ref/txn_state.html'>sqlite3_txn_state</a></li> <li><a href='../c3ref/unlock_notify.html'>sqlite3_unlock_notify</a></li> <li><a href='../c3ref/update_hook.html'>sqlite3_update_hook</a></li> <li><a href='../c3ref/wal_autocheckpoint.html'>sqlite3_wal_autocheckpoint</a></li> <li><a href='../c3ref/wal_checkpoint.html'>sqlite3_wal_checkpoint</a></li> <li><a href='../c3ref/wal_checkpoint_v2.html'>sqlite3_wal_checkpoint_v2</a></li> <li><a href='../c3ref/wal_hook.html'>sqlite3_wal_hook</a></li> </ul> </div> </p> <p>See also lists of <a href="objlist.html">Objects</a>, <a href="constlist.html">Constants</a>, and <a href="funclist.html">Functions</a>.</p>