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);
Edy1988Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

HaukeCommented:
May be this helps you.

#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);
}
0
Edy1988Author Commented:
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.
0
HaukeCommented:
/*
 * 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).
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Edy1988Author Commented:
I know that, that is why i asked for a function that is equivalent to odefin, but accept long value instead ub1.
0
HaukeCommented:
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);
0
Edy1988Author Commented:
now i have warnings about the incompatibility
of long* and "unsined char *"
0
HaukeCommented:
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);
0
HaukeCommented:
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);
0
Edy1988Author Commented:
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?
0
HaukeCommented:
The parameter value SQLT_INT tells Oracle that your variable stores integer values (char, short, int ,long). The parameter value sizeof( value) (= sizeof( long) in this case) tells Oracle the precision you want to use.
If you want to retrieve a value greater than +-2^31 for c type long, then you will receive an (ORA-) error when fetching this row.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Edy1988Author Commented:
EXCELENT JOB
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.