XBase INSERT statement


INSERT INTO Syntax

INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);

INSERT INTO table_name
VALUES (value1, value2, value3, ...);

Here fields is a (optional) comma separated list of fields to set, list of values is a list of constants to assign. If the fields are not specified, sets the fields in the natural order of the table. You can use bind parameters in the list of values.

Examples:

#!/usr/bin/perl
# test4.pl
use cPanelUserConfig;

use strict;
use warnings;
use DBI;
use XBase; # and we want the basic XBase handling modules

print "Content-type: text/html\n\n";

print "Start! <br>";

my $newtable = XBase->create("name" => "test4.dbf",
"field_names" => [ "ID", "MSG" ],
"field_types" => [ "N", "C" ],
"field_lengths" => [ 6, 40 ],
"field_decimals" => [ 0, undef ]);

my $dbf_dir = '.';
my $dbh = DBI->connect("DBI:XBase:$dbf_dir") or die $DBI::errstr;

my $def = "insert into test4 (id,msg) values (1,'Error 1')";

$dbh->do($def);

$dbh->disconnect();

print "End!";

Save the code to the file, say, test4.pl.

Hi, I'm Siswoyo. 

Programmer, System Analyst, System Analyst and Developer, SAP Coordinator, Application Support Analyst, Technical Analyst, Field Service Engineer,  ...