Re: Esqlc - data headaches
Posted in 1999
Thanks, all, for the help. Back to normal. Discovered that when I migrated to Online, I changed the size of a field from char(34) to varchar (200) but was still loading this into a tiny buffer for string concatenation. As a result my buffer overflowed, and stomped all over my data (but did not blow the program up). Yours, Nick On Fri, 26 Feb 1999, David Williams wrote: > In article <7b1ksj$8vg$1@news.xmission.com>, Nick Nobbe <nnob@loc.gov> > writes > > > > > >Working with Online 7.10 UC3, and Esqlc and totally puzzled about > >the following two problems. > > > >1. I occasionally get a string where a character is expected from a > > char (1) field in the database. My translation to esqlc goes something > > like -- > > > > $string single[2] ; > > > > fetch ... into $single; > > > > fprintf( stdout, "%c" , *single ) ; > > > > I've tried other ways, like declaring it as a fixchar single[1], but > > no luck there either. > > > >2. I've used host indicator variables for shorts, using the indicators > > to test for null, and occasionally getting what appears to be large > > integers back in my short host vars. Some sample very streamlined code: > > > > declarations: > > short myvar, myindicator; > > > > declare mycursor for select var into $myvar:myindicator > > from mytable where ..... ; > > > > open cursor > > > > fetch cursor > > > > test: > > > > if ( myindicator == 0 ) > > fprintf( stdout, "%d", myvar ) ; > %hd to print shorts... > > else > > fprintf( stdout, "0" ); > > > > The test appears to work but the host variable returns large integer > > values when there is valid short data. > > > > It looks like there may be an errant pointer, but I'd think this would > > blow the program up. Any clues? > > > > Thanks, > > Nick > > > > > > > > -- > David Williams >