diff options
Diffstat (limited to 'src/interfaces/ecpg/preproc/descriptor.c')
-rw-r--r-- | src/interfaces/ecpg/preproc/descriptor.c | 110 |
1 files changed, 0 insertions, 110 deletions
diff --git a/src/interfaces/ecpg/preproc/descriptor.c b/src/interfaces/ecpg/preproc/descriptor.c index 845a70c0aa8..e55aa886cf8 100644 --- a/src/interfaces/ecpg/preproc/descriptor.c +++ b/src/interfaces/ecpg/preproc/descriptor.c @@ -57,116 +57,6 @@ static void ECPGnumeric_lvalue(FILE *f,char *name) } } -static void ECPGstring_buffer(FILE *f, char *name) -{ - const struct variable *v = find_variable(name); - - switch(v->type->typ) - { - case ECPGt_varchar: - fprintf(yyout,"%s.arr",name); - break; - - case ECPGt_char: - case ECPGt_unsigned_char: - fputs(name,yyout); - break; - - default: - snprintf(errortext,sizeof errortext,"variable %s: character type needed" - ,name); - mmerror(ET_ERROR,errortext); - break; - } -} - -static void ECPGstring_length(FILE *f,char *name) -{ - const struct variable *v=find_variable(name); - - switch(v->type->typ) - { case ECPGt_varchar: - case ECPGt_char: - case ECPGt_unsigned_char: - if (!v->type->size) - { snprintf(errortext,sizeof errortext,"zero length char variable %s for assignment", - v->name); - mmerror(ET_ERROR,errortext); - } - fprintf(yyout,"%ld",v->type->size); - break; - default: - snprintf(errortext,sizeof errortext,"variable %s: character type needed" - ,name); - mmerror(ET_ERROR,errortext); - break; - } -} - -static void ECPGdata_assignment(char *variable,char *index_plus_1) -{ - const struct variable *v=find_variable(variable); - - fprintf(yyout,"\t\t\tif (!PQgetisnull(ECPGresult,0,(%s)-1))\n",index_plus_1); - switch(v->type->typ) - { - case ECPGt_short: - case ECPGt_int: /* use the same conversion as ecpglib does */ - case ECPGt_long: - fprintf(yyout,"\t\t\t\t%s=strtol(PQgetvalue(ECPGresult,0,(%s)-1),NULL,10);\n" - ,variable,index_plus_1); - break; - case ECPGt_unsigned_short: - case ECPGt_unsigned_int: - case ECPGt_unsigned_long: - fprintf(yyout,"\t\t\t\t%s=strtoul(PQgetvalue(ECPGresult,0,(%s)-1),NULL,10);\n" - ,variable,index_plus_1); - break; - case ECPGt_float: - case ECPGt_double: - fprintf(yyout,"\t\t\t\t%s=strtod(PQgetvalue(ECPGresult,0,(%s)-1),NULL);\n" - ,variable,index_plus_1); - break; - - case ECPGt_bool: - fprintf(yyout,"\t\t\t\t%s=PQgetvalue(ECPGresult,0,(%s)-1)[0]=='t';\n" - ,variable,index_plus_1); - break; - - case ECPGt_varchar: - fprintf(yyout,"\t\t\t{\tstrncpy(%s.arr,PQgetvalue(ECPGresult,0,(%s)-1),%ld);\n" - ,variable,index_plus_1,v->type->size); - fprintf(yyout,"\t\t\t\t%s.len=strlen(PQgetvalue(ECPGresult,0,(%s)-1)\n" - ,variable,index_plus_1); - fprintf(yyout,"\t\t\t\tif (%s.len>%ld) { %s.len=%ld; sqlca.sqlwarn[0]=sqlca.sqlwarn[1]='W'; }\n" - ,variable,v->type->size,variable,v->type->size); - fputs("\t\t\t}\n",yyout); - break; - - case ECPGt_char: - case ECPGt_unsigned_char: - if (!v->type->size) - { - snprintf(errortext,sizeof errortext,"zero length char variable %s for DATA assignment", - v->name); - mmerror(ET_ERROR,errortext); - } - fprintf(yyout,"\t\t\t{\tstrncpy(%s,PQgetvalue(ECPGresult,0,(%s)-1),%ld);\n" - ,variable,index_plus_1,v->type->size); - fprintf(yyout,"\t\t\t\tif (strlen(PQgetvalue(ECPGresult,0,(%s)-1))>=%ld)\n" - "\t\t\t\t{ %s[%ld]=0; sqlca.sqlwarn[0]=sqlca.sqlwarn[1]='W'; }\n" - ,index_plus_1,v->type->size,variable,v->type->size-1); - fputs("\t\t\t}\n",yyout); - break; - - default: - snprintf(errortext,sizeof errortext,"unknown variable type %d for DATA assignment" - ,v->type->typ); - mmerror(ET_ERROR,errortext); - break; - } -} - /* * descriptor name lookup */ |