/usr/share/gtk-doc/html/libgda-5.0/data-model.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 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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Managing data models: 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="getting_started.html" title="Code examples">
<link rel="prev" href="ch06s03.html" title="Executing queries">
<link rel="next" href="transactions.html" title="Managing transactions">
<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="getting_started.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="ch06s03.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="transactions.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="data-model"></a>Managing data models</h2></div></div></div>
<p>
Each time a SELECT query is executed, it returns a <a class="link" href="GdaDataModel.html" title="GdaDataModel">GdaDataModel</a>
object, which contains methods to access the returned data. Note that <a class="link" href="GdaDataModel.html" title="GdaDataModel">GdaDataModel</a>
is in fact an interface and is implemented in very various ways depending on the database provider executing the
query; however any GdaDataModel object is used the same way. Note that GdaDataModel objects are also generally used to
represent an array of data where all the data in a column is of the same type.
</p>
<p>
Some data models can be modified, some can't and knowing the features of a specific data model instance
can be done using the <a class="link" href="GdaDataModel.html#gda-data-model-get-access-flags" title="gda_data_model_get_access_flags ()">gda_data_model_get_access_flags ()</a>
and <a class="link" href="GdaDataModel.html#gda-data-model-get-attributes-at" title="gda_data_model_get_attributes_at ()">gda_data_model_get_attributes_at ()</a> methods.
Data models returned when SELECT queries are executed usually are not modifiable.
</p>
<p>
The value stored in each cell of a data model (at a <span class="emphasis"><em>(column, row)</em></span> position) is a
read-only <a href="../gobject/gobject-Generic-values.html#GValue">GValue</a> pointer.
Accessing the data in a GdaDataModel can be done using two methods:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem"><p>in a random access way using
<a class="link" href="GdaDataModel.html#gda-data-model-get-value-at" title="gda_data_model_get_value_at ()">gda_data_model_get_value_at ()</a> if the data model
supports random access</p></li>
<li class="listitem"><p>using a data model iterator as a cursor: a
<a class="link" href="GdaDataModelIter.html" title="GdaDataModelIter">GdaDataModelIter</a> object which is always supported by any data model.
</p></li>
</ul></div>
<p>
</p>
<div class="sect2">
<div class="titlepage"><div><div><h3 class="title">
<a name="data-model-table-access"></a>Example using random access</h3></div></div></div>
<p>
The following example displays the contents of a GdaDataModel using random access:
</p>
<pre class="programlisting">
void
show_data_model (GdaDataModel *dm)
{
gint row_id;
gint column_id;
const GValue *value;
for (column_id = 0; column_id < gda_data_model_get_n_columns (dm);
column_id++)
g_print("%s\t", gda_data_model_get_column_title (dm, column_id));
g_print("\n");
for (row_id = 0; row_id < gda_data_model_get_n_rows (dm); row_id++) {
for (column_id = 0; column_id < gda_data_model_get_n_columns (dm);
column_id++) {
char *str;
value = gda_data_model_get_value_at (dm, column_id, row_id, NULL);
str = gda_value_stringify (value);
g_print ("%s\t", str);
g_free (str);
}
g_print("\n");
}
}
</pre>
<p>
</p>
</div>
<div class="sect2">
<div class="titlepage"><div><div><h3 class="title">
<a name="data-model-row-access"></a>Example using an iterator</h3></div></div></div>
<p>
</p>
<pre class="programlisting">
void
show_data_model (GdaDataModel *dm)
{
gint column_id;
GdaDataModelIter *iter;
for (column_id = 0; column_id < gda_data_model_get_n_columns (dm);
column_id++)
g_print("%s\t", gda_data_model_get_column_title (dm, column_id));
g_print("\n");
iter = gda_data_model_create_iter (dm);
gda_data_model_iter_move_next (iter);
while (gda_data_model_iter_is_valid (iter)) {
GSList *list;
for (list = GDA_SET (iter)->holder; list; list = list->next) {
str = gda_holder_get_value_str (GDA_HOLDER (list->data), NULL);
g_print ("%s\t", str);
g_free (str);
}
g_print("\n");
}
g_object_unref (iter);
}
</pre>
<p>
</p>
</div>
<div class="sect2">
<div class="titlepage"><div><div><h3 class="title">
<a name="data-model-free"></a>Freeing data models</h3></div></div></div>
<p>
When you finish using data models you must free it, using <a href="../gobject/gobject-The-Base-Object-Type.html#g-object-unref">g_object_unref ()</a>.
</p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.27</div>
</body>
</html>
|