PokerUnicorn
Loading...
Searching...
No Matches
account_iterator_example.c

This is an example code that demonstrates how to use the account iterator.

#include <stdio.h>
#include "account.h"
int main() {
// Create a new account iterator
// Query the database for account objects
pkrsrv_account_iterator_query(pg_conn, query, params, params_length);
// Iterate over the accounts
while (pkrsrv_account_iterator_next(iterator)) {
// Get the current account
pkrsrv_account_t* account = iterator->current;
// Print the account details
printf("Account ID: %d\n", account->id);
printf("Account Name: %s\n", account->name);
}
// Free the memory occupied by the iterator
return 0;
}
pkrsrv_account_t * current
Definition account.h:142
void pkrsrv_account_iterator_free(pkrsrv_account_iterator_t *iterator)
Frees the memory occupied by an account iterator.
pkrsrv_account_iterator_t * pkrsrv_account_iterator_query(PGconn *pg_conn, pkrsrv_string_t *query, char **params, int params_length)
Queries the database for account objects.
pkrsrv_account_iterator_t * pkrsrv_account_iterator_new()
Creates a new account iterator.
bool pkrsrv_account_iterator_next(pkrsrv_account_iterator_t *iterator)
Moves the iterator to the next account.
Account iterator object.
Definition account.h:140