Tengo un problema con la impresión del contenido de un query q es llamado por un archivo php(o pueden ser varios, no estoy segura), pues no encuentro las variables q tengo q llamar y todas las q he impreso, salen como Object o Array.
Dicho query se encuentra en el archivo var_reporter_mssql.xml y es lo siguiente:
Código xml:
Ver original
<?xml version="1.0" ?> <SQLLIST database="MSSQL" module="VAR_REPORTER"> <SQL ID="GET_DETAIL_DN_ALL" QUERY=" SELECT app_id as APP_ID, convert(varchar(40),call_id) as CALL_ID, convert(char(19),tz_date,120) as TZ_DATE, ani as ANI ,dnis as DNIS, ivr_duration as IVR_DURATION, case end_action when ''01'' then ''Call End'' when ''02'' then ''Transfer'' else ''Abandon'' end as END_ACTION, case ivr_result when ''S'' then ''Success'' when ''F'' then ''Failure'' else ''Unknown'' end as IVR_RESULT , ivr_reason as IVR_REASON FROM app_calls WITH ( INDEX ( IX_call_ani ) ) WHERE tz_date >= CONVERT(DATETIME, :VAR_UTC_DT_START ,120 ) and tz_date < CONVERT(DATETIME, :VAR_UTC_DT_END ,120 ) and ani in ( :VAR_DN_1 , :VAR_DN_2 , :VAR_DN_3 , :VAR_DN_4 , :VAR_DN_5 , :VAR_DN_6 , :VAR_DN_7 , :VAR_DN_8 , :VAR_DN_9 , :VAR_DN_10 ) ORDER BY ani, tz_date desc "/> <SQL ID="GET_DETAIL_DN_APP" QUERY=" SELECT app_id as APP_ID, convert(varchar(40),call_id) as CALL_ID, convert(char(19),tz_date,120) as TZ_DATE, ani as ANI ,dnis as DNIS, ivr_duration as IVR_DURATION, case end_action when ''01'' then ''Call End'' when ''02'' then ''Transfer'' else ''Abandon'' end as END_ACTION, case ivr_result when ''S'' then ''Success'' when ''F'' then ''Failure'' else ''Unknown'' end as IVR_RESULT , ivr_reason as IVR_REASON FROM app_calls WITH ( INDEX ( IX_call_ani ) ) WHERE tz_date >= CONVERT(DATETIME, :VAR_UTC_DT_START ,120 ) and tz_date < CONVERT(DATETIME, :VAR_UTC_DT_END ,120 ) and app_id = :VAR_APP_ID and ani in ( :VAR_DN_1 , :VAR_DN_2 , :VAR_DN_3 , :VAR_DN_4 , :VAR_DN_5 , :VAR_DN_6 , :VAR_DN_7 , :VAR_DN_8 , :VAR_DN_9 , :VAR_DN_10 ) ORDER BY ani , tz_date desc " /> </SQLLIST>
Este archivo es llamado por el archivo vwm_sql_xml.php mediante el siguiente código en PHP:
Código php:
Ver original
function load_xml() { ... $xmlFilePath = $CN_ROOT . $SEP . "php" . $SEP . "xml" .$SEP . strtolower($MODULE_ID) . "_" . strtolower($VWM_INI ["DBTYPE"]) . ".xml"; /*Asignación de la variable con el nombre de archivo var_reporter_mssql.xml */ .... //Load the XML file into a String return false; } //implode result //Load XML into a DOM object { .... } $this->xmlFile = $xmlFilePath; return true; } function get_sql($sql_id) /*función para obtener el ID del query SQL del archivo var_reporter_mssql.xml indicado arriba*/ { global $VWM_LOGGER; $retSQL = ""; ....
En el código anterior hay una función q obtiene el ID del SQL q puede ser "GET_DETAIL_DN_APP" o "GET_DETAIL_DN_ALL" segun el archivo xml y lo guarda en la variable $sql_id.
Si no me equivoco, después de esto se va a presentarlo en la web mediante el archivo var_report_viewer.php con ayuda de entre otros archivos del left_side_menu.php, q es donde se le telcea en el campo de texto cualquier número de 10 digitos.
El código de var_report_viewer.php es:
Código php:
Ver original
if ($_GET["DN1"] != '') { $DN1 = $_GET["DN1"]; $DN2 = $_GET["DN2"]; $DN3 = $_GET["DN3"]; $DN4 = $_GET["DN4"]; $DN5 = $_GET["DN5"]; $DN6 = $_GET["DN6"]; $DN7 = $_GET["DN7"]; $DN8 = $_GET["DN8"]; $DN9 = $_GET["DN9"]; $DN10 = $_GET["DN10"]; } $printURL = "var_report_viewer.php?" . "ReportType=" . $ReportType . "&Application=" . $RepApplication . "&StartDate=" . $RepStartDate . "&StartTime=" . $RepStartTime . "&EndDate=" . $RepEndDate . "&EndTime=" . $RepEndTime . "&RepInterval=" . $RepInterval. "&SCF=" . $RepSCF . "&Print=Y"; .... //Handle information //Find application Name if ($RepApplication == "ALL") { $RepContext = "All DNIS Applications"; } else { $RepContext = get_app_name($RepApplication); } //Find Reports Name and set Reports File switch ($ReportType) { case "DETALLE_LLAMADA" : $ReportName = "Listado de llamadas realizadas por Dn"; $ReportFile = "var_calls_listing.php"; $sqlID = "GET_DETAIL_DN"; break; case "SAVEFILE" : $ReportName = "Save Download File"; $ReportFile = "var_download_file.php"; $sqlID = "GET_DOWNLOAD"; $dwl_type = $_GET["DwlReportType"]; $sqlID .= "_".$dwl_type; ..... //Prepare Dates for SQL. Add 1 day to end date if time is not specified if ($RepStartTime == -1 and $RepEndTime == -1) { $RepEndDTInt = dateadd("d",1,$RepEndDTInt); } if ($ReportType == "DETALLE_LLAMADA" ) { $RepStartDTInt = dateadd("m",-1,$RepEndDTInt); $RepEndDTInt = dateadd("s",-1,$RepEndDTInt); echo "Fecha de inicio: " . $sqlStartDate . "<br>"; echo "Fecha de fin: " . $sqlEndDate . "<br>"; if ($RepApplication != "ALL") { $sqlID .= "_APP"; "UTC_DT_START" => $sqlStartDate , "UTC_DT_END" => $sqlEndDate, "DN_1" => $DN1, "DN_2" => $DN2, "DN_3" => $DN3, "DN_4" => $DN4, "DN_5" => $DN5, "DN_6" => $DN6, "DN_7" => $DN7, "DN_8" => $DN8, "DN_9" => $DN9, "DN_10" => $DN10 ); } else { $sqlID .= "_ALL"; "UTC_DT_START" => $sqlStartDate , "UTC_DT_END" => $sqlEndDate, "DN_1" => $DN1, "DN_2" => $DN2, "DN_3" => $DN3, "DN_4" => $DN4, "DN_5" => $DN5, "DN_6" => $DN6, "DN_7" => $DN7, "DN_8" => $DN8, "DN_9" => $DN9, "DN_10" => $DN10); } } elseif ($ReportType == "SCF_ANALYSIS" ) { "SCF_ID" => $RepSCF, "UTC_DT_START" => $sqlStartDate , "UTC_DT_END" => $sqlEndDate); } elseif ($RepApplication != "ALL") { $sqlID .= "_APP"; "UTC_DT_START" => $sqlStartDate , "UTC_DT_END" => $sqlEndDate); } else { $sqlID .= "_ALL"; "UTC_DT_END" => $sqlEndDate); } .... $repData = $varSQL->get_array(); ....
Al final siempre q elijo el tipo de aplicación "GET_DETAIL_DN_ALL" o "GET_DETAIL_DN_APP" me aparece el siguiente error en el log:
Código txt:
Ver original
"2010-11-25 18:29:10 : ERROR : 1250 : Cannot find size for variable :VAR_DN_1 found in SQL SELECT app_id as APP_ID, convert(varchar(40),call_id) as CALL_ID, convert(char(19),tz_date,120) as TZ_DATE, ani as ANI ,dnis as DNIS, ivr_duration as IVR_DURATION, case end_action when ''01'' then ''Call End'' when ''02'' then ''Transfer'' else ''Abandon'' end as END_ACTION, case ivr_result when ''S'' then ''Success'' when ''F'' then ''Failure'' else ''Unknown'' end as IVR_RESULT , ivr_reason as IVR_REASON FROM app_calls WITH ( INDEX ( IX_call_ani ) ) WHERE tz_date >= CONVERT(DATETIME, :VAR_UTC_DT_START ,120 ) and tz_date < CONVERT(DATETIME, :VAR_UTC_DT_END ,120 ) and ani in ( :VAR_DN_1 , :VAR_DN_2 , :VAR_DN_3 , :VAR_DN_4 , :VAR_DN_5 , :VAR_DN_6 , :VAR_DN_7 , :VAR_DN_8 , :VAR_DN_9 , :VAR_DN_10 ) ORDER BY ani, tz_date desc 2010-11-25 18:29:10 : ERROR : 1203 : Error Binding variables 2010-11-25 18:29:10 : ERROR : 1250 : DoSQL: Parsing failed 2010-11-25 18:29:10 : ERROR : 20201 : ClientIP[192.168.55.29] No se puede obtener informacion para: Listado de llamadas realizadas por Dn"
Este log es presentado mediante el archivo vwm_db_mssql.php, su código es:
Código php:
Ver original
...... class tlraDBSQL { ..... //Instantiate with a Statement function tlraDBSQL($argSQL) { .... //Create Array of variables and bound them if ( ! ($this->create_param_array() ) ) { return false; } $this->dbBatchSize = $pre_fetch; return true; } function create_param_array() { global $VWM_LOGGER; $tempSQL = $this->dbSQL; $curPos = 0; $this->dbParamDef = ""; $data_info = new vwm_data_info(); { //Check if variable is at the end { if ($varSize === -1) { " found in SQL " .$this->dbSQL, "ERROR", "1250"); return false; } ......?>
Cualquier comentario es bueno. Muchisimas gracias por su ayuda.
Spider Marsh