/* ---------------- * debugtup - print one tuple for an interactive backend * ---------------- */ bool debugtup(TupleTableSlot *slot, DestReceiver *self) { TupleDesc typeinfo = slot->tts_tupleDescriptor; int natts = typeinfo->natts; int i; Datum attr; char *value; bool isnull; Oid typoutput; bool typisvarlena; for (i = 0; i < natts; ++i) { attr = slot_getattr(slot, i + 1, &isnull); if (isnull) continue; getTypeOutputInfo(typeinfo->attrs[i]->atttypid, &typoutput, &typisvarlena); value = OidOutputFunctionCall(typoutput, attr); printatt((unsigned) i + 1, typeinfo->attrs[i], value); } printf("\t----\n"); return true; }
static STATUS qrdefcolret( QRIOB * qriob, i4 i, bool * flushed, bool firstcol ) { /* init dbv with column attributes */ qriob->dbv.db_length = qriob->qrb->rd->RD_DBVS_MACRO(i).db_length; qriob->dbv.db_datatype = qriob->qrb->rd->RD_DBVS_MACRO(i).db_datatype; qriob->dbv.db_prec = qriob->qrb->rd->RD_DBVS_MACRO(i).db_prec; /* pick up fixed length column value */ IIretdom( 1, DB_DBV_TYPE, 0, &(qriob->dbv) ); if (IIerrtest() != 0) return( FAIL ); /* error, fake end-data to caller */ printatt( qriob->qrb, &(qriob->dbv), firstcol ); *flushed = FALSE; return( OK ); }
/* ---------------- * debugStartup - prepare to print tuples for an interactive backend * ---------------- */ void debugStartup(DestReceiver *self, int operation, TupleDesc typeinfo) { int natts = typeinfo->natts; int i; /* * show the return type of the tuples */ for (i = 0; i < natts; ++i) printatt((unsigned) i + 1, TupleDescAttr(typeinfo, i), NULL); printf("\t----\n"); }
/* ---------------- * debugStartup - prepare to print tuples for an interactive backend * ---------------- */ void debugStartup(DestReceiver *self, int operation, TupleDesc typeinfo) { int natts = typeinfo->natts; Form_pg_attribute *attinfo = typeinfo->attrs; int i; /* * show the return type of the tuples */ for (i = 0; i < natts; ++i) printatt((unsigned) i + 1, attinfo[i], NULL); printf("\t----\n"); }
/* ---------------- * debugtup - print one tuple for an interactive backend * ---------------- */ void debugtup(TupleTableSlot *slot, DestReceiver *self) { TupleDesc typeinfo = slot->tts_tupleDescriptor; int natts = typeinfo->natts; int i; Datum origattr, attr; char *value; bool isnull; Oid typoutput; bool typisvarlena; for (i = 0; i < natts; ++i) { origattr = slot_getattr(slot, i + 1, &isnull); if (isnull) continue; getTypeOutputInfo(typeinfo->attrs[i]->atttypid, &typoutput, &typisvarlena); /* * If we have a toasted datum, forcibly detoast it here to avoid * memory leakage inside the type's output routine. */ if (typisvarlena) attr = PointerGetDatum(PG_DETOAST_DATUM(origattr)); else attr = origattr; value = OidOutputFunctionCall(typoutput, attr); printatt((unsigned) i + 1, typeinfo->attrs[i], value); pfree(value); /* Clean up detoasted copy, if any */ if (DatumGetPointer(attr) != DatumGetPointer(origattr)) pfree(DatumGetPointer(attr)); } printf("\t----\n"); }
static VOID qrubdhdlr( QRIOB * qriob ) { i4 seglen = 0; i4 data_end = 0; i4 count = 0; /* check for NULL data somewhere here and take appropriate action if ** found (will data_end be 1 in this case?) */ if ( qriob->qrb->tm ) { qrputc( qriob->qrb, DRCH_V ); /* begin with a | */ while ( data_end != 1 ) /* get and put to user 2k or less segs */ { qriob->dbv.db_length = QR_DRBSZ; IILQlgd_LoGetData((i4)(II_DATLEN|II_DATSEG), DB_DBV_TYPE, QR_DRBSZ, &(qriob->dbv), QR_DRBSZ, &seglen, &data_end ); if (IIerrtest() != 0) { IILQled_LoEndData(); return; } count++; /* blob col names are formatted into GL_MAXNAME size boxes. /* if entire blob is shorter than column header size, set ** db_length to column header size (GL_MAXNAME) so that printatt ** will blank pad correctly. */ if (count == 1 && data_end == 1 && seglen < qriob->qrb->col_maxname) qriob->dbv.db_length = qriob->qrb->col_maxname; else qriob->dbv.db_length = seglen; printatt( qriob->qrb, &(qriob->dbv), TRUE ); (*(qriob->qrb->putfunc))(qriob->qrb); } } else /* don't output the blobs, this is not 'tm'. token only. */ { /* don't need to go through printatt in this case, ** no translation or conversion is necessary */ IILQled_LoEndData(); /* first time through, retrieve the token from er file */ if ( blob_token == NULL ) blob_token = ERget(F_QR011E_Unbounded_data); qrputc(qriob->qrb, DRCH_V); qradd(qriob->qrb, blob_token, seglen = STlength( blob_token )); /* blob col names are formatted into ** DB_MAXNAME size boxes. the token ** must be padded or truncated to fit. ** data_end is not mnemonic here!! */ for( data_end = ( qriob->qrb->col_maxname - seglen ); data_end > 0; data_end -- ) qrputc(qriob->qrb, ' '); } return; }