pike.git / src / modules / Postgres / pgresult.cmod

version» Context lines:

pike.git/src/modules/Postgres/pgresult.cmod:175:    *!    *! You can't create istances of this object yourself.    *! The only way to create it is via a big_query to a Postgres    *! database.    */      PIKEFUN void create(object o)    flags ID_PROTECTED;   {    char *storage; -  check_all_args("postgres_result->create",args,BIT_OBJECT,0); +  check_all_args(NULL,args,BIT_OBJECT,0);    pgdebug("result->f_create(%d).\n",args);       storage=get_storage(Pike_sp[-args].u.object, Postgres_postgres_program);    if (!storage)    Pike_error ("I need a Postgres object or an heir of it.\n");       if (!THIS->result) /*this ensures we _DO_ have a result*/    Pike_error ("Bad result.\n");   #ifdef PGRESDEBUG    pgdebug("Got %d tuples.\n",PQntuples(THIS->result));
pike.git/src/modules/Postgres/pgresult.cmod:248:         /*! @decl int num_rows()    *!    *! Returns the number of rows in the result.    */      PIKEFUN int num_rows()   {    int rows; -  check_all_args("postgres_result->num_rows",args,0); +  check_all_args(NULL,args,0);    if (PQresultStatus(THIS->result)!=PGRES_TUPLES_OK) {    push_int(0);    return;    }    rows=PQntuples(THIS->result);    push_int(THIS->rows>rows?THIS->rows:rows);    return;   }         /*! @decl int num_fields()    *!    *! Returns the number of fields in the result.    */      PIKEFUN int num_fields()   { -  check_all_args("postgres_result->num_fields",args,0); +  check_all_args(NULL,args,0);    if (PQresultStatus(THIS->result)!=PGRES_TUPLES_OK) {    push_int(0);    return;    }    push_int(PQnfields(THIS->result));    return;   }         /*! @decl array(mapping(string:mixed)) fetch_fields()
pike.git/src/modules/Postgres/pgresult.cmod:305:    *! but a driver-choice. In fact char() fields are for Postgres _FIXED_    *! length fields, and are space-padded. If CUT_TRAILING_SPACES is defined    *! when the driver is compiled (default behavior) it will cut such spaces.    */      PIKEFUN array(mapping(string:mixed)) fetch_fields()   {    int j, numfields, tmp;    PGresult * res=THIS->result;    -  check_all_args("postgres_result->fetch_fields",args,0); +  check_all_args(NULL,args,0);    numfields=PQnfields(res);    for (j=0;j<numfields;j++)    {    push_static_text("name");    push_text(PQfname(res,j));    /* no table information is available */    /* no default value information is available */    ref_push_string(literal_type_string);    push_int(PQftype(res,j));    /* ARGH! I'd kill 'em! How am I supposed to know how types are
pike.git/src/modules/Postgres/pgresult.cmod:368:    *! or not in Postgres, all results are returned as strings.    *! You can typecast them in Pike to get the numeric value.    *!    *! @seealso    *! @[seek()]    */   PIKEFUN array(string) fetch_row()   {    int j,numfields;    -  check_all_args("postgres_result->fetch_row",args,0); +  check_all_args(NULL,args,0);    pgdebug("f_fetch_row(); cursor=%d.\n",THIS->cursor);    if (THIS->cursor>=PQntuples(THIS->result)) {    PGresult * res=THIS->result;    if(THIS->flags & PIKE_PG_FETCH) {    PGconn * conn = pike_get_pgconn(THIS->pgod);    int docommit = THIS->flags & PIKE_PG_COMMIT;    int dofetch=1;    PQ_FETCH();    THIS->result = NULL;    /* FIXME: Race-condition on THIS->result. */