File: chap1.html

package info (click to toggle)
xbsql 0.11-7
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,524 kB
  • ctags: 709
  • sloc: sh: 9,259; cpp: 5,356; yacc: 668; xml: 186; makefile: 49; perl: 33
file content (132 lines) | stat: -rw-r--r-- 5,283 bytes parent folder | download | duplicates (3)
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
<HTML>
<HEAD>
<TITLE>
XBSQL: An SQL wrapper for the XBase DBMS library
</TITLE>
</HEAD>
<BODY>
<DIV ALIGN=right>
  <A HREF="chap2.html">Next</A>
  <A HREF="index.html">Previous</A>
  <A HREF="index.html">Table of Contents</A>
</DIV>
<H2>1. The XBaseSQL class</H2>
<P>
  <B>XBaseSQL</B> is the root class for the XBSQL wrapper; an instance of
  this class represents a database. The class is in fact derived from the
  XBase <B>xbXBase</B> class.
</P>
<P>
  A database is considered to be the set of <I>.dbf</I> and related files
  in a particular directory (but not in any subdirectory). The <B>XBaseSQL</B>
  constructor takes a single argument, which is the directory path.
</P>
<P>
  Note that queries (<I>select</I>, ...) can use the <B>?</B> character as
  place-holders, in which case values are substituted when the query is
  actually executed.
</P>
<P>
  <UL>
    <LI><B>XBSQLQuery *XBaseSQL::openQuery (const char *)</B><BR/>
      This method takes an SQL statement. Unless there is an error (in which
      case the result is null), this returns a pointer at an instance of a
      class which represents the parsed and verified query. This result will
      actually be an instance of <B><A href="chap2.html">XBSQLSelect</A></B>, <B><A href="chap3.html">XBSQLInsert</A></B>, ....,
      as appropriate, but is returned as a pointer at a base class
      <B>XBSQLQuery</B>. See <A href="#which">below</A> for details of
      determining which applies.
      <P>&nbsp;</P>
    </LI>
    <LI><B><A href="chap2.html">XBSQLSelect</A> *XBaseSQL::openSelect (const char *), ...</B><BR/>
      This, and the similar <B>openInsert</B>, <B>openUpdate</B> and
      <B>openDelete</B> methods take a <I>select</I> (or <I>insert</I>, ...)
      SQL query, and return a pointer at an object representing that
      particular type of query. They are essentially special cases of the
      <B>openQuery</B> method.
      <P>&nbsp;</P>
    </LI>
    <LI><B>bool XBaseSQL::execCommand (const char *)</B><BR/>
      This method is used to execute SQL commands, such as <I>create table</I>
      and <I>drop table</I> which return either success or failure.
      <P>&nbsp;</P>
    </LI>
    <LI><B>bool XBaseSQL::dropTable (const char *)</B><BR/>
      This is a shortcut to drop a named table. Any indexes which were
      created by the XBSQL wrapper will be deleted.
      <P>&nbsp;</P>
    </LI>
    <LI><B>bool XBaseSQL::renameTable (const char *)</B><BR/>
      This is a shortcut to rename a table. Any indexes which were
      created by the XBSQL wrapper will be appropriately renamed.
      <P>&nbsp;</P>
    </LI>
    <LI><B>XBSQLTableSet *XBaseSQL::getTableSet()</B><BR/>
      This method returns an object which contains a list of all
      tables in the database.
      <P>&nbsp;</P>
    </LI>
    <LI><B>XBSQLFieldSet *XBaseSQL::getFieldSet(const char *)</B><BR/>
      This method returns an object which contains a list of all fields
      in a named table, plus information about those fields.
      <P>&nbsp;</P>
    </LI>
    <LI><B>const char *XBaseSQL::lastError()</B><BR/>
      In the event of an error, this method returns a corresponding
      error message string.
    </LI>
  </UL>
</P>
<P>
  In addition to the above, there are some addition methods which can be
  used to control the behaviour of the XBSQL library:
</P>
<P>
  <UL>
    <LI><B>void XBaseSQL::setClosePack(bool)</B><BR/>
      This method is used to enable (or disable) packing of tables on
      close. Packing removes deleted records, which would otherwise
      remain and simply be flagged as deleted.
    </LI>
    <LI><B>void XBaseSQL::setCaseSensitive(bool)</B><BR/>
      By default, string comparisom in query expressions (both for
      (in)equality and for <i>like</i>) are case insensitive. This method
      is used to enable (and disable) case sensitive comparisom.
    </LI>
    <LI><B>void XBaseSQL::setUseWildcard(bool)</B><BR/>
      The defualt operation of the <i>like</i> operator is to use the
      <i>%</i> character to match arbitrary (possibly empty) strings.
      This method can be used to enable (and disable) wildcard matching,
      which uses UNIX shell-like wildcard characters.
    </LI>
    <LI><B>void XBaseSQL::setGoSlow(bool)</B><BR/>
      This option affects select queries. When set, the data is handled
      in a manner which reduces the amount of memory used, at the
      expense of execution time. It is probably only useful where the
      query will return large amounts of data. Performance will be
      worst affected if the data (rows and columns) are accessed
      randomly.
    </LI>
  </UL>
</P>
<P>
  <A name="which"/>
  Given an <B>XBSQLQuery</B> object, the particular type can be determined
  with the following set of methods. Each returns a null pointer if the
  object is not the corresponding type, or a safely type-cast pointer if
  it is.
  <UL>
    <LI><B><A href="chap2.html">XBSQLSelect</A> *XBSQLQuery::isSelect()</B></LI>
    <LI><B><A href="chap3.html">XBSQLInsert</A> *XBSQLQuery::isInsert()</B></LI>
    <LI><B><A href="chap4.html">XBSQLUpdate</A> *XBSQLQuery::isUpdate()</B></LI>
    <LI><B><A href="chap5.html">XBSQLDelete</A> *XBSQLQuery::isDelete()</B></LI>
  </UL>
<P>
  
</P>
<P>
</P>
<P>
</P>
</BODY>
</HTML>