Creating, opening, and closing the table
Having done the basics, we can start working with the tables. The first operation, of course, is the table creation. To be able to read, update, or even open the table we need to create it first, right? Now, the table is just an HTML file and to create a table we only need to create an HTML file with our header and footer, but with no data between them. Just like in the previous chapter, we do not need to create any TABLE
or Field
objects, or anything else—MySQL does it automatically. To avoid repeating the same HTML tags over and over we will define the header and the footer in the ha_html.h
file as follows:
#define HEADER1 "<html><head><title>" #define HEADER2 "</title></head><body><table border=1>\n" #define FOOTER "</table></body></html>" #define FOOTER_LEN ((int)(sizeof(FOOTER)-1))
As we want a header to include a table name we have split it in two parts. Now, we can create our table...