mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-17 16:40:07 +02:00
116 lines
6.2 KiB
HTML
116 lines
6.2 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
<title>Store 'postgresql'</title>
|
||
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
|
||
<link rel="start" href="index.html" title="Redland RDF Library Manual">
|
||
<link rel="up" href="redland-storage-modules.html" title="Storage Modules">
|
||
<link rel="prev" href="redland-storage-module-mysql.html" title="Store 'mysql'">
|
||
<link rel="next" href="redland-storage-module-sqlite.html" title="Store 'sqlite'">
|
||
<meta name="generator" content="GTK-Doc V1.10 (XML mode)">
|
||
<link rel="stylesheet" href="style.css" type="text/css">
|
||
<link rel="chapter" href="redland.html" title="Redland Overview">
|
||
<link rel="chapter" href="introduction.html" title="Introduction">
|
||
<link rel="part" href="tutorial.html" title="Part I. Tutorial">
|
||
<link rel="part" href="reference-manual.html" title="Part II. Reference Manual">
|
||
<link rel="chapter" href="objects.html" title="Objects in C">
|
||
<link rel="chapter" href="redland-storage-modules.html" title="Storage Modules">
|
||
<link rel="index" href="indexes.html" title="Index">
|
||
</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="redland-storage-module-mysql.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
|
||
<td><a accesskey="u" href="redland-storage-modules.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></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">Redland RDF Library Manual</th>
|
||
<td><a accesskey="n" href="redland-storage-module-sqlite.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
|
||
</tr></table>
|
||
<div class="section" lang="en">
|
||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||
<a name="redland-storage-module-postgresql"></a>Store 'postgresql'</h2></div></div></div>
|
||
<p>This module is based on the MySQL store and is compiled in when
|
||
PostgreSQL is available. This store provides storage using the
|
||
<a class="ulink" href="http://www.postgresql.org/" target="_top">PostgreSQL</a>
|
||
open source database including contexts. This store was added in
|
||
Redland 1.0.3.</p>
|
||
<p>There are several options required with the postgresql storage
|
||
in order to connect to the database. These are:</p>
|
||
<div class="itemizedlist"><ul type="disc">
|
||
<li><p><code class="literal">host</code> for the database server hostname</p></li>
|
||
<li><p><code class="literal">port</code> for the database server port (defaults to the Postgresql port 3306 if not given)</p></li>
|
||
<li><p><code class="literal">database</code> for the Postgresql database name (not the storage name)</p></li>
|
||
<li><p><code class="literal">user</code> for the database server user name</p></li>
|
||
<li><p><code class="literal">password</code> for the database server password</p></li>
|
||
<li><p><code class="literal">database</code> for the Postgresql database name (not the storage name)</p></li>
|
||
</ul></div>
|
||
<p>NOTE: Before Redland 1.0.5, the
|
||
parameter <code class="literal">dbname</code> had to be used instead
|
||
of <code class="literal">database</code> for the Postgresql database name.</p>
|
||
<p>NOTE: Take care exposing the password as for example, program
|
||
arguments or environment variables. The rdfproc utility can with
|
||
help this by reading the password from standard input. Inside
|
||
programs, one way to prevent storing the password in a string is to
|
||
construct a Redland hash of the storage options such as
|
||
via <code class="literal">librdf_hash_from_string</code> and use
|
||
<code class="literal">librdf_new_storage_with_options</code> to create a storage.
|
||
The rdfproc utility source code demonstrates this.
|
||
</p>
|
||
<p>The storage name parameter given to the storage constructor
|
||
<code class="literal">librdf_new_storage</code> is used inside the postgresql
|
||
store to allow multiple stores inside one PostgreSQL database
|
||
instance as parameterised with the above optiosn.</p>
|
||
<p>If boolean option <code class="literal">new</code> is given, any existing
|
||
PostgreSQL database named by the storage
|
||
option <code class="literal">database</code>, say
|
||
<span class="emphasis"><em>db</em></span> will be dropped and the appropriate new
|
||
tables created. The PostgreSQL database <span class="emphasis"><em>db</em></span> must
|
||
already exist, such as made with the PostgreSQL <code class="literal">create
|
||
database </code><span class="emphasis"><em>db</em></span> command and the
|
||
appropriate priviledges set so that the user and password
|
||
work.</p>
|
||
<p>This store always provides contexts; the boolean storage option
|
||
<code class="literal">contexts</code> is not checked.</p>
|
||
<p>Examples:</p>
|
||
<pre class="programlisting">
|
||
/* A new PostgreSQL store */
|
||
storage=librdf_new_storage(world, "postgresql", "db1",
|
||
"new='yes',host='localhost',database='red',user='foo','password='bar'");
|
||
|
||
/* A different, existing PostgreSQL store db2 in the same database as above */
|
||
storage=librdf_new_storage(world, "postgresql", "db2",
|
||
"host='localhost',database='red',user='foo','password='bar'");
|
||
|
||
/* An existing PostgreSQL store on a different database server */
|
||
storage=librdf_new_storage(world, "postgresql", "db3",
|
||
"host='db.example.org',database='abc',user='baz','password='blah'");
|
||
|
||
/* Opening with an options hash */
|
||
options=librdf_new_hash(world, NULL);
|
||
librdf_hash_from_string(options,
|
||
"host='db.example.org',database='abc',user='baz'");
|
||
librdf_hash_put_strings(options, "password", user_password);
|
||
storage=librdf_new_storage_with_options(world, "postgresql", "db4", options);
|
||
</pre>
|
||
<p>In PHP:</p>
|
||
<pre class="programlisting">
|
||
# An existing store
|
||
$storage=librdf_new_storage($world, 'postgresql', 'db4',
|
||
"host='127.0.0.1',database='xyz',user='foo',password='blah'");
|
||
|
||
</pre>
|
||
<p>Summary:</p>
|
||
<div class="itemizedlist"><ul type="disc">
|
||
<li><p>Persistent</p></li>
|
||
<li><p>Suitable for very large models</p></li>
|
||
<li><p>Indexed but not optimised</p></li>
|
||
<li><p>Smaller disk usage than BDB</p></li>
|
||
<li><p>Contexts always provided</p></li>
|
||
</ul></div>
|
||
</div>
|
||
<div class="footer">
|
||
<hr>
|
||
Generated by GTK-Doc V1.10</div>
|
||
</body>
|
||
</html>
|