<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.6000.16640" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>well, the FROM () seems empty, thats will certainly not
work.</FONT></DIV>
<DIV><FONT size=2>add</FONT></DIV>
<DIV><FONT size=2>print '['.$sql.']';</FONT></DIV>
<DIV><FONT size=2>on line 337, just after " if (!is_null($number)) {
"</FONT></DIV>
<DIV><FONT size=2>and let me know what's the output</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>regards</FONT></DIV>
<DIV><FONT size=2>Oliver</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=thomas.gratier@gmail.com
href="mailto:thomas.gratier@gmail.com">thomas gratier</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=cartoweb-users@lists.maptools.org
href="mailto:cartoweb-users@lists.maptools.org">cartoweb-users@lists.maptools.org</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Tuesday, May 27, 2008 9:08 AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> [Cartoweb-users] Plugin search
problem : misconfiguration orframewok problem</DIV>
<DIV><BR></DIV>Hello all,<BR><BR>I need some help. I'm configuring "basic
usage" of the search plugin and I encounter this message<BR><BR>CartoWeb
version: 3.4.0 [$Revision: 1.7 $]<BR>class:
CartocommonException<BR>message: Failed executing total SQL query
Message: DB Error: unknown error Userinfo: SELECT COUNT(*) FROM ()
[nativecode=ERROR: subquery in FROM must have an alias<BR>HINT:
For example, FROM (SELECT ...) [AS] foo.]<BR>Backtrace:<BR><BR>file: 342 -
C:\ms4w\apps\cartoweb3\plugins\search\common\Search.php<BR>call:
Utils::checkDbError(Object(DB_Error), "Failed executing total SQL
query")<BR><BR>file: 269 -
C:\ms4w\apps\cartoweb3\plugins\search\client\ClientSearch.php<BR>call:
DbResultProvider->getResult(Object(SearchRequest))<BR><BR>file: 265 -
C:\ms4w\apps\cartoweb3\client\ClientPluginHelper.php<BR>call:
ClientSearch->initializeResult(Null)<BR><BR>file: UNKNOWN -
UNKNOWN<BR>call:
ServerCallerHelper->initializeResultHelper(Object(ClientSearch),
Object(MapResult))<BR><BR>....<BR><BR>This message seems to say for the count
in Search.php I need to add an "as foo" at line 342 but I'm not supposed to
touch this code : I suppose it works. (If I correct it, it doesn't work too:
the GUI plugin search stop) <BR><BR>Someone got an idea about my problem. Does
it come from from my configuration files or from a bug from the
framework.<BR>You'll find below my configuration files search.ini, search.tpl,
Search.ajax.js, search_results.tpl and my *.map<BR><BR>I've activated search
plugins on both side (server and client), I've inserted the code for the tpl
and the ajax in cartoclient.tpl<BR><BR>############## search.ini
#########################<BR><BR>;name search configuration<BR>dsn =
pgsql://user_name:password@localhost:5432/database_name<BR>encodingContext =
search_parc<BR>config.parc_2.provider.type =
fulltextTable<BR>config.parc_2.provider.table =
parc_2<BR>config.parc_2.provider.aliases =
idnum,idnum,ident,ident,feuille,feuille,co_se_fe,co_se_fe,lieudit,lieudit,tex2,tex2,idu,idu,nature,nature,classe,classe,tex,tex,codm,codm,coar,coar,supf,supf,indp,indp,ncompte,ncompte,proprio,proprio,surf_gra,surf_gra,ctr_surf,ctr_surf,cad_dif,cad_dif,insee,insee,comparc,comparc,touche,touche,grpro,grpro,commune,commune,numprop,numprop,trouv,trouv,plu,plu<BR><A
href="http://config.parc_2.provider.id">config.parc_2.provider.id</A> =
gid<BR>config.parc_2.provider.columns =
gid,ident,ncompte,proprio,<BR>config.parc_2.provider.fulltextColumns =
ident,ncompte,proprio<BR>config.parc_2.provider.sortColumn =
ident<BR>config.parc_2.provider.sortDirection =
asc<BR>config.parc_2.provider.sortPriorities = ident, ncompte,
proprio<BR>config.parc_2.provider.labels = ident,
proprio<BR>config.parc_2.formatter.type =
smarty<BR>config.parc_2.formatter.template =
search_results<BR><BR>############## client.ini
#########################<BR><BR>;!!!Do not edit this file, it is generated.
Edit the .in instead!!! <BR>cartoclientBaseUrl = "<A
href="http://www.i-sig.biz:8080/cartoweb3/htdocs">http://www.i-sig.biz:8080/cartoweb3/htdocs</A>"
<BR>profile = development<BR><BR><BR>ajaxOn = true<BR>mapId =
chapareillan<BR><BR>;Set encoding for files<BR><BR>EncoderClass.search_parc =
EncoderISO<BR> <BR>showProjectChooser = false<BR><BR>; ##
Plugins ## <BR><BR>loadPlugins =
layerReorder,edit,auth,locate,search<BR><BR>toolbarRendering =
outline <BR><BR>langList = <BR><BR>toolPickerOn =
true<BR><BR>viewOn = true<BR>viewStorage = file<BR>viewablePlugins =
layers,query,edit,auth,search<BR>viewMetas = author<BR>viewAuth =
all<BR><BR>############## extract of myproject.map
#########################<BR><BR>LAYER<BR> STATUS
ON<BR> NAME "parc_2"<BR> TYPE
POLYGON<BR> CONNECTIONTYPE postgis<BR>
CONNECTION "user=user_name password=password host=localhost
dbname=database_name"<BR> DATA "the_geom from (select * from
parc_2) as foo USING UNIQUE gid USING SRID=27572"<BR>
TEMPLATE "ttt"<BR>
METADATA<BR> "wms_title"
"parc_2"<BR> "exported_values"
"recenter_name_string,id_attribute_string"<BR>
"recenter_name_string" "ident"<BR>
"id_attribute_string" "gid|string" # query<BR>
"query_returned_attributes" "gid idnum ident feuille co_se_fe lieudit tex2 idu
nature classe tex codm coar supf indp ncompte proprio surf_gra ctr_surf
cad_dif insee comparc touche grpro commune numprop
trouv"<BR> END<BR> STATUS
DEFAULT<BR> TRANSPARENCY 100<BR>
PROJECTION<BR> 'init=epsg:27572'<BR>
END<BR> CLASS<BR> NAME
'parc_2' <BR>
STYLE<BR> SYMBOL 0
<BR> SIZE 10
<BR> OUTLINECOLOR 0 0
0<BR> COLOR 255 255
255<BR> END<BR>
END<BR> END<BR><BR>############## search.tpl
#########################<BR><BR><div
id="search_div"><BR>
<fieldset><legend>{t}Recherche parcellaire{/t}</legend>
<br/><BR>
<table
width="100%"><BR>
<tr><BR>
<td><BR>
{t}Parcelle:
{/t}<BR>
</td><BR>
<td><BR>
<input type="text" id="search_ident"
<BR>
name="search_ident" size="13"/>
<BR>
</td><BR>
</tr><BR>
<tr><BR>
<td><BR>
{t}Proprietaire par compte:
{/t}<BR>
</td><BR>
<td>
<BR>
<input type="text" id="search_ncompte"
<BR>
name="search_ncompte" size="13"/>
<BR>
</td><BR>
</tr><BR>
<BR>
<tr><BR>
<td><BR>
{t}Proprietaire par nom:
{/t}<BR>
</td><BR>
<td>
<BR>
<input type="text" id="search_proprio"
<BR>
name="search_proprio" size="13"/>
<BR>
</td><BR>
</tr><BR><BR><BR><BR>
</table><BR>
<p><BR>
<BR>
<BR>
<input type="submit" value="{t}Search{/t}"
class="form_button"<BR>
onclick="javaScript: CartoWeb.trigger('Search.DoIt'); return
false;"/><BR>
<BR>
<input type="hidden" id="search_config" name="search_config" value="parc_2"
/><BR>
<input type="hidden" id="search_sort_column" name="search_sort_column"
value="ident"/><BR>
<input type="hidden" id="search_sort_direction"
name="search_sort_direction" value="asc"
/><BR>
<input type="hidden" id="search_number" name="search_number"
value="10"/><BR><BR><BR>
<div
id="search_results_div"></div><BR>
</p><BR>
</fieldset><BR> </div><BR><BR>##############
search_results.tpl #########################<BR><BR>{if $table->numRows
> 0}<BR> <table
class="yourCssClass"><BR>
<tr><BR>
<th>{t}Id{/t}</th><BR>
{foreach from=$table->columnIds
item=column}<BR>
<th> <a href="JavaScript:
order('{$column}');">{t}{$column}{/t}</a></th>
<BR>
{/foreach}<BR>
</tr><BR>
<BR> {foreach
from=$table->rows
item=row}<BR>
<tr><BR>
<td>{$row->rowId}</td><BR>
{foreach from=$row->cells
item=value}<BR>
<td><a href="JavaScript:
recenter('{$row->rowId}');">{$value}</a></td><BR>
{/foreach}<BR>
</tr><BR>
{/foreach}<BR>
<BR> </table><BR>
<BR>{else}<BR> {t}No
results{/t}<BR>{/if}<BR><BR>############## Search.ajax.js
#########################<BR><BR>AjaxPlugins.Search = {<BR>
<BR> handleResponse: function(pluginOutput)
{<BR> //should be the same value as
the input search_config<BR> if
(pluginOutput.htmlCode.parc_2)<BR>
$('search_results_div').innerHTML =
pluginOutput.htmlCode.parc_2;<BR><BR>
<BR> } <BR>};<BR><BR>
/*<BR> * Search plugin's Actions<BR>
*/<BR><BR> AjaxPlugins.Search.Actions =
{};<BR><BR> AjaxPlugins.Search.Actions.DoIt =
{<BR><BR> buildPostRequest: function(argObject)
{<BR> return
AjaxHandler.buildPostRequest();<BR>
}<BR> };<BR><BR> function order(column)
{<BR><BR> if (column !=
$('search_sort_column').value) {<BR>
$('search_sort_column').value =
column;<BR>
$('search_sort_direction').value = 'asc';<BR> }
else {<BR> if
($('search_sort_direction').value == 'asc')
{<BR>
$('search_sort_direction').value =
'desc';<BR> } else
{<BR>
$('search_sort_direction').value =
'asc';<BR>
}<BR> }<BR><BR>
CartoWeb.trigger('Search.DoIt')<BR>
}<BR><BR> function
recenter(id){<BR> if ($('search_config').value
== 'parc_2') {<BR> //id to recenter,
be sure there is a hidden input with that name and
<BR> //id in your template! if not,
add it<BR>
$('id_recenter_ids').value =
id;<BR><BR> /* if the search
database table name is the same as the related layer
<BR> to recenter on, you can set it
as below<BR> be sure there is a
hidden input with that name and id in your template!
<BR> if not, add it
*/<BR> $('id_recenter_layer').value
= $('search_config').value;<BR><BR>
/* do not use the recenter_scale parameter if you recenter on ids,
<BR> only use it with recenter on
x,y.<BR> you can set the recenter
scale in location.ini on server side
*/<BR><BR> /* do not use the
recenter_doit parameter if you recenter on
ids,<BR> only use it with recenter
on x,y. */<BR><BR>
CartoWeb.trigger('Location.Recenter');<BR> }
<BR> }<BR> <BR> function
search(config) {<BR> <BR>
$('search_config').value = config;<BR> if (config ==
'parc_2') {<BR>
$('search_number').value = 10;<BR> }<BR>
<BR>
CartoWeb.trigger('Search.DoIt');<BR><BR><BR>Thanks for any help<BR><BR>Thomas
G<BR>
<P>
<HR>
<P></P>_______________________________________________<BR>Cartoweb-users
mailing
list<BR>Cartoweb-users@lists.maptools.org<BR>http://lists.maptools.org/mailman/listinfo/cartoweb-users<BR></BLOCKQUOTE></BODY></HTML>