SPI_getbinval
SPI_getbinval — получить двоичное значение указанного столбца
Синтаксис
Datum SPI_getbinval(HeapTuplerow
, TupleDescrowdesc
, intcolnumber
, bool *isnull
)
Описание
SPI_getbinval
возвращает значение указанного столбца во внутренней форме (в структуре Datum
).
Эта функция не выделяет новый блок памяти для данных. В случае с типом, передаваемым по ссылке, возвращаемым значением будет указатель на переданную строку данных.
Аргументы
HeapTuple
row
строка с нужными данными
TupleDesc
rowdesc
описание строк
int
colnumber
номер столбца (начиная с 1)
bool *
isnull
признак того, что столбец содержит NULL
Возвращаемое значение
Возвращается двоичное значение столбца. Если этот столбец содержит NULL, переменной, на которую указывает isnull
, присваивается true; в противном случае — false.
При ошибке в SPI_result
устанавливается SPI_ERROR_NOATTRIBUTE
.
SPI_freetuptable
SPI_freetuptable — free a row set created by SPI_execute
or a similar function
Synopsis
void SPI_freetuptable(SPITupleTable * tuptable
)
Description
SPI_freetuptable
frees a row set created by a prior SPI command execution function, such as SPI_execute
. Therefore, this function is often called with the global variable SPI_tuptable
as argument.
This function is useful if an SPI-using C function needs to execute multiple commands and does not want to keep the results of earlier commands around until it ends. Note that any unfreed row sets will be freed anyway at SPI_finish
. Also, if a subtransaction is started and then aborted within execution of an SPI-using C function, SPI automatically frees any row sets created while the subtransaction was running.
Beginning in PostgreSQL 9.3, SPI_freetuptable
contains guard logic to protect against duplicate deletion requests for the same row set. In previous releases, duplicate deletions would lead to crashes.
Arguments
SPITupleTable *
tuptable
pointer to row set to free, or NULL to do nothing