HELPLIB.HLB  —  RDML72  Statements  RDB$DB_KEY, Examples  C Example
    #include <stdio.h>
    DATABASE PERS = FILENAME "PERSONNEL";

    main()
    {
    DECLARE_VARIABLE rdb_key_array[100] SAME AS EMPLOYEES.RDB$DB_KEY;
    DECLARE_VARIABLE rdb_name_array[100] SAME AS EMPLOYEES.LAST_NAME;

    int cnt = 0;

    READY PERS;

    START_TRANSACTION READ_ONLY;

    FOR FIRST 100 E IN EMPLOYEES SORTED BY E.EMPLOYEE_ID
        rdb_key_array[cnt] = E.RDB$DB_KEY;
        strcpy (rdb_name_array[cnt], E.LAST_NAME);
        printf("%s - 1st pass\n", E.LAST_NAME);
        ++cnt;
    END_FOR;

    for ( cnt = --cnt; cnt >= 0; --cnt)
        FOR E IN EMPLOYEES
        WITH E.RDB$DB_KEY = rdb_key_array[cnt]
            if ( strcmp( E.LAST_NAME, rdb_name_array[cnt]) != 0 )
                printf("%s DOES NOT MATCH %s\n",
                           E.LAST_NAME,  rdb_name_array[cnt]);
            else printf("%s - 2nd pass\n", E.LAST_NAME);
        END_FOR;

    COMMIT;
    FINISH;
    }
Close Help