Informix-SE; ESQL/C and HTML
Posted in 1995
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
This is a multi-part message in MIME format. ---------------------------------1836258086863 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Has anyone had any experience using ESQL/C in CGI programs to update or add to a table? I am having a difficult time understanding why some ESQL/C commands or functions work fine when run from a shell, but return undocumented return codes (or don't work at all) when they are run as a CGI program from a WWW server. An example is rdefmtdate. The example program included with the ESQL/C product works fine. But put in the printf for the HTML header and run it from a hyperlink on a web page and you get a return code of -1227. I cannot find this anywhere in the documentation. I am attaching my source with the modifications in the event someone wants to experiment. ---------------------------------1836258086863 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=iso-8859-1 /* * rdefmtdate.ec * The following program accepts a date entered from the console, converts it into the internal date format using rdefmtdate(). It checks the conversion by finding the day of the week. */ #include #include main() { int x; char date[20]; long i_date; char *day_name; static char fmtstr[9] = "mmddyyyy"; printf("Content-type: text/html\\n\\n"); printf("\\n\\n\\n"); printf(" \\n"); printf("RDEFMTDATE Sample ESQL Program running. \\n\\n"); strcpy(date, "09/23/1958"); printf("\\nThe date string is %s. \\n", date); if (x = rdefmtdate(&i_date, fmtstr, date)) printf("Error %d on rdefmtdate conversion \\n", x); else { /* Figure out what day of the week i_date is */ switch (rdayofweek(i_date)) { case 0: day_name = "Sunday"; break; case 1: day_name = "Monday"; break; case 2: day_name = "Tuesday"; break; case 3: day_name = "Wednesday"; break; case 4: day_name = "Thursday"; break; case 5: day_name = "Friday"; break; case 6: day_name = "Saturday"; break; } printf("The day of the week is %s. \\n", day_name); } printf("\\nRDEFMTDATE Sample Program over. \\n\\n"); printf(""); } ---------------------------------1836258086863--