Re: ESQL/C Serial Column Type?
Posted in 1996
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Data Types & Schema Design
Rajendra Singh wrote: > > I have an ESQL/C program which needs to determine which column of a > table is of type SERIAL. According to the reference manual, a serial > column is 6. I tried the following: > > if (type == 6 || type == SQLSERIAL) > { > . > . > } > > ... but the code in the braces NEVER gets executed. I then looked at > the column definition in "syscolumns" and found that the type is 262. > What's the meaning of this? Why can't I use SQLSERIAL? To remedy the > above problem, I had to add in a check for 262 also. This worked. > > Any comments as to why type != SQLSERIAL for a serial column? If the column is defined as NOT NULL the type will have 256 addeed. As the default for SERIAL is NOT NULL you are actually unlikeley to find type 6. When you check for a type, you should also check for type+256. Hope that helps, -- Mark. +-------------------------------------------------------------------------+ |Mark D. Stock - The West Solutions Group http://www.west.co.za | | The Informix FAQ is at http://www.iiug.org | |mailto:marks@west.co.za +------------------------------------------------+ |Tel: +27 11 803 2151 |If it doesn't work... force it! | |Fax: +27 11 803 2189 |If it breaks... it needed replacing anyway! | |Cell: +27 83 250 2325 |Well, that's how I code anyway! | +------------------------+------------------------------------------------+