Edy1988
asked on
odefin-someone knows?
I need to know what function does what
odefin does, but instead of accepting
char* as third parameter,she accept integers(from type long, in c);
odefin does, but instead of accepting
char* as third parameter,she accept integers(from type long, in c);
ASKER
BUT HOW DO YOU USE IN THIS FUNCTIONS
AN INTEGER?LONG VARIABLE INSTEAD OF CHAR*
AS THIRD PARAM OF ODEFIN?
WHEN I TRY TO, I HAVE 2 WARNINGS.
AN INTEGER?LONG VARIABLE INSTEAD OF CHAR*
AS THIRD PARAM OF ODEFIN?
WHEN I TRY TO, I HAVE 2 WARNINGS.
/*
* OBSOLETE DEFINE CALLS-- use odefinps()
*/
sword odefin( /*_ struct cda_def *cursor, sword pos, ub1 *buf,
sword bufl, sword ftype, sword scale, sb2 *indp,
text *fmt, sword fmtl, sword fmtt, ub2 *rlen, ub2 *rcode _*/ );
The third parameter has the type 'pointer to unsigned byte'. If you pass a long values to the function, then you receive a warning from the compiler (and an error at runtime).
* OBSOLETE DEFINE CALLS-- use odefinps()
*/
sword odefin( /*_ struct cda_def *cursor, sword pos, ub1 *buf,
sword bufl, sword ftype, sword scale, sb2 *indp,
text *fmt, sword fmtl, sword fmtt, ub2 *rlen, ub2 *rcode _*/ );
The third parameter has the type 'pointer to unsigned byte'. If you pass a long values to the function, then you receive a warning from the compiler (and an error at runtime).
ASKER
I know that, that is why i asked for a function that is equivalent to odefin, but accept long value instead ub1.
long value;
int ind
oparse( pcda, (text *)"select 1 from dual", (sb4)-1, DEFER_PARSE, (ub4)VERSION_7);
odefin( pcda, col_num, &value, sizeof( value), SQLT_INT, -1, (sb2 *)&ind, (text *)0, -1, -1, (ub2 *) 0, (ub2 *) 0);
oexec( pcda);
ofetch( pcda);
printf( "%ld\n", value);
int ind
oparse( pcda, (text *)"select 1 from dual", (sb4)-1, DEFER_PARSE, (ub4)VERSION_7);
odefin( pcda, col_num, &value, sizeof( value), SQLT_INT, -1, (sb2 *)&ind, (text *)0, -1, -1, (ub2 *) 0, (ub2 *) 0);
oexec( pcda);
ofetch( pcda);
printf( "%ld\n", value);
ASKER
now i have warnings about the incompatibility
of long* and "unsined char *"
of long* and "unsined char *"
Sorry, there must be a cast.
odefin( pcda, 1, (ub1 *)&value, sizeof( value), SQLT_INT, -1, (sb2 *)&ind, (text *)0, -1, -1, (ub2 *) 0, (ub2 *) 0);
odefin( pcda, 1, (ub1 *)&value, sizeof( value), SQLT_INT, -1, (sb2 *)&ind, (text *)0, -1, -1, (ub2 *) 0, (ub2 *) 0);
Sorry, there must be a cast.
odefin( pcda, 1, (ub1 *)&value, sizeof( value), SQLT_INT, -1, (sb2 *)&ind, (text *)0, -1, -1, (ub2 *) 0, (ub2 *) 0);
odefin( pcda, 1, (ub1 *)&value, sizeof( value), SQLT_INT, -1, (sb2 *)&ind, (text *)0, -1, -1, (ub2 *) 0, (ub2 *) 0);
ASKER
Thank you very much, tell me just one last thing
doesn't it suppose to create trouble if the field in the table is of type NUMBER, and i try to bind him to a c long variable after casting his adress to an unsigned char adress?
doesn't it suppose to create trouble if the field in the table is of type NUMBER, and i try to bind him to a c long variable after casting his adress to an unsigned char adress?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
EXCELENT JOB
#define RAW_DATE_SIZE 7
int Oci_stmt_defin_c( Cda_Def *pcda, long col_num, char *c, int len, short *indp)
{
return !odefin( pcda, col_num, c, len, SQLT_STR, -1, (sb2 *)indp, (text *)0, -1, -1, (ub2 *) 0, (ub2 *) 0);
}
int Oci_stmt_defin_f( Cda_Def *pcda, long col_num, float *f, short *indp)
{
return !odefin( pcda, col_num, f, sizeof( f), SQLT_FLT, -1, (sb2 *)indp, (text *)0, -1, -1, (ub2 *) 0, (ub2 *) 0);
}
int Oci_stmt_defin_l( Cda_Def *pcda, long col_num, long *l, short *indp)
{
return !odefin( pcda, col_num, l, sizeof( l), SQLT_INT, -1, (sb2 *)indp, (text *)0, -1, -1, (ub2 *) 0, (ub2 *) 0);
}
int Oci_stmt_defin_dt( Cda_Def *pcda, long col_num, long *dt, short *indp)
{
return !odefin( pcda, col_num, dt, RAW_DATE_SIZE, SQLT_DAT, -1, (sb2 *)indp, (text *)0, -1, -1, (ub2 *) 0, (ub2 *) 0);
}