/usr/share/gtk-doc/html/libgda-5.0/howto-meta2.html is in libgda-5.0-doc 5.2.4-9.
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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Update the meta data about a table: GNOME Data Access 5 manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GNOME Data Access 5 manual">
<link rel="up" href="howto.html" title="HOWTO for common tasks">
<link rel="prev" href="howto-meta1.html" title="Get information about a table's columns">
<link rel="next" href="ch12s11.html" title="Validate a DML statement">
<meta name="generator" content="GTK-Doc V1.27 (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="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="howto.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="howto-meta1.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="ch12s11.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="sect1">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="howto-meta2"></a>Update the meta data about a table</h2></div></div></div>
<p>
For a general overview of the mete data problem, see the
Get information about a table's columns section. Updating the meta data
can be done by calling
<a class="link" href="GdaConnection.html#gda-connection-update-meta-store" title="gda_connection_update_meta_store ()">gda_connection_update_meta_store()</a> with a %NULL
"context" argument, but this
call updates the whole meta data which will always do the job, but sometimes one knows that only a
part of the meta data need to be updated. Here is an example of how to use a specific
<a class="link" href="GdaMetaStore.html#GdaMetaContext" title="GdaMetaContext">GdaMetaContext</a> argument.
</p>
<p>
Specifically the following code
updates the meta data regarding the "customers" table:
</p>
<pre class="programlisting">
GdaConnection *connection=...
GError *error = NULL;
GValue *table;
GdaMetaContext *mcontext = gda_meta_context_new ();
/* This is a table in the dababase schema for Meta Store to update */
gda_meta_context_set_table ("_tables");
/* Next setup a value to be used as the column in the last table to be used as a condition in the update
in this case we will use the column 'table_name' and update for 'customers'*/
table = gda_value_new (G_TYPE_STRING);
g_value_set_string (table, "customers");
gda_meta_context_set_column ("table_name", table);
gboolean result;
result = gda_connection_update_meta_store (connection, mcontext, &error);
gda_value_free (table);
gda_meta_context_free (mcontext);
if (!result) {
/* handle the error */
g_error_free (error);
}
</pre>
<p>
</p>
<p>
Internally <a class="link" href="GdaSqlParser.html#gda-sql-identifier-quote" title="gda_sql_identifier_quote ()">gda_meta_context_set_column()</a> calls
<a class="link" href="GdaSqlParser.html#gda-sql-identifier-quote" title="gda_sql_identifier_quote ()">gda_sql_identifier_quote()</a> which ensure that the contents of
<code class="code">mcontext.column_values</code> values is conform to the convention used by the
<a class="link" href="GdaMetaStore.html" title="GdaMetaStore">GdaMetaStore</a> to represent SQL identifiers when the
values represent an SQL identifier (which is the case in the example above). For more information,
see the <a class="link" href="information_schema.html#information_schema:sql_identifiers" title="SQL identifiers">meta data section about SQL identifiers</a>.
Even though not strictly necessary, it used all the time.
For example if the table name for which a meta data update is requested had been <span class="emphasis"><em>"Customers"</em></span>
(note the upper case C at the beginning and the double quotes) because this is how the database know it, then
not using <a class="link" href="GdaSqlParser.html#gda-sql-identifier-quote" title="gda_sql_identifier_quote ()">gda_sql_identifier_quote()</a> may not have done as
expected.
</p>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.27</div>
</body>
</html>
|