ESQL/C incvfmtasc() problem
Posted in 1996
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
I'm having trouble setting the FRACTION component of an Informix Interval datatype column using the incvfmtasc() function. I can set HOURS, MINUTES and SECONDS successfully but the FRACTION always yields an error. I've worked up a small example. If anyone can see what I'm doing wrong I'd appreciate the help. -----------snip--------------- #include <stdio.h> EXEC SQL include datetime; main() { char out_str[30]; EXEC SQL BEGIN DECLARE SECTION; interval hour to fraction(5) moment; EXEC SQL END DECLARE SECTION; /* * Set seconds. This case works OK. */ if ( incvfmtasc("1", "%S", &moment) < 0 ) { printf("failed case 1\\n"); } else { printf("succeded case 1\\n"); intoasc(&moment, out_str); printf("Interval value = %s\\n", out_str); } /* * This case fails. */ if ( incvfmtasc("1", "%F", &moment) < 0 ) { printf("\\nfailed case 2\\n"); } else { printf("\\nsucceded case 2\\n"); intoasc(&moment, out_str); printf("Interval value = %s\\n", out_str); } /* * This case fails. */ if ( incvfmtasc("1", "%F5", &moment) < 0 ) { printf("\\nfailed case 3\\n"); } else { printf("\\nsucceded case 3\\n"); intoasc(&moment, out_str); printf("Interval value = %s\\n", out_str); } } -- Greg C. Faulk Database Administrator TRW Enterprise Solutions Phone: (510) 645-3655 300 Lakeside Drive Fax: (510) 645-3020 Oakland CA 94612-3540 E-mail: gregf@tfs.com -- -- Greg C. Faulk Database Administrator TRW Enterprise Solutions Phone: (510) 645-3655 300 Lakeside Drive Fax: (510) 645-3020