The Ns_PdDbBindRow function should return a list of column names of rows to be returned by the SQL command previously executed by Ns_PdDbExec().
The Ns_PdDbSetRowInfoItem inserts the data info the rowData array. You associate data to AOLserver via Ns_PdDbSendRowInfo. The Ns_PdDbSendRowInfo uses Ns_PdDbSendString to send the number of columns and Ns_PdDbSendData to send the row data (e.g., Ns_PdSendData(rowInfo->rowData[i].elData, size);).
/* DBMSState and DBMSBindRow are your DBMS-specific structures and calls. */
typedef struct Ns_PdRowData {
int elSize;
char *elData;
} Ns_PdRowData;
typedef struct Ns_PdRowInfo {
int numColumns;
Ns_PdRowData *rowData;
} Ns_PdRowInfo;
void
Ns_PdDbBindRow(void *handle) {
DBMSState *state = (DBMSState *)handle;
Ns_PdRowInfo *rowInfo;
if ((rowInfo = DBMSBindRow(state)) == NULL) {
Ns_PdSendException(state->exceptionCode, state->exceptionMsg);
} else {
Ns_PdSendString(OK_STATUS);
Ns_PdSendRowInfo(rowInfo);
Ns_PdFreeRowInfo(rowInfo, 1);
}
}
|