This file is indexed.

/usr/share/gtk-doc/html/libgda-5.0/gda-vala/table-class.html is in libgda-5.0-doc 5.2.2-1.

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
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<title>
    Table class
  </title>
<link rel="stylesheet" type="text/css" href="C.css">
<script type="text/javascript" src="jquery.js"></script><script type="text/javascript" src="jquery.syntax.js"></script><script type="text/javascript" src="yelp.js"></script>
</head>
<body><div class="page" role="main">
<div class="header"></div>
<div class="body">
<div class="hgroup"><h1 class="title"><span class="title">
    Table class
  </span></h1></div>
<div class="region">
<div class="contents">
<p class="p">
  <span class="code">Table</span> class is an implementation of <span class="code">DbTable</span> interface. It uses GDA to get access to a database's table description.
  </p>
<p class="p">
  In order to load data, you need to set a <span class="code">Gda.Connection</span> and a table's name. Then <span class="code">update()</span> method will introspect table information using GDA's MetaStore object and executing SELECT commands to retrive meta data to strore store it, you don't need to call update() again unless your table definition has changed.
  </p>
</div>
<div id="table-uml" class="sect"><div class="inner">
<div class="hgroup"><h2 class="title"><span class="title">Table class UML definition</span></h2></div>
<div class="region"><div class="contents"><div class="figure"><div class="inner">
<a href="#" class="zoom" data-zoom-in-title="View images at normal size" data-zoom-out-title="Scale images down"></a><div class="title title-figure"><h3><span class="title">UML definition</span></h3></div>
<div class="region">
<div class="contents"><div class="media media-image"><div class="inner"><img src="figures/table-class-uml.png" class="media media-block" alt=""></div></div></div>
<div class="desc">This diagram describes Table class and its implementations.</div>
</div>
</div></div></div></div>
</div></div>
<div id="table-update" class="sect"><div class="inner">
<div class="hgroup"><h2 class="title"><span class="title">Using a Table class to access a table meta data</span></h2></div>
<div class="region"><div class="contents">
<div class="listing"><div class="inner"><div class="region">
<div class="desc">
  This codes initiate a Table class, set a name and a connection in order to call update()
  </div>
<div class="contents"><div class="code"><pre class="contents syntax brush-clang">  var t = new Table ();
  t.name = "customer";
  t.connection = connection;
  t.update ();
  </pre></div></div>
</div></div></div>
<p class="p">In the above code, connection is opened before to be set to <span class="code">Table.connection</span> property. You need to set <span class="code">Table.name</span> property. Internally <span class="code">Gda.Connection.update_meta_store()</span> is called, this could take some time, then executes some SELECT commands to introspect table, columns description are stored in <span class="code">DbFiledInfo</span> objects.
  </p>
</div></div>
</div></div>
<div id="table-append" class="sect"><div class="inner">
<div class="hgroup"><h2 class="title"><span class="title">Using a Table class to add a new table</span></h2></div>
<div class="region"><div class="contents">
<div class="listing"><div class="inner"><div class="region">
<div class="desc">This setup a table to be added to a database's table</div>
<div class="contents"><div class="code"><pre class="contents syntax brush-clang">  var t = new Table ();
  t.name = "created_table";
  t.connection = connection;
  var field = new FieldInfo ();
  // Setup column id
  field.name = "id";
  field.value_type = typeof (int);
  field.attributes = DbFieldInfo.Attribute.PRIMARY_KEY | 
                     DbFieldInfo.Attribute.AUTO_INCREMENT;
  t.set_field (field);
  
  // Setup column name
  var field1 = new FieldInfo ();
  field1.name = "name";
  field1.value_type = typeof (string);
  field1.attributes = DbFieldInfo.Attribute.NONE;
  t.set_field (field1);
  
  // Setup column company
  var field2 = new FieldInfo ();
  field2.name = "company";
  field2.value_type = typeof (int);
  field2.default_value = 1;
  
  // Setup column's foreign key
  var fk = new DbFieldInfo.ForeignKey ();
  var rt = new Table ();
  rt.name = "company";
  fk.reftable = rt;
  fk.refcol.add ("id");
  fk.update_rule = DbFieldInfo.ForeignKey.Rule.CASCADE;
  fk.delete_rule = DbFieldInfo.ForeignKey.Rule.SET_DEFAULT;
  field2.fkey = fk;
  t.set_field (field2);
  
  // Append new table
  t.append ();
  </pre></div></div>
</div></div></div>
<p class="p">
  In the above code a new table will be added. Create a new <span class="code">Table</span> object, set its name and connection, use <span class="code">Table.set_field()</span> to set column definitions. You must create <span class="code">DbFieldInfo</span> objects, setting its name, type and attributes is enough to be set in a table. If your column must be a PRIMARY KEY you must set <span class="code">DbFieldInfo.attributes</span> to <span class="code">DbFieldInfo.Attribute.PRIMARY_KEY</span>; if it is autoincrement key you must use <span class="code">|</span> operator to add a <span class="code">DbFieldInfo.Attribute.AUTO_INCREMENT</span> attribute.
  </p>
