1DBD::XBase(3)         User Contributed Perl Documentation        DBD::XBase(3)
2
3
4

NAME

6       DBD::XBase - DBI driver for XBase compatible database files
7

SYNOPSIS

9           use DBI;
10           my $dbh = DBI->connect("DBI:XBase:/directory/subdir")
11                                       or die $DBI::errstr;
12           my $sth = $dbh->prepare("select MSG from test where ID != 1")
13                                       or die $dbh->errstr();
14           $sth->execute() or die $sth->errstr();
15
16           my @data;
17           while (@data = $sth->fetchrow_array())
18                       { ## further processing }
19
20           $dbh->do('update table set name = ? where id = 45', {}, 'krtek');
21

DESCRIPTION

23       DBI compliant driver for module XBase. Please refer to DBI(3)
24       documentation for how to actually use the module. In the connect call,
25       specify the directory containing the dbf files (and other, memo, etc.)
26       as the third part of the connect string. It defaults to the current
27       directory.
28
29       Note that with dbf, there is no database server that the driver would
30       talk to. This DBD::XBase calls methods from XBase.pm module to read and
31       write the files on the disk directly, so any limitations and features
32       of XBase.pm apply to DBD::XBase as well. DBD::XBase basically adds SQL,
33       DBI compliant interface to XBase.pm.
34
35       The DBD::XBase doesn't make use of index files at the moment. If you
36       really need indexed access, check XBase(3) for notes about support for
37       variour index types.
38

SUPPORTED SQL COMMANDS

40       The SQL commands currently supported by DBD::XBase's prepare are:
41
42   select
43           select fields_or_expressions from table [ where condition ]
44                                               [ order by field ]
45
46       Fields_or_expressions is a comma separated list of fields or arithmetic
47       expressions, or a "*" for all fields from the table. The "where"
48       condition specifies which rows will be returned, you can have arbitrary
49       arithmetic and boolean expression here, compare fields and constants
50       and use "and" and "or". Match using "like" is also supported. Examples:
51
52           select * from salaries where name = "Smith"
53           select first,last from people where login = "ftp"
54                                                       or uid = 1324
55           select id,first_name,last_name from employ
56                       where last_name like 'Ki%' order by last_name
57           select id + 1, substr(name, 1, 10) from employ where age > 65
58           select id, name from employ where id = ?
59
60       You can use bind parameters in the where clause, as the last example
61       shows. The actual value has to be supplied via bind_param or in the
62       call to execute or do, see DBI(3) for details. To check for NULL values
63       in the "where" expression, use "id is null" and "id is not null", not
64       "id == null".
65
66       Please note that you can only select from one table, joins are not
67       supported and are not planned to be supported. If you need them, get a
68       real RDBMS (or send me a patch).
69
70       In the arithmetic expressions you can use a couple of SQL functions --
71       currently supported are concat, substr (and substring), trim, ltrim and
72       rtrim, length. I do not have an exact idea of which and how many
73       functions I want to support. It's easy to write them in a couple of
74       minutes now the interface is there (check the XBase::SQL module if you
75       want to send a patch containing support for more), it's just that I do
76       not really need them and sometimes it's hard to tell what is usefull
77       and what is SQL92 compatible. Comment welcome.
78
79       The select command may contain and order by clause. Only one column is
80       supported for sorting at the moment, patches are welcome.
81
82       The group by clause is not supported (and I do not plan them), nor are
83       the aggregate functions.
84
85   delete
86           delete from table [ where condition ]
87
88       The "where" condition is the same as for select. Examples:
89
90           delete from jobs            ## emties the table
91           delete from jobs where companyid = "ISW"
92           delete from jobs where id < ?
93
94   insert
95           insert into table [ ( fields ) ] values ( list of values )
96
97       Here fields is a (optional) comma separated list of fields to set, list
98       of values is a list of constants to assign. If the fields are not
99       specified, sets the fields in the natural order of the table.  You can
100       use bind parameters in the list of values. Examples:
101
102           insert into accounts (login, uid) values ("guest", 65534)
103           insert into accounts (login, uid) values (?, ?)
104           insert into passwd values ("user","*",4523,100,"Nice user",
105                                       "/home/user","/bin/bash")
106
107   update
108           update table set field = new value [ , set more fields ]
109                                               [ where condition ]
110
111       Example:
112
113           update passwd set uid = 65534 where login = "guest"
114           update zvirata set name = "Jezek", age = 4 where id = 17
115
116       Again, the value can also be specified as bind parameter.
117
118           update zvirata set name = ?, age = ? where id = ?
119
120   create table
121           create table table name ( columns specification )
122
123       Columns specification is a comma separated list of column names and
124       types. Example:
125
126           create table rooms ( roomid int, cat char(10), balcony boolean )
127
128       The allowed types are
129
130           char num numeric int integer float boolean blob memo date time
131           datetime
132
133       Some of them are synonyms. They are of course converted to appropriate
134       XBase types.
135
136   drop table
137           drop table table name
138
139       Example:
140
141           drop table passwd
142

ATTRIBUTES

144       Besides standard DBI attribudes, DBD::XBase supports database handle
145       attribute xbase_ignorememo:
146
147               $dbh->{'xbase_ignorememo'} = 1;
148
149       Setting it to 1 will cause subsequent tables to be opened while
150       ignoring the memo files (dbt, fpt). So you can read dbf files for which
151       you don't have (you have lost them, for example) the memo files.  The
152       memo fields will come out as nulls.
153

VERSION

155       1.08
156

AVAILABLE FROM

158       http://www.adelton.com/perl/DBD-XBase/
159

AUTHOR

161       (c) 1997--2017 Jan Pazdziora.
162
163       Contact the author at jpx dash perl at adelton dot com.
164

SEE ALSO

166       perl(1); DBI(3), XBase(3); dbish(1)
167
168       Translation into Japanese (older version) at
169       http://member.nifty.ne.jp/hippo2000/perltips/DBD/XBase.htm by Kawai
170       Takanori.
171
172
173
174perl v5.36.0                      2022-07-22                     DBD::XBase(3)
Impressum