/usr/share/gtk-doc/html/libgda-5.0/ch12s08.html is in libgda-5.0-doc 5.2.4-1ubuntu1.
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 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Execute a DDL command: 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="ch12s07.html" title="Get the last inserted row">
<link rel="next" href="howto-meta1.html" title="Get information about a table's columns">
<meta name="generator" content="GTK-Doc V1.25 (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="ch12s07.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="howto-meta1.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="id-1.3.3.10"></a>Execute a DDL command</h2></div></div></div>
<p>
DDL commands (commands to modify the database schema such as create tables and views, change
users' access rights, etc) are treated in the same way as non select commands (refer to
the <a class="link" href="howto-exec-select.html" title="Execute a SELECT command">HOWTO</a> about executing non SELECT commands). However
<span class="application">Libgda</span> offers a better and more portable way of executing such commands: using a
<a class="link" href="GdaServerOperation.html" title="GdaServerOperation">GdaServerOperation</a> object.
</p>
<p>
Executing a DDL command involves the following steps:
</p>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem"><p>Request a new <a class="link" href="GdaServerOperation.html" title="GdaServerOperation">GdaServerOperation</a> object from
the database provider for a specific operation using the
<a class="link" href="GdaServerProvider.html#gda-server-provider-create-operation" title="gda_server_provider_create_operation ()">gda_server_provider_create_operation()</a> function.
</p></li>
<li class="listitem"><p>Specify the <a class="link" href="GdaServerOperation.html" title="GdaServerOperation">GdaServerOperation</a> object's
behaviour by setting some pre-defined parameters; for example when creating a table, the parameters
to be set include the tables name, the names of the columns, the constraints, etc. The list
of parameters to set is listed by the <a class="link" href="libgda-list-server-op.html" title="gda-list-server-op-5.0">gda-list-server-op</a>
program.
</p></li>
<li class="listitem"><p>Ask the server provider to execute the operation based on the
<a class="link" href="GdaServerOperation.html" title="GdaServerOperation">GdaServerOperation</a> object
</p></li>
</ol></div>
<p>
</p>
<p>
The following code in part illustrates how to create a view:
</p>
<pre class="programlisting">
GdaServerOperation *op;
op = gda_connection_create_operation (cnc, GDA_SERVER_OPERATION_CREATE_VIEW, NULL, &error);
if (!op)
/* there was an error while creating the GdaServerOperation object */
else {
/* define the view to create */
if (!gda_server_operation_set_value_at (op, "myview", &error,
"/VIEW_DEF_P/VIEW_NAME") ||
!gda_server_operation_set_value_at (op, "SELECT * FROM customers", &error,
"/VIEW_DEF_P/VIEW_DEF"))
/* there was an error */
else {
if (! gda_connection_perform_operation (cnc, op, &error))
g_print ("Error\n");
else
g_print ("View created\n");
}
g_object_unref (op);
}
</pre>
<p>
</p>
<p>
Please also note that <span class="application">Libgda</span> provides some convenience functions to wrap this process, see the
Convenience functions section for more
information.
</p>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25</div>
</body>
</html>
|