I want to trimming character(char) columns via ODBC driver. I've done something like this and it works, but I'm not satisfied.
/*
* First convert any specific postgres types into more useable data.
*
* NOTE: Conversions from PG char/varchar of a date/time/timestamp value
* to SQL_C_DATE,SQL_C_TIME, SQL_C_TIMESTAMP not supported
*/
switch (field_type)
{
/*
* $$$ need to add parsing for date/time/timestamp strings in
* PG_TYPE_CHAR,VARCHAR $$$
*/
/*ADDED*/ case 1042:
/*ADDED*/ rtrim(value);
/*ADDED*/ break;
case PG_TYPE_DATE:
sscanf(value, "%4d-%2d-%2d", &std_time.y, &std_time.m, &std_time.d);
break;
case PG_TYPE_TIME:
{
BOOL bZone = FALSE; /* time zone stuff is unreliable */
int zone;
timestamp2stime(value, &std_time, &bZone, &zone);
}
break;
Thank you.