/usr/share/gtk-doc/html/libgda-4.0/part_providers.html is in libgda-4.0-doc 4.2.8-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Part VII. Databases providers for developers</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="index.html" title="GNOME Data Access 4 manual">
<link rel="up" href="index.html" title="GNOME Data Access 4 manual">
<link rel="prev" href="ch39s04.html" title="Environment variables">
<link rel="next" href="psupport.html" title="Providers' support API">
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
<td><a accesskey="p" href="ch39s04.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td> </td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GNOME Data Access 4 manual</th>
<td><a accesskey="n" href="psupport.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr></table>
<div class="part">
<div class="titlepage"><div><div><h1 class="title">
<a name="part_providers"></a>Part VII. Databases providers for developers</h1></div></div></div>
<div class="toc">
<p><b>Table of Contents</b></p>
<dl>
<dt><span class="chapter"><a href="psupport.html">Providers' support API</a></span></dt>
<dd><dl>
<dt>
<span class="refentrytitle"><a href="GdaServerProvider.html">GdaServerProvider</a></span><span class="refpurpose"> — Base class for all the DBMS providers</span>
</dt>
<dt>
<span class="refentrytitle"><a href="libgda-4.0-Subclassing-GdaDataSelect.html">Subclassing GdaDataSelect</a></span><span class="refpurpose"> — Base class for all the data models returned by DBMS providers when a SELECT statement is executed</span>
</dt>
<dt>
<span class="refentrytitle"><a href="GdaPStmt.html">GdaPStmt</a></span><span class="refpurpose"> — Prepared statement's base class</span>
</dt>
<dt>
<span class="refentrytitle"><a href="libgda-4.0-Quark-lists.html">Quark lists</a></span><span class="refpurpose"> — Manages lists of KEY=VALUE pairs</span>
</dt>
<dt>
<span class="refentrytitle"><a href="libgda-4.0-SQL-rendering-API.html">SQL rendering API</a></span><span class="refpurpose"> — Adapting the SQL to the database's own SQL dialect</span>
</dt>
<dt>
<span class="refentrytitle"><a href="libgda-4.0-Misc-API.html">Misc API</a></span><span class="refpurpose"> — Methods dedicated to implementing providers</span>
</dt>
</dl></dd>
<dt><span class="chapter"><a href="libgda-provider-class.html">Virtual methods for providers</a></span></dt>
<dd><dl>
<dt><span class="sect1"><a href="libgda-provider-class.html#id1009959">Synchronous / asynchronous mode</a></span></dt>
<dt><span class="sect1"><a href="ch41s02.html">Multi threaded environment</a></span></dt>
<dt><span class="sect1"><a href="ch41s03.html">Methods - provider's information</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="ch41s03.html#prov-get-name">get_name() - mandatory</a></span></dt>
<dt><span class="sect2"><a href="ch41s03.html#prov-get-version">get_version() - mandatory</a></span></dt>
<dt><span class="sect2"><a href="ch41s03.html#prov-get-server-version">get_server_version() - mandatory</a></span></dt>
<dt><span class="sect2"><a href="ch41s03.html#id1010178">supports_feature()</a></span></dt>
</dl></dd>
<dt><span class="sect1"><a href="ch41s04.html">Methods - connection management</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="ch41s04.html#prov-open-connection">open_connection() - mandatory</a></span></dt>
<dt><span class="sect2"><a href="ch41s04.html#prov-close-connection">close_connection() - mandatory</a></span></dt>
<dt><span class="sect2"><a href="ch41s04.html#id1010272">get_database()</a></span></dt>
</dl></dd>
<dt><span class="sect1"><a href="ch41s05.html">Methods - DDL queries</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="ch41s05.html#id1009823">supports_operation()</a></span></dt>
<dt><span class="sect2"><a href="ch41s05.html#id1009841">create_operation()</a></span></dt>
<dt><span class="sect2"><a href="ch41s05.html#id1009858">render_operation()</a></span></dt>
<dt><span class="sect2"><a href="ch41s05.html#id1010439">perform_operation()</a></span></dt>
</dl></dd>
<dt><span class="sect1"><a href="ch41s06.html">Methods - transactions management</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="ch41s06.html#id1010467">begin_transaction()</a></span></dt>
<dt><span class="sect2"><a href="ch41s06.html#id1010477">commit_transaction()</a></span></dt>
<dt><span class="sect2"><a href="ch41s06.html#id1010488">rollback_transaction()</a></span></dt>
<dt><span class="sect2"><a href="ch41s06.html#id1010498">add_savepoint()</a></span></dt>
<dt><span class="sect2"><a href="ch41s06.html#id1010509">rollback_savepoint()</a></span></dt>
<dt><span class="sect2"><a href="ch41s06.html#id1010520">delete_savepoint()</a></span></dt>
</dl></dd>
<dt><span class="sect1"><a href="ch41s07.html">Methods - DML queries</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="ch41s07.html#id1010575">create_parser()</a></span></dt>
<dt><span class="sect2"><a href="ch41s07.html#id1010593">statement_to_sql()</a></span></dt>
<dt><span class="sect2"><a href="ch41s07.html#id1010616">statement_prepare()</a></span></dt>
<dt><span class="sect2"><a href="ch41s07.html#id1010641">statement_execute() - mandatory</a></span></dt>
<dt><span class="sect2"><a href="ch41s07.html#id1010747">handle_async()</a></span></dt>
</dl></dd>
<dt><span class="sect1"><a href="ch41s08.html">Methods - data representation</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="ch41s08.html#id1010794">get_data_handler()</a></span></dt>
<dt><span class="sect2"><a href="ch41s08.html#id1010838">get_def_dbms_type()</a></span></dt>
<dt><span class="sect2"><a href="ch41s08.html#id1010849">escape_string()</a></span></dt>
<dt><span class="sect2"><a href="ch41s08.html#id1010860">unescape_string()</a></span></dt>
</dl></dd>
<dt><span class="sect1"><a href="prov-metadata.html">Methods - metadata</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="prov-metadata.html#id1011018">Important note about SQL identifiers</a></span></dt>
<dt><span class="sect2"><a href="prov-metadata.html#id1011114">Reserved SQL keywords</a></span></dt>
<dt><span class="sect2"><a href="prov-metadata.html#id1011172">_info()</a></span></dt>
<dt><span class="sect2"><a href="prov-metadata.html#id1011197">_btypes()</a></span></dt>
<dt><span class="sect2"><a href="prov-metadata.html#id1011221">schemata() and _schemata()</a></span></dt>
<dt><span class="sect2"><a href="prov-metadata.html#id1011248">tables_views() and _tables_views()</a></span></dt>
<dt><span class="sect2"><a href="prov-metadata.html#id1011282">columns() and _columns()</a></span></dt>
<dt><span class="sect2"><a href="prov-metadata.html#id1011308">constraints_tab() and _constraints_tab()</a></span></dt>
<dt><span class="sect2"><a href="prov-metadata.html#id1011336">constraints_ref() and _constraints_ref()</a></span></dt>
<dt><span class="sect2"><a href="prov-metadata.html#id1011372">key_columns() and _key_columns()</a></span></dt>
</dl></dd>
<dt><span class="sect1"><a href="ch41s10.html">Methods - misc.</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="ch41s10.html#id1011418">cancel()</a></span></dt>
<dt><span class="sect2"><a href="ch41s10.html#id1011428">create_connection()</a></span></dt>
<dt><span class="sect2"><a href="ch41s10.html#id1011439">is_busy()</a></span></dt>
</dl></dd>
</dl></dd>
<dt><span class="chapter"><a href="libgda-provider-recordset.html">Virtual methods for recordsets</a></span></dt>
<dt><span class="chapter"><a href="libgda-provider-blobop.html">Virtual methods for Blob operations</a></span></dt>
<dt><span class="chapter"><a href="libgda-provider-parser.html">SQL parser</a></span></dt>
<dd><dl>
<dt><span class="sect1"><a href="libgda-provider-parser.html#id1011931">Implementation overview</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="libgda-provider-parser.html#id1011941">Generic SQL parser</a></span></dt>
<dt><span class="sect2"><a href="libgda-provider-parser.html#id1012215">Provider specific SQL parser</a></span></dt>
</dl></dd>
<dt><span class="sect1"><a href="ch44s02.html">Tips to write a custom parser</a></span></dt>
<dt>
<span class="refentrytitle"><a href="libgda-4.0-GdaSqlStatement.html">GdaSqlStatement</a></span><span class="refpurpose"> — Structure which decomposes an SQL statement</span>
</dt>
</dl></dd>
<dt><span class="chapter"><a href="libgda-provider-pack.html">Assembling all the parts</a></span></dt>
<dd><dl>
<dt><span class="sect1"><a href="libgda-provider-pack.html#id1053979">libmain.c</a></span></dt>
<dd><dl>
<dt><span class="sect2"><a href="libgda-provider-pack.html#id1054015">plugin_init()</a></span></dt>
<dt><span class="sect2"><a href="libgda-provider-pack.html#id1054063">plugin_get_name()</a></span></dt>
<dt><span class="sect2"><a href="libgda-provider-pack.html#id1054084">plugin_get_description()</a></span></dt>
<dt><span class="sect2"><a href="libgda-provider-pack.html#id1054095">plugin_get_dsn_spec()</a></span></dt>
<dt><span class="sect2"><a href="libgda-provider-pack.html#id1054127">plugin_get_auth_spec()</a></span></dt>
<dt><span class="sect2"><a href="libgda-provider-pack.html#id1054143">plugin_create_provider()</a></span></dt>
</dl></dd>
</dl></dd>
</dl>
</div>
<p>
For each database engine, <span class="application">Libgda</span> requires an object which maps <span class="application">Libgda</span>'s API
to the native API offered by that database engine. That object, a <span class="emphasis"><em>database provider</em></span>
needs to inherit <a class="link" href="GdaServerProvider.html" title="GdaServerProvider">GdaServerProvider</a> and implement its
virtual methods.
</p>
<p>
Database provider objects are generally instantiated once by the <span class="application">Libgda</span> framework and can be used several
times to open and work on connections to several databases of the same type.
</p>
<p>
Since <span class="application">Libgda</span> itself is developed in the C language, and that most
providers are also implemented in that language, the <span class="application">Libgda</span> library
itself contains a set of helper classes and functions to guide you
in the addition of a new provider to the GDA framework. Two reference implementations
are provided in the <code class="filename">providers/skel-implementation</code>
directory of <span class="application">Libgda</span>'s sources:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>in <code class="filename">providers/skel-implementation/capi</code>: a skeleton
implementation from scratch for a database accessed through a C API, where all the methods to implement are partially
coded</p></li>
<li class="listitem"><p>in <code class="filename">providers/skel-implementation/models</code>: a skeleton
implementation to write a provider for sources which are not databases (which do not implement any SQL) such
as the Berkeley DB provider (a BDB database is a key/value collection) or the MDB (MS Access files) provider.
This kind of provider "export" tables which are in fact data models.</p></li>
</ul></div>
<p>
</p>
<p>
The helper objects and functions to write database providers are documented in the
<a class="link" href="psupport.html" title="Providers' support API">Providers' support API</a> section.
</p>
<div class="sect1">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id1009428"></a>Getting started</h2></div></div></div>
<p>
<span class="application">Libgda</span>'s sources contain templates to get started in creating a new database provider. The following templates
are available:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>the template in the <code class="filename">providers/skel-implementation/capi</code>
directory which can be used when writing a provider using the database's C or C++ API (for example
the PostgreSQL or MySQL providers)</p></li>
<li class="listitem"><p>the template in the <code class="filename">providers/skel-implementation/models</code>
directory which can be used when writing a provider for a system which is not a relational database (or
does offer a very limited API, such as for the MS Access or Berkeley DB systems).</p></li>
</ul></div>
<p>
</p>
<p>
In any case, for example to create a DummyDb provider, follow these steps:
</p>
<div class="itemizedlist"><ul class="itemizedlist" type="disc">
<li class="listitem"><p>copy one of the template's directory into a new directory named
<code class="filename">dummydb</code></p></li>
<li class="listitem"><p>From inside that new directory, run the
<code class="filename">providers/prepare_provider_sources.sh</code> script with the name
of the provider ("dummydb" here), the author's name and the author's email adress, which replaces
all the class and object names with the name of the provider and renames the files correctly. These
new sources should be compilable without any modification.</p></li>
<li class="listitem"><p>Edit the <code class="filename">Makefile.am</code> to add provider specific compilation and link
flags</p></li>
<li class="listitem"><p>Integrate the provider's new code into a compilation unit: either <span class="application">Libgda</span>'s sources in
the <code class="filename">providers</code>directory or in your own application (this step usually involves
modifying the <code class="filename">configure.ac</code> or <code class="filename">configure.in</code> files).</p></li>
<li class="listitem"><p>Implement the missing parts (it is usually a good idea to look how other provider's
implementations are done to get ideas).</p></li>
</ul></div>
<p>
</p>
</div>
</div>
<div class="footer">
<hr>
Generated by GTK-Doc V1.17</div>
</body>
</html>
|