Forum OpenACS Q&A: select table issue

Collapse
Posted by Iuri Sampaio on
This erro is driving me crazy for two days...
It's a simple select from a table. Please help!!! :(
I created the adp file:

listtemplate name="list-contacts"/listtemplate

the tcl file:
*******************************
ad_page_contract {

Displays a list of available
news items.

@author Iuri Sampaio (mailto:iuri.sampaio@computer.org)
@creation-date 04 Mar 2006
@cvs-id $Id$
}

template::list::create \
-name list-contacts \
-multirow get_contacts \
-key master_contacts__attribute_id \
-elements {
master_contacts__attribute_id {
label "Contact ID"
display_template {
No. @get_contacts.master_contacts_attribute__id@
}
}
master_contacts__attribute_email {
label "Contact Name"
display_template {
a href=mailto:@get_contacts.master_contacts_attribute__id@@get_contacts.master_contacts_attribute__email@/a
}
}
}

db_multirow -extend { } get_contacts get_contacts { } {
}
*****************************************88

and the xql file:
********************************
?xml version="1.0"?
queryset

fullquery name="get_contacts"
querytext
select master_contacts_attribute__email from tbl_master_contacts
/querytext
/fullquery

/queryset
*******************************

here it is the create table script:

********************************************
-- contacts-master-create.sql
--
-- @author Iuri Sampaio mailto:iuri.sampaio@computer.org
-- @creation-date 2006-03-30
-- @cvs-id $Id: contacts-master-create.sql,v 0.1d 2006/03/30 13:50:00 ias Exp $
--
--

create table tbl_master_contacts (
master_contacts_attribute__id integer constraint c_pk primary key,
master_contacts_attribute__first_names varchar(500),
master_contacts_attribute__middle_names varchar(500),
master_contacts_attribute__last_name varchar(500),
master_contacts_attribute__email varchar(500),
master_contacts_attribute__url varchar(500),
master_contacts_attribute__work_phone varchar(500),
master_contacts_attribute__work_fax varchar(500),
master_contacts_attribute__work_mobile_phone varchar(500),
master_contacts_attribute__home_address_municipality varchar(500),
master_contacts_attribute__home_address_region varchar(500),
master_contacts_attribute__home_address_zipcode varchar(500),
master_contacts_attribute__home_address_country varchar(500),
master_contacts_attribute__organization_name varchar(500),
master_contacts_attribute__organization_address_municipality varchar(500),
master_contacts_attribute__organization_address_region varchar(500),
master_contacts_attribute__organization_address_zipcode varchar(500),
master_contacts_attribute__organization_address_country varchar(500),
master_contacts_attribute__organization_type varchar(500),
master_contacts_attribute__organization_interest varchar(500),
master_contacts_attribute__organization_size varchar(500)
);

*****************************************

then i got stuck on the error message:
********************************************8
There was a server error processing your request. We apologize.

Take me back where I was (before the error)
Database operation "select" failed (exception NSDB, "Query was not a statement returning rows.")

SQL:
while executing
"ns_pg_bind select nsdb0 { }"
("uplevel" body line 1)
invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql]"
("postgresql" arm line 2)
invoked from within
"switch $driverkey {
oracle {
return [uplevel $ulevel [list ns_ora $type $db $sql] $args]
}
..."
invoked from within
"db_exec select $db $full_statement_name $sql"
invoked from within
"set selection [db_exec select $db $full_statement_name $sql]"
("uplevel" body line 2)
invoked from within
"uplevel 1 $code_block "
invoked from within
"db_with_handle -dbn $dbn db {
set selection [db_exec select $db $full_statement_name $sql]
set local_counter 0

# Make sure 'n..."
(procedure "db_multirow" line 40)
invoked from within
"db_multirow -extend { } get_contacts get_contacts { } {
}"
("uplevel" body line 30)
invoked from within
"uplevel {
ad_page_contract {

Displays a list of available
news items.

@author Iuri Sampaio (mailto:iuri.sampaio@computer.org)
@creat..."
(procedure "code::tcl::/var/lib/aolserver/yabt/packages/master-contacts/..." line 2)
invoked from within
"code::tcl::$__adp_stub"
invoked from within
"if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init tcl $__adp_stub
..."
("uplevel" body line 3)
invoked from within
"uplevel {

if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init t..."
(procedure "adp_prepare" line 2)
invoked from within
"adp_prepare "
(procedure "template::adp_parse" line 30)
invoked from within
"template::adp_parse [file root [ad_conn file]] {}"
(procedure "adp_parse_ad_conn_file" line 5)
invoked from within
"$handler"
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
$handler
} ad_script_abort val {
# do nothing
}"
invoked from within
"rp_serve_concrete_file [ad_conn file]"
(procedure "rp_serve_abstract_file" line 60)
invoked from within
"rp_serve_abstract_file "$root/$path""
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
rp_serve_abstract_file "$root/$path"
set tcl_url2file([ad_conn url]) [ad_conn file]
set tcl_url2path_info..."

Collapse
2: Re: select table issue (response to 1)
Posted by Peter Alberer on
How often do you restart your server? XQL Files are only processed on server restart by default.

It could be that the sql is not recognized, probably because the server does not know about the xql file. You can reload the package from the package manager, to reread xql files after they have been changed.

Collapse
3: Re: Re: select table issue (response to 2)
Posted by Iuri Sampaio on
Thanks peter,
it was the sql files, although I didn't need to restart the server.
I forgot to reload the changes i've made. OACS has few details that drive me crazy :(