#define SQL_TEXT Latin_Text
#include "sqltypes_td.h"
#include <string.h>
#include <stdlib.h>
#define IsNull -1
#define IsNotNull 0
void is_integer_v( VARCHAR_LATIN *inputString,
int *result,
int *inputStringIsNull,
int *ResultIsNull,
char sqlstate[6],
SQL_TEXT extname[129],
SQL_TEXT specific_name[129],
SQL_TEXT error_message[257] )
{
char *ch;
*error_message = '\0';
*ResultIsNull = 0;
/* make false result the default */
*result = 0;
/* Return Null value on Null Input */
if ((*inputStringIsNull) == IsNull)
{
return;
}
/* what is an Integer
[+|-] xxxx
*/
ch = (char *)inputString;
/* Skip leading spaces */
/* remove this while line to disallow Leading whitespace */
while ( isspace(*ch)) ch ++;
if ( (*ch == '-') || (*ch == '+' ))
{
ch ++;
}
/* is the first character at least a digit? */
if ( !isdigit(*ch) ) return ;
/* skip over all the digits */
/* already validated first digit above */
do
{
ch++;
}
while (isdigit(*ch)) ;
/* skip over the trailing white space */
/* Remove this while line out to disallow Trailing whitespace */
while ( isspace(*ch)) ch ++;
/* we should be at the end of the string.
if not it is not an integer
*/
*result = ( *ch == '\0' );
return;
}
|