2 chdir 't' if -d 't/lib';
4 require Config; import Config;
5 if ($Config{'extensions'} !~ /\bOS2(::|\/)REXX\b/) {
24 OS2::REXX::_fetch("SQLCA.SQLCODE");
29 OS2::REXX::_fetch("SQLCA.SQLSTATE");
34 my ($stmt) = stmt(@_);
35 return 0 if OS2::REXX::_call("sqlexec", $sqlexec, "", $stmt);
36 return sqlcode() >= 0;
41 my ($stmt) = stmt(@_);
42 return 0 if OS2::REXX::_call("sqldbs", $sqldbs, "", $stmt);
43 return sqlcode() >= 0;
49 print "ERROR in $where: sqlcode=", sqlcode(), " sqlstate=", sqlstate(), "\n";
50 dbs("GET MESSAGE INTO :MSG LINEWIDTH 75");
51 my $msg = OS2::REXX::_fetch("MSG");
58 $sqlar = DynaLoader::dl_load_file("h:/sqllib/dll/sqlar.dll") or die "load";
59 $sqldbs = DynaLoader::dl_find_symbol($sqlar, "SQLDBS") or die "find sqldbs";
60 $sqlexec = DynaLoader::dl_find_symbol($sqlar, "SQLEXEC") or die "find sqlexec";
62 sql(<<) or error("connect");
63 CONNECT TO sample IN SHARE MODE
65 OS2::REXX::_set("STMT" => stmt(<<));
66 SELECT name FROM sysibm.systables
68 sql(<<) or error("prepare");
71 sql(<<) or error("declare");
72 DECLARE c1 CURSOR FOR s1
74 sql(<<) or error("open");
78 sql(<<) or error("fetch");
81 last if sqlcode() == 100;
83 print "Table name is ", OS2::REXX::_fetch("NAME"), "\n";
86 sql(<<) or error("close");
89 sql(<<) or error("rollback");
92 sql(<<) or error("disconnect");