Problema ejecutando funcion en C

From: Edwin Quijada <listas_quijada(at)hotmail(dot)com>
To: <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Problema ejecutando funcion en C
Date: 2009-08-25 23:57:46
Message-ID: BLU137-W13DC614863C66FF995BB63E3F80@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda


Hola!
Estoy tratando de hacer un par de funciones en C. Las compile bien e incluso las cargue pero al momento de ejecutarlas Postgres me saca del server y me da un error extrano

Este es mi codigo en c y el error que me da al tratar de ejecutar las funciones. Solo son dos

#include "postgres.h"#include <string.h>#include "fmgr.h"#include <stdio.h>#include <stdlib.h> #ifdef PG_MODULE_MAGICPG_MODULE_MAGIC;#endif PG_FUNCTION_INFO_V1(pg_val_licenses_movil); /* Ejecuta la funcion que determina si la licencia movil es valida para poder usarla */Datumpg_val_licenses_movil(PG_FUNCTION_ARGS) { int32 arg = PG_GETARG_INT32(0); char *cmd = "php getm.php"; char buf[BUFSIZ]; FILE *ptr; if ((ptr = popen(cmd, "r")) != NULL) while (fgets(buf, BUFSIZ, ptr) != NULL) (void) pclose(ptr); PG_RETURN_BOOL(buf[0]!= '0'); } PG_FUNCTION_INFO_V1(pg_val_licenses_desk); /* Ejecuta la funcion que determina si la licencia movil es valida para poder usarla */ Datumpg_val_licenses_desk(PG_FUNCTION_ARGS) { int32 arg = PG_GETARG_INT32(0); char *cmd = "php getd.php"; char buf[BUFSIZ]; FILE *ptr; if ((ptr = popen(cmd, "r")) != NULL) while (fgets(buf, BUFSIZ, ptr) != NULL) (void) pclose(ptr); PG_RETURN_BOOL(buf[0]!= '0'); } This the error to running db_source#select pg_val_licenses_movil(0);server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request.The connection to the server was lost. Attempting reset: Failed.

*-------------------------------------------------------*
*-Edwin Quijada
*-Developer DataBase
*-JQ Microsistemas

*-Soporte PostgreSQL

*-www.jqmicrosistemas.com
*-809-849-8087
*-------------------------------------------------------*

_________________________________________________________________

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Edwin Quijada 2009-08-26 00:01:51 FW: Problema ejecutando funcion en C
Previous Message Pedir o Dar Ayuda en postgres 2009-08-25 18:52:45 Configuración Postgres...General y Autovacuum