C compiler limits
Posted in 1993
Topics: Stored Procedures & SPL, Connectivity: ODBC / JDBC / .NET, Connectivity: ESQL/C, 4GL & Embedded SQL
I wrote: } Since your Informix table is converted into a C structure, there is a limit } to the number of columns you can have in a single table. It depends on the } C compiler on your machine. Check your documentation for the limit to the } number of members in a structure. Dave Cortesi replied: > This is not strictly true. As far as the database engine goes, there > is no C structure describing a table. The table is fully described in > the system catalog tables (systables, syscolumns). Hence there is no > restriction on the CREATE TABLE (column-names...) statement. > > But if you are programming in 4GL, and you write > > DEFINE one_tab_row RECORD LIKE wide_table_name.* > > then there might indeed be -- in the C generated from that program -- a > struct with a member for each column. I had never heard of a compiler > with a limit on struct members, but I can well believe one exists. > > Could you clarify where/when this C struct is created for you? Gee Dave, thanks for enlightening me! For two and a half years now, I've assumed that Informix makes a structure out of CREATE TABLE statements. Why have I assumed this????? Because the "experts" on the Informix Tech Support line told me so! Some experts, huh?! I have never used ESQL/C, so if that product generates code without structures for tables, then perhaps I could have solved my problem of two years ago. Anyone care to shed some light on that product for me? I just ran some test programs in 4GL. I specified a table named "test_tab" with 147 columns and compiled it. It ran just fine. Next I coded a second 4GL program in which I wrote: MAIN DEFINE tab_rec RECORD LIKE test_tab.* DISPLAY " Program done." END MAIN This program did not get past the Phase 3 compile. The message "Parameter stack overflow" was displayed from the C compiler. This is due to the limit of our C compiler of 146 members in a structure. And yes Dave there certainly are compilers with such low limits. This verifies what you said about the CREATE TABLE and DEFINE statements. Too bad for me that I wasn't told the truth two and a half years ago when I was new to 4GL. At that time, I had a program with one large table and a DEFINE statement for a record LIKE the table. The program compiled only when I reduced the number of table columns to 146 or less. The "experts" at Tech Support were stumped. They insisted there was no limit to the number of columns in a table (which is true). Numerous phone calls later, somebody told me, "Informix will make structures out of your tables, so if you exceed the limits of your C compiler, you'll get that stack overflow error." His explanation was wrong. He should have said, "4GL will make structures out of your RECORD definitions." His solution was to make two tables, but he should have told me to make two records instead. Too bad for me the so-called experts at Tech Support didn't know anything about defining records, for it would have saved me considerable time back then! Nevertheless, the main point for 4GL programmers is to be aware of the limits of your machine's C compiler. If you have a large table, your compiler might put a crimp in your 4GL programming style, because you might not be able to define large records. ___ John ---------- John Baker jbaker@bluegrass-emh1.army.mil Directorate of Information Mgt. Blue Grass Army Depot, Lexington, KY 40511-5109 Ph: (606) 293-3644 DSN 745-