Re: ESQL and dttofmtasc() problem
Posted in 1995
Error message -1228 comes from the file rds.iem in the Informix
message directory and says:
-1228: Message number not found in message file
Check your installation order! Tools, Engines, Network (TEN).
Converting your code to the pure ESQL/C included below and running under
ESQL/C version 5.03.UC1 on Solaris 2.4, I get the expected results.
dt1: result = 0, output = <<03/13/1995 10:10>>
dt2: result = 0, output = <<1995-03-13 10:10>>
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>
----------------------------------------------------------------------------
EXEC SQL include datetime.h;
EXEC SQL include decimal.h;
#include <stdio.h>
#include <string.h>
main()
{
EXEC SQL BEGIN DECLARE SECTION;
datetime YEAR TO MINUTE dt1;
datetime YEAR TO MINUTE dt2;
EXEC SQL END DECLARE SECTION;
char obuff1[50], obuff2[50];
int x;
int y;
strcpy(obuff1, "");
strcpy(obuff2, "");
dtcurrent(&dt1);
dtcurrent(&dt2);
x = dttofmtasc(&dt1, obuff1, sizeof(obuff1), "%m/%d/%Y %H:%M");
y = dttoasc(&dt2, obuff2);
printf("dt1: result = %5d, output = <<%s>>\\n", x, obuff1);
printf("dt2: result = %5d, output = <<%s>>\\n", x, obuff2);
return(0);
}
----------------------------------------------------------------------------
}From: mills@hpspk7cr.spk.hp.com (TJ Mills)
}Date: Sun, 5 Mar 1995 05:12:43 GMT
}X-Informix-List-Id: <news.12141>
}
}I am trying to use the dttofmtasc() in ESQL without success. I get an
}error message -1228 (which is undefined on my system). The only time that
}I can use the dttofmtasc function without getting a -1228 error is if I
}use a format string of "".
}The Esql version is: INFORMIX-ESQL Version 5.01.UD1.
}What am I missing here or is this an Informix bug?
} [...]
}
}EXEC SQL include datetime.h;
}EXEC SQL include decimal.h;
}
}#include <iostream.h>
}#include <Time.h>
}#include "/usr/local/mdm/include/Informix.h"
}
}main() {
}EXEC SQL BEGIN DECLARE SECTION;
} datetime YEAR TO MINUTE dt;
} datetime YEAR TO MINUTE dt2;
}EXEC SQL END DECLARE SECTION;
}
}char obuff[50], obuff2[50];
}Time tj = Time(1988, Time::november,8);
}
}// init obuffs
}strcpy(obuff, "");
}strcpy(obuff2, "");
}
}// Init dt
}dtcurrent(&dt);
}dtcurrent(&dt2);
}
}// Store dt into obuff as ASCII
}int x = dttofmtasc(&dt, obuff, sizeof(obuff), "%m/%d/%Y %H:%M");
}int y = dttoasc(&dt2, obuff2);
}
}// Print obuffs result
}cout << "Result = " << x << " Obuff = " << obuff << endl;
}cout << "Result = " << y << " Obuff2 = " << obuff2 << endl;
}
}// Store obuff into tj
}tj = make_time(obuff);
}
}// Print tj
}cout << tj << endl;
}
}}
}
}Here is the output from running the above code:
}
}Result = -1228 Obuff =
}Result = 0 Obuff2 = 1995-03-04 20:50
}03/04/95 20:50:36