/** Returns an individual row.
 *
 */
static int sql_fetch_row(rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t *config)
{
	rlm_sql_firebird_conn_t *conn = handle->conn;
	int res;
	
	handle->row = NULL;
	
	if (conn->statement_type != isc_info_sql_stmt_exec_procedure) {
		res = fb_fetch(conn);
		if (res == 100) {
			return 0;
	 	}
	 	
	 	if (res) {
	  		radlog(L_ERR, "rlm_sql_firebird. Fetch problem:'%s'",
	  		       conn->lasterror);
	  		
	   		return -1;
	 	}
	} else {
		conn->statement_type=0;
	}
	
	fb_store_row(conn);

	handle->row = conn->row;
	
	return 0;
}
/** Returns an individual row.
 *
 */
static sql_rcode_t sql_fetch_row(rlm_sql_row_t *out, rlm_sql_handle_t *handle, UNUSED rlm_sql_config_t *config)
{
	rlm_sql_firebird_conn_t *conn = handle->conn;
	int res;

	*out = NULL;
	handle->row = NULL;

	if (conn->statement_type != isc_info_sql_stmt_exec_procedure) {
		res = fb_fetch(conn);
		if (res == 100) return 0;
		if (res) {
			ERROR("rlm_sql_firebird. Fetch problem: %s", conn->error);

			return -1;
		}
	} else {
		conn->statement_type = 0;
	}

	fb_store_row(conn);

	*out = handle->row = conn->row;

	return 0;
}
Esempio n. 3
0
/*************************************************************************
 *
 *	Function: sql_fetch_row
 *
 *	Purpose: database specific fetch_row. Returns a SQL_ROW struct
 *               with all the data for the query in 'sqlsocket->row'. Returns
 *		 0 on success, -1 on failure, SQL_DOWN if 'database is down'.
 *
 *************************************************************************/
static int sql_fetch_row(SQLSOCK *sqlsocket, SQL_CONFIG *config) {
    rlm_sql_firebird_sock *firebird_sock = sqlsocket->conn;
    int res;

    sqlsocket->row = NULL;
    if (firebird_sock->statement_type!=isc_info_sql_stmt_exec_procedure) {
     res=fb_fetch(firebird_sock);
     if (res==100) return 0;
     if (res) {
       radlog(L_ERR, "rlm_sql_firebird. Fetch problem:'%s'\n", firebird_sock->lasterror);
       return -1;
     }
    } else firebird_sock->statement_type=0;
    fb_store_row(firebird_sock);

    sqlsocket->row = firebird_sock->row;
    return 0;
}