断开连接
Data
Data list
Retrieve data from previous fetch for a list of field names.
In a scalar context it returns all of the field values concatenated together.
In an array context, it returns an array of the values, in the order in which they were
specified.
If no field names are given, all fields are returned in an unspecified order.
Example:
$db->Sql("SELECT f1, f2, f3 FROM foo");
$db->FetchRow();
($f1, $f2) = $db->Data("f1", "f2");
or
$db->Sql("SELECT * FROM foo");
$db->FetchRow();
@values = $db->Data;
See also: DataHash
DataHash
DataHash list
Retrieve data from previous fetch for a list of field names. Returns a hash where the field name is the key. If no field names are given, all fields are returned.
Example:
$db->Sql("SELECT f1, f2, f3 FROM foo");
$db->FetchRow();
%hash = $db->DataHash("f1", "f2");
print $hash{f1};
or
$db->Sql("SELECT * FROM foo");
$db->FetchRow();
%hash = $db->DataHash;
foreach $key (sort(keys %hash)) {
print $key, '=', $hash{$key}, "\n";
}
See also: Data
DataSources
Returns an associative array of Data Sources and ODBC remarks in the form of:
$ArrayName{'DSN'} = Remark
where DSN is the Data Source Name and Remark is, well, the remark.
Example:
%rem = $db->DataSources;
print LOG qq(Current DSN's Remark: "), %rem{$db->GetDSN}, qq("\n);
Back to the top
Drivers
Returns an associative array of Drivers and their attributes in the form of:
$ArrayName{'DRIVER'} = Attrib1;Attrib2;Attrib3;...
where DRIVER is the ODBC Driver Name and AttribX are the driver-defined attributes.
Example:
%attrib = $db->Drivers;
print LOG qq($driver: $attrib{$driver}\n) foreach $driver (keys %attrib);
Back to the top
DumpError
Dump to the screen details about the last error condition. This includes error number, error text and the ODBC connection number that caused the error (if there is one). This is used primarily for debugging.
Example:
$db = new Win32::ODBC("My DSN");
if (undef $db){
Win32::ODBC::DumpError();