<p class="p">
  If the column will refer to a column in other table as a foreign key you must set <span class="code">DbFieldInfo.fkey</span>. ForeignKey object is used for column's foreign keys.
  </p>
</div></div>
</div></div>
<div id="" class="sect"><div class="inner">
<div class="hgroup"><h2 class="title"><span class="title">Deleting tables</span></h2></div>
<div class="region"><div class="contents">
<p class="p">
  If you want to delete a table you must create a new <span class="code">Table</span> object, set a name and a <span class="code">Gda.Connection</span>; finally you just call <span class="code">Table.drop()</span> method.
  </p>
<div class="listing"><div class="inner">
<div class="title title-listing"><h3><span class="title">Dropping a table. Example </span></h3></div>
<div class="region">
<div class="desc">This code describes how to delete a table in a database</div>
<div class="contents"><div class="code"><pre class="contents ">    var t = new Table ();
    t.name = "table_name";
    t.connection = connection;
    t.drop ();
    </pre></div></div>
</div>
</div></div>
</div></div>
</div></div>
<div id="table-fields" class="sect"><div class="inner">
<div class="hgroup"><h2 class="title"><span class="title">Iterating through Fields definitions</span></h2></div>
<div class="region"><div class="contents">
<p class="p">
  You can iterate over <span class="code">Table</span>'s fields descriptions using Vala <span class="code">foreach</span> statement, by using <span class="code">Record.fields</span> property; it's a <span class="code">Gee.Collection</span> of <span class="code">DbFieldInfo</span> objects, then you can use:
  </p>
<div class="code"><pre class="contents syntax brush-clang">  foreach (DbFieldInfo f in table.fields) {
    /* work with DbField object */
  }
  </pre></div>
<p class="p">
  The same apply for all keys you set by using <span class="code">Table.primary_keys</span> property.
  </p>
</div></div>
</div></div>
<div id="" class="sect"><div class="inner">
<div class="hgroup"><h2 class="title"><span class="title">Access rows in a table</span></h2></div>
<div class="region"><div class="contents">
<p class="p">
  All rows in a table can be accessed using <span class="code">Table.records</span> property, as a <span class="code">Gee.Collection</span> of <span class="code">DbRecord</span> objects. Internally, when this property is accessed a "SELECT * FROM table" SQL command is executed, you can filter them using <span class="code">Gee.Traversable.filter()</span> function.
  </p>
<div class="note note-tip" title="Tip"><div class="inner"><div class="region"><div class="contents"><p class="p">
  <span class="code">Table.records</span> is a <span class="code">RecordCollection</span> object that implements <span class="code">DbRecordCollection</span> and its pre-requisites: <span class="code">Gee.Collection</span>, <span class="code">Gee.Traversable</span> and <span class="code">Gee.Iterable</span>
  </p></div></div></div></div>
<div class="note note-tip" title="Tip"><div class="inner"><div class="region"><div class="contents"><p class="p">
  Future implementations will include a way to create powerful filter to be used when SQL command is executed to avoid load all rows and iterate all over them when using <span class="code">Gee.Traversable.filter()</span>.
  </p></div></div></div></div>
</div></div>
</div></div>
<div id="table-dependencies" class="sect"><div class="inner">
<div class="hgroup"><h2 class="title"><span class="title">Table's dependencies</span></h2></div>
<div class="region">
<div class="contents"><p class="p">
  In order to introspect a database table, you must create a new <span class="code">Table</span> object, set a name and a <span class="code">Gda.Connection</span>, then call  <span class="code">Table.update()</span>. After this you are able to know its dependencies.
  </p></div>
<div id="table-dependencies-depends" class="sect"><div class="inner">
<div class="hgroup"><h3 class="title"><span class="title">ForeignKeys</span></h3></div>
<div class="region"><div class="contents"><p class="p">
You can access to all <span class="code">DbTable</span> objects referenced in foreign keys for each column in the table definition, using <span class="code">Table.depends</span>, through a <span class="code">Gee.Collection</span> of <span class="code">DbTable</span> objects.
  </p></div></div>
</div></div>
<div id="table-dependencies-referenced" class="sect"><div class="inner">
<div class="hgroup"><h3 class="title"><span class="title">Tables referencing your table</span></h3></div>
<div class="region"><div class="contents"><p class="p">
  Using <span class="code">Table.referenced</span> property, you can access to a <span class="code">Gee.Collection</span> of <span class="code">DbTable</span> objects that depends on your table.
  </p></div></div>
</div></div>
</div>
</div></div>
</div>
<div class="clear"></div>
</div>
<div class="footer"><div class="sect about ui-expander" role="contentinfo">
<div class="yelp-data yelp-data-ui-expander" data-yelp-expanded="false"></div>
<div class="inner">
<div class="hgroup"><h2><span class="title">About</span></h2></div>
<div class="region"><div class="contents">
<div class="aboutblurb authors">
<div class="title"><span class="title">Written By</span></div>
<ul class="credits"><li>Daniel Espinosa</li></ul>
</div>
<div class="aboutblurb license">
<div class="title"><span class="title">License</span></div>
<div class="contents"><p class="p">Creative Commons Share Alike 3.0</p></div>
</div>
</div></div>
</div>
</div></div>
</div></body>
</html>