Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE development » Bug Reports » Problem extending sql_from
Problem extending sql_from [message #1856] Mon, 17 November 2008 09:29 Go to next message
bonzo_bcn is currently offline  bonzo_bcn
Messages: 152
Registered: June 2008
Senior Member
I don't know if this is a bug or not..
I want to create a list1 screen that shows some summary data, then with a button I will link it to a detail screen that shows the detailed summary.
I guess the best way to do this is extending the sql manually.
So I created a class and added this code:
    function _cm_initialise ($where, $selection){
	//	if ($GLOBALS['mode'] == 'search' || $GLOBALS['mode'] == 'list') {

$this->sql_from= "(SELECT entidad.noment ,  1 as importe
		FROM participante 
		JOIN part_equipo_xref  ON participante.participante_id=part_equipo_xref.participante_id
		JOIN equipo  ON part_equipo_xref.equipo_id = equipo.equipo_id
		JOIN entidad  ON equipo.entidad_id= entidad.entidad_id
		JOIN temporada  ON temporada.temporada_id = equipo.temporada_id
		WHERE tippart='E'
		UNION aLL
		SELECT entidad.noment,  1
		FROM participante 
		JOIN equipo  ON participante.participante_id = equipo.entrenador_id
		JOIN entidad  ON equipo.entidad_id= entidad.entidad_id
		JOIN temporada  ON temporada.temporada_id = equipo.temporada_id
		WHERE tippart='N'
		UNION ALL
		SELECT entidad.noment,  1
		FROM participante 
		JOIN equipo  ON participante.participante_id = equipo.delegado_id
		JOIN entidad  ON equipo.entidad_id= entidad.entidad_id
		JOIN deporte  ON equipo.deporte_id = deporte.deporte_id
		JOIN temporada  ON temporada.temporada_id = equipo.temporada_id
		WHERE tippart='D'
		UNION ALL
		SELECT entidad.noment,  1
		FROM participante 
		JOIN equipo  ON participante.participante_id = equipo.delegado_id
		JOIN entidad  ON equipo.entidad_id= entidad.entidad_id
		JOIN temporada  ON temporada.temporada_id = equipo.temporada_id
		UNION ALL
		SELECT entidad.noment,  1
		FROM entidad) as entidad";
	   }


I'm getting this error:
Fatal Error: Uncaught exception fron DOMException, message = Invalid Character Error (# 256).

Error in line 286 of file '/Applications/MAMP/htdocs/radicore/includes/error.inc'.

Script: /radicore/ceae/entidad_importes(list1).php

User Id: MGR

Remote Address: ::1

Request URI: /radicore/ceae/entidad_importes(list1).php?session_name=menu0


With the debugger I found that what I'm putting in sql_from is too long and the last lines get truncated.
How can I solve this?
Re: Problem extending sql_from [message #1857 is a reply to message #1856] Mon, 17 November 2008 10:48 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
If the FROM clause was being truncated it would result in a invalid SQL statement, and therefore an SQL error. What you have is a DOM error, which would indicate to me that the error was produced by the DOM extension while writing to the XML document. I have seen this in the past when the data array being added to the XML document contains an invalid character in either the array key or the array value. A blank key will also produce an error.

When an error occurs Radicore will display a summary of the details on the screen, but more complete details can be found in file errorlog.html - can you look there to see what it says?


Re: Problem extending sql_from [message #1860 is a reply to message #1856] Mon, 17 November 2008 13:09 Go to previous messageGo to next message
bonzo_bcn is currently offline  bonzo_bcn
Messages: 152
Registered: June 2008
Senior Member
Here it is:
Page Stack:

  [0] main_menu
  [1] ceae
  [2] ceae_entidad_importes(list1)


0: array =
  file: string = /Applications/MAMP/htdocs/radicore/includes/include.xml.php5.inc
  line: integer = 89
  function: string = createElement
  class: string = DOMDocument
  type: string = ->
  args: array =
    0: string = sum(importe)
1: array =
  file: string = /Applications/MAMP/htdocs/radicore/includes/include.xml.php5.inc
  line: integer = 643
  function: string = addData2XMLdoc
  args: array =
    4: array =
2: array =
  file: string = /Applications/MAMP/htdocs/radicore/includes/std.list1.inc
  line: integer = 193
  function: string = buildXML
  args: array =
    0: array =
      0: array =
    1: array =
    2: array =
3: array =
  file: string = /Applications/MAMP/htdocs/radicore/ceae/entidad_importes(list1).php
  line: integer = 19
  args: array =
    0: string = /Applications/MAMP/htdocs/radicore/includes/std.list1.inc
  function: string = require



Can the cause be something that I've put in the php file:?
<?php
// *****************************************************************************
// List the contents of a database table and allow the user to view/modify
// the contents by activating other screens via navigation buttons.
// *****************************************************************************

$table_id = 'entidad_s01';                      // table name
$screen   = 'entidad_importes.list1.screen.inc';     // file identifying screen structure

// customise the SQL SELECT statement
$sql_select  = 'noment,sum(importe)';
$sql_from    = null;
$sql_where   = null;
$sql_groupby = '1';
$sql_having  = null;
$sql_orderby = '1';
$sql_search_table = null;

require 'std.list1.inc';            // activate page controller

?>

[Updated on: Mon, 17 November 2008 13:10]

Report message to a moderator

Re: Problem extending sql_from [message #1861 is a reply to message #1856] Mon, 17 November 2008 13:11 Go to previous messageGo to next message
bonzo_bcn is currently offline  bonzo_bcn
Messages: 152
Registered: June 2008
Senior Member
Ok, I've found why, I've should have put this in the php file:

$sql_select = 'noment, sum(importe) as importe';

Thanks for the hint!

[Updated on: Mon, 17 November 2008 13:12]

Report message to a moderator

Re: Problem extending sql_from [message #1862 is a reply to message #1861] Mon, 17 November 2008 14:01 Go to previous message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
Well spotted. Both the '(' and ')' characters are invalid in XML element names.

Previous Topic: Incorrect Login Message
Next Topic: login fails after upgrade to ver 1.42
Goto Forum:
  


Current Time: Sun Nov 03 09:04:14 EST 2024

Total time taken to generate the page: 0.07773 seconds