Joy!

It works, I also needed a transactions="no"

Thanks guys.

Adam

-----Original Message-----
From: Nigel Peck [mailto:[EMAIL PROTECTED]] 
Sent: 29 July 2002 16:30
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: ESQL


Also, I had to put in a transactions="no" attribute

<esql:driver transactions="no">mysql</esql:driver>

HTH
Nigel


>>> "Don Shanks" <[EMAIL PROTECTED]> 07/29/02 04:10pm >>>
I believe you need to have a root tag inside your xsp:page;

<xsp:page ...>
        <page>
                <esql:connection ...>
                </esql:connection>
        </page>
</xsp:page>

-Don

-----Original Message-----
From: Adam Griffiths [mailto:[EMAIL PROTECTED]] 
Sent: Monday, 29 July, 2002 01:42
To: [EMAIL PROTECTED] 
Subject: ESQL



Hi, Im trying to use the ESQL taglib with a mysql databases but I can't
seem to get it to work. I'm getting the error:

Compilation failed: Global symbol "$document" requires explicit package
name at (eval 27) 

Can anyone help?

Adam



Here is the test XSP  file:
____________________________________________________

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="NULL" type="application/x-xsp"?> <xsp:page 
   language="Perl"
   xmlns:xsp="http://apache.org/xsp/core/v1"; 
   xmlns:esql="http://apache.org/xsp/SQL/v2";
>
        <esql:connection>
                <esql:driver>mysql</esql:driver>
                <esql:dburl>grecui_shopping</esql:dburl>
                <esql:username>grecui_web</esql:username>
                <esql:password>grecui_web</esql:password>
                <esql:execute-query>
                        <esql:query>
             select * from baskets
                </esql:query>
                        <esql:results>
                                <header>header info</header>
                                <esql:row-results>
                                        <department>
                                                <id>
                                                        <esql:get-int
column="basketid"/>
                                                </id>
                                                <stamp>
                                                        <esql:get-date
column="stamp"/>
                                                </stamp>
                                                <dbid>
                                                        <esql:get-int
column="databseid"/>
                                                </dbid>
                                        </department>
                                </esql:row-results>
                                <footer>footer info</footer>
                        </esql:results>
                        <esql:no-results>
                                <department>No departments</department>
                        </esql:no-results>
                </esql:execute-query>
        </esql:connection>
</xsp:page>

