Show Contents Previous Page Next Page
Chapter 10 - C API Reference Guide, Part I / The Table API Other Table Functions Here are a few miscellaneous table functions that don't fit into the previous
categories: table *ap_overlay_tables (pool *p, const table *overlay, const table
*base)
This function takes the contents of the table at overlay
and adds it to the table at base. Entries in overlay that
don't exist in base are added to base. Entries that
already exist in base are overwritten. You can use ap_overlay_tables()
to perform a bulk update of a table. This example overlays the fields listed
in my_headers onto the table of outgoing headers:
table *new_table = _ap_overlay_tables(r->pool, my_headers, r->headers_out);
array_header *ap_table_elts (table *t)
If you wish to access the contents of the table directly, you can call
the ap_table_elts() function (it's a preprocessor macro, actually).
It will return an array_header * , which you can
then iterate through, casting each element to a table_entry .
array_header *arr = ap_table_elts(my_table);
int ap_is_empty_table (table *t)
This function (it's a preprocessor macro, actually) returns true if there
are no entries in the given table, or false otherwise.
if(!ap_is_empty_table(my_table)) {
/* this table has one or more elements */
}
void ap_clear_table (table *t)
The ap_clear_table() function clears all entries from the table.
Example:
ap_clear_table(my_table);
Footnotes 2 Despite the differences between Perl hashes and Apache
tables, the Perl API allows programmers to access tables via tied Perl hashes.
See "The Apache::Table Class" in Chapter 9. Show Contents Previous Page Next Page Copyright © 1999 by O'Reilly & Associates, Inc. |