Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (中文) » SQL Anywhere 服务器 - 编程 » SQL Anywhere 数据访问 API » SQL Anywhere Perl DBD::SQLAnywhere DBI 模块 » 编写使用 DBD::SQLAnywhere 的 Perl 脚本

 

装载 DBI 模块

要在 Perl 脚本中使用 DBD::SQLAnywhere 接口,必须先告诉 Perl 您打算使用 DBI 模块。为此,请在文件的顶部包括下面的命令行。

use DBI;

此外,强烈建议您在严格模式下运行 Perl。例如强制要求显式变量定义的语句,可大大减少由于常见失误(如键入错误)而产生的莫名其妙的错误。

#!/usr/local/bin/perl -w
#
use DBI;
use strict;

必要时 DBI 模块会自动装载 DBD 驱动程序(包括 DBD::SQLAnywhere)。