____________________________________________________
Here is a level 10 debug:
____________________________________________________
[Sun Jul 28 19:45:10 2002] [warn] [client 62.254.128.7] [AxKit] fast
handler called for /test/xspesql/test.xsp [Sun Jul 28 19:45:10 2002]
[warn] [client 62.254.128.7] [AxKit] Content Provider Override:
Apache::AxKit::Provider::File [Sun Jul 28 19:45:10 2002] [warn] [client
62.254.128.7] [AxKit] [req] File Provider given $r:
/www/vhtdocs/aog/test/xspesql/test.xsp
[Sun Jul 28 19:45:10 2002] [warn] [client 62.254.128.7] [AxKit] checking
if we process this resource [Sun Jul 28 19:45:12 2002] [warn] [client
62.254.128.7] [AxKit] media: screen, preferred style: #default [Sun Jul
28 19:45:12 2002] [warn] [client 62.254.128.7] [AxKit] Cache: key =
f0a608f405551e9edbfd3a6ce6748bac [Sun Jul 28 19:45:12 2002] [warn]
[client 62.254.128.7] [AxKit] getting styles and external entities from
the XML [Sun Jul 28 19:45:12 2002] [warn] [client 62.254.128.7] [AxKit]
styles not cached - calling $provider->get_styles() [Sun Jul 28 19:45:12
2002] [warn] [client 62.254.128.7] [AxKit] using XS get_styles
(libxml2)
[Sun Jul 28 19:45:12 2002] [warn] [client 62.254.128.7] [AxKit] calling
xs_get_styles_fh() [Sun Jul 28 19:45:12 2002] [warn] [client
62.254.128.7] [AxKit] calling xs_get_styles_str() [Sun Jul 28 19:45:12
2002] [warn] [client 62.254.128.7] [AxKit] parse_pi: href = NULL [Sun
Jul 28 19:45:12 2002] [warn] [client 62.254.128.7] [AxKit] parse_pi:
type = application/x-xsp [Sun Jul 28 19:45:12 2002] [warn] [client
62.254.128.7] [AxKit] xs_get_styles returned: , ,
{http://apache.org/xsp/core/v1}page 
[Sun Jul 28 19:45:12 2002] [warn] [client 62.254.128.7] [AxKit] Calling
GetMatchingProcessors with (screen, , , ,
{http://apache.org/xsp/core/v1}page)
[Sun Jul 28 19:45:12 2002] [warn] [client 62.254.128.7] [AxKit]
get_styles: loading style modules [Sun Jul 28 19:45:12 2002] [warn]
[client 62.254.128.7] [AxKit] get_styles: looking for mapping for style
type: 'application/x-xsp' [Sun Jul 28 19:45:12 2002] [warn] [client
62.254.128.7] [AxKit] cache doesn't exist [Sun Jul 28 19:45:12 2002]
[warn] [client 62.254.128.7] [AxKit] some condition failed. recreating
output [Sun Jul 28 19:45:12 2002] [warn] [client 62.254.128.7] [AxKit]
styles: Apache::AxKit::Language::XSP(NULL)
[Sun Jul 28 19:45:12 2002] [warn] [client 62.254.128.7] [AxKit] Style
Provider Override: Apache::AxKit::Provider::File [Sun Jul 28 19:45:12
2002] [warn] [client 62.254.128.7] [AxKit] [uri] File Provider looking
up uri NULL [Sun Jul 28 19:45:12 2002] [warn] [client 62.254.128.7]
[AxKit] [uri] File Provider set filename to
/www/vhtdocs/aog/test/xspesql/NULL
[Sun Jul 28 19:45:12 2002] [warn] [client 62.254.128.7] [AxKit] about to
execute: Apache::AxKit::Language::XSP::handler
[Sun Jul 28 19:45:12 2002] [warn] [client 62.254.128.7] [AxKit] XSP:
parsing fh [Sun Jul 28 19:45:12 2002] [warn] [client 62.254.128.7]
[AxKit] Recompiling XSP script [Sun Jul 28 19:45:12 2002] [warn] [client
62.254.128.7] [AxKit] package
Apache::AxKit::Language::XSP::ROOT::www::vhtdocs::aog::test::xspesql::te
st_2exsp;
@Apache::AxKit::Language::XSP::ROOT::www::vhtdocs::aog::test::xspesql::t
est_2exsp::ISA = ('Apache::AxKit::Language::XSP::Page');
use Apache;
use Apache::Constants qw(:common);
use XML::LibXML;#initialize xsp namespace
#initialize xsp namespace

        {
my ($dbh, $connect_count, $driver, $transactions, $dburl, $user, $pass);
$transactions = 1;$driver = "dbi:". q|mysql|;$dburl = "".
q|grecui_shopping|;$user = "". q|grecui_web|;$pass = "".
q|grecui_web|;$dbh = DBI->connect($driver . ($dburl ? ":$dburl" : ''),
        $user, $pass,
        {
            PrintError => 0,
            AutoCommit => $transactions ? 0 : 1,
            RaiseError => 1,
        }) unless $connect_count;
$connect_count++;
AxKit::XSP::ESQL::new_query();
{
my ($query, $max_rows, $skip_rows, @params, $rv);
$max_rows = 0; $skip_rows = 0;
$query = "". q|
             select * from baskets
                |;
{
AxKit::XSP::ESQL::prepare($dbh, $query);
$rv = AxKit::XSP::ESQL::execute(@params);
my ($col, $ancestor, $format);
if ($skip_rows) {
  1 while (AxKit::XSP::ESQL::get_count() < $skip_rows &&
AxKit::XSP::ESQL::get_row()); } if (AxKit::XSP::ESQL::get_row()) { sub
handler { my ($r, $cgi, $document) = @_; my ($parent);

{ my $elem =
$document->createElement(q|header|);$document->setDocumentElement($elem)
; $parent = $elem; } { my $text = $document->createTextNode(q|header
info|);$parent->appendChild($text); } $parent =
$parent->getParentNode;
do { { my $elem =
$document->createElement(q|department|);$parent->appendChild($elem);
$parent = $elem; } { my $elem =
$document->createElement(q|id|);$parent->appendChild($elem); $parent =
$elem; } {
    my $text = $document->createTextNode("".do {
$col = ""; $ancestor = 0; $format = "";$col = q|basketid|;$ancestor =
0;sprintf("%d", AxKit::XSP::ESQL::get_column($col, $ancestor))}); # non
xsp tag
    $parent->appendChild($text); 
}
$parent = $parent->getParentNode;
{ my $elem =
$document->createElement(q|stamp|);$parent->appendChild($elem);
$parent
= $elem; } {
    my $text = $document->createTextNode("".do {
$col = ""; $ancestor = 0; $format = "";$col = q|stamp|;$ancestor =
0;AxKit::XSP::ESQL::get_column($col, $ancestor)}); # non xsp tag
    $parent->appendChild($text); 
}
$parent = $parent->getParentNode;
{ my $elem =
$document->createElement(q|dbid|);$parent->appendChild($elem); $parent =
$elem; } {
    my $text = $document->createTextNode("".do {
$col = ""; $ancestor = 0; $format = "";$col = q|databseid|;$ancestor =
0;sprintf("%d", AxKit::XSP::ESQL::get_column($col, $ancestor))}); # non
xsp tag
    $parent->appendChild($text); 
}
$parent = $parent->getParentNode;
$parent = $parent->getParentNode;
if ($max_rows && AxKit::XSP::ESQL::get_count() >= $max_rows) {
  last;
}
} while (AxKit::XSP::ESQL::get_row()); # while(get_row) </row-results> {
my $elem =
$document->createElement(q|footer|);$parent->appendChild($elem);
$parent
= $elem; } { my $text = $document->createTextNode(q|footer
info|);$parent->appendChild($text); } $parent =
$parent->getParentNode;
} # end - if (rows existed) } # </results> $dbh->commit if
$transactions; if (AxKit::XSP::ESQL::get_count() == 0) { my ($col,
$ancestor, $format); { my $elem =
$document->createElement(q|department|);$parent->appendChild($elem);
$parent = $elem; } { my $text = $document->createTextNode(q|No
departments|);$parent->appendChild($text); } $parent =
$parent->getParentNode;

} # </no-results>
} # </execute-query>
AxKit::XSP::ESQL::end_query();
$connect_count--;
unless ($connect_count) {
    $dbh->disconnect();
    undef $dbh;
}

} # /connection

return OK;
}

Script:
1 package
Apache::AxKit::Language::XSP::ROOT::www::vhtdocs::aog::test::xspesql::te
st_2exsp;
@Apache::AxKit::Language::XSP::ROOT::www::vhtdocs::aog::test::xspesql::t
est_2exsp::ISA = ('Apache::AxKit::Language::XSP::Page');
2 use Apache;
3 use Apache::Constants qw(:common);
4 use XML::LibXML;#initialize xsp namespace
5 #initialize xsp namespace
6 
7       {
8 my ($dbh, $connect_count, $driver, $transactions, $dburl, $user,
$pass); 9 $transactions = 1;$driver = "dbi:". q|mysql|;$dburl = "".
q|grecui_shopping|;$user = "". q|grecui_web|;$pass = "".
q|grecui_web|;$dbh = DBI->connect($driver . ($dburl ? ":$dburl" : ''),
10         $user, $pass,
11         {
12             PrintError => 0,
13             AutoCommit => $transactions ? 0 : 1,
14             RaiseError => 1,
15         }) unless $connect_count;
16 $connect_count++;
17 AxKit::XSP::ESQL::new_query();
18 {
19 my ($query, $max_rows, $skip_rows, @params, $rv);
20 $max_rows = 0; $skip_rows = 0;
21 $query = "". q|
22              select * from baskets
23              |;
24 {
25 AxKit::XSP::ESQL::prepare($dbh, $query);
26 $rv = AxKit::XSP::ESQL::execute(@params);
27 my ($col, $ancestor, $format);
28 if ($skip_rows) {
29   1 while (AxKit::XSP::ESQL::get_count() < $skip_rows &&
AxKit::XSP::ESQL::get_row());
30 }
31 if (AxKit::XSP::ESQL::get_row()) {
32 sub handler {
33 my ($r, $cgi, $document) = @_;
34 my ($parent);
35 
36 { my $elem =
$document->createElement(q|header|);$document->setDocumentElement($elem)
; $parent = $elem; } 37 { my $text = $document->createTextNode(q|header
info|);$parent->appendChild($text); } 38 $parent =
$parent->getParentNode; 39 do { 40 { my $elem =
$document->createElement(q|department|);$parent->appendChild($elem);
$parent = $elem; } 41 { my $elem =
$document->createElement(q|id|);$parent->appendChild($elem); $parent =
$elem; } 42 {
43     my $text = $document->createTextNode("".do {
44 $col = ""; $ancestor = 0; $format = "";$col = q|basketid|;$ancestor =
0;sprintf("%d", AxKit::XSP::ESQL::get_column($col, $ancestor))}); # non
xsp tag
45     $parent->appendChild($text); 
46 }
47 $parent = $parent->getParentNode;
48 { my $elem =
$document->createElement(q|stamp|);$parent->appendChild($elem);
$parent
= $elem; } 49 {
50     my $text = $document->createTextNode("".do {
51 $col = ""; $ancestor = 0; $format = "";$col = q|stamp|;$ancestor =
0;AxKit::XSP::ESQL::get_column($col, $ancestor)}); # non xsp tag
52     $parent->appendChild($text); 
53 }
54 $parent = $parent->getParentNode;
55 { my $elem =
$document->createElement(q|dbid|);$parent->appendChild($elem); $parent =
$elem; } 56 {
57     my $text = $document->createTextNode("".do {
58 $col = ""; $ancestor = 0; $format = "";$col =
q|databseid|;$ancestor
= 0;sprintf("%d", AxKit::XSP::ESQL::get_column($col, $ancestor))}); #
non xsp tag
59     $parent->appendChild($text); 
60 }
61 $parent = $parent->getParentNode;
62 $parent = $parent->getParentNode;
63 if ($max_rows && AxKit::XSP::ESQL::get_count() >= $max_rows) {
64   last;
65 }
66 } while (AxKit::XSP::ESQL::get_row()); # while(get_row)
</row-results> 67 { my $elem =
$document->createElement(q|footer|);$parent->appendChild($elem);
$parent
= $elem; } 68 { my $text = $document->createTextNode(q|footer
info|);$parent->appendChild($text); } 69 $parent =
$parent->getParentNode; 70 } # end - if (rows existed) 71 } # </results>
72 $dbh->commit if $transactions; 73 if (AxKit::XSP::ESQL::get_count()
== 0) { 74 my ($col, $ancestor, $format); 75 { my $elem =
$document->createElement(q|department|);$parent->appendChild($elem);
$parent = $elem; } 76 { my $text = $document->createTextNode(q|No
departments|);$parent->appendChild($text); } 77 $parent =
$parent->getParentNode; 78 
79 } # </no-results>
80 } # </execute-query>
81 AxKit::XSP::ESQL::end_query();
82 $connect_count--;
83 unless ($connect_count) {
84     $dbh->disconnect();
85     undef $dbh;
86 }
87 
88 } # /connection
89 
90 return OK;
91 }
92 
[Sun Jul 28 19:45:12 2002] [warn] [client 62.254.128.7] [AxKit] Caught
an exception [Sun Jul 28 19:45:12 2002] [error] [client 62.254.128.7]
[AxKit] [Error] Compilation failed: Global symbol "$document" requires
explicit package name at (eval 27) line 75. Global symbol "$parent"
requires explicit package name at (eval 27) line 75. Global symbol
"$parent" requires explicit package name at (eval 27) line 75. Global
symbol "$document" requires explicit package name at (eval 27) line 76.
Global symbol "$parent" requires explicit package name at (eval 27) line
76. Global symbol "$parent" requires explicit package name at (eval
27)
line 77. Global symbol "$parent" requires explicit package name at (eval
27) line 77.

[Sun Jul 28 19:45:12 2002] [error] [client 62.254.128.7] [AxKit] From:
/usr/local/lib/perl5/site_perl/Error.pm : 148 [Sun Jul 28 19:45:12 2002]
[error] [client 62.254.128.7] [AxKit] [Backtrace] Compilation failed:
Global symbol "$document" requires explicit package name at (eval 27)
line 75. Global symbol "$parent" requires explicit package name at (eval
27) line 75. Global symbol "$parent" requires explicit package name at
(eval 27) line 75. Global symbol "$document" requires explicit package
name at (eval 27) line 76. Global symbol "$parent" requires explicit
package name at (eval 27) line 76. Global symbol "$parent" requires
explicit package name at (eval 27) line 77. Global symbol "$parent"
requires explicit package name at (eval 27) line 77.
        Error::throw('Apache::AxKit::Exception::Error', '-text',
'Compilation failed: Global symbol "$document" requires explicit ...')
called at
/usr/local/lib/perl5/site_perl/i386-linux-thread-multi/Apache/AxKit/Lang
uage/XSP.pm line 114
        
Apache::AxKit::Language::XSP::handler('Apache::AxKit::Language::XSP',
'AxKit::Apache=SCALAR(0x818c9d0)',
'Apache::AxKit::Provider::File=HASH(0x8426db4)',
'Apache::AxKit::Provider::File=HASH(0x882ad5c)', 1) called at
/usr/local/lib/perl5/site_perl/i386-linux-thread-multi/AxKit.pm line 623
        AxKit::process_request('AxKit::Apache=SCALAR(0x818c9d0)',
'Apache::AxKit::Provider::File=HASH(0x8426db4)', 'ARRAY(0x8469ab0)')
called at
/usr/local/lib/perl5/site_perl/i386-linux-thread-multi/AxKit.pm line 437
        AxKit::run_axkit_engine('AxKit::Apache=SCALAR(0x818c9d0)',
'Apache::AxKit::Provider::File=HASH(0x8426db4)') called at
/usr/local/lib/perl5/site_perl/i386-linux-thread-multi/AxKit.pm line 264
        eval {...} called at
/usr/local/lib/perl5/site_perl/i386-linux-thread-multi/AxKit.pm line 255
        AxKit::main_handler('AxKit::Apache=SCALAR(0x818c9d0)',
'Apache::AxKit::Provider::File=HASH(0x8426db4)') called at
/usr/local/lib/perl5/site_perl/i386-linux-thread-multi/AxKit.pm line 172
        AxKit::fast_handler('AxKit::Apache=SCALAR(0x818c9d0)') called at
/dev/null line 0
        eval {...} called at /dev/null line 0



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED] 
For additional commands, e-mail: [EMAIL PROTECTED] 



ITM Business Solutions
Unit 4
Nine Trees Trading Estate
Morthen Road
Rotherham
S66 9JG

Reception
Tel: 01709 703288
Fax: 01709 701549

Help Desk
Tel:01709 530424
Fax: 01709 702159

CONFIDENTIALITY NOTICE: This message is intended only for the use of the
individual or entity to which it is addressed, and may contain
information that is privileged, confidential and exempt from disclosure
under applicable law.



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to