Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I set a NULL value to a bind variable using C++ interface? #11

Closed
kornefalk opened this issue Aug 7, 2015 · 2 comments
Closed

Can I set a NULL value to a bind variable using C++ interface? #11

kornefalk opened this issue Aug 7, 2015 · 2 comments
Assignees
Labels

Comments

@kornefalk
Copy link

I have not found any way to tell the Oracle database that I want to insert a record consists of some values and some NULL values using C++ interface.

Shouldn't there we a function in Statement that sets a column to NULL ?
i,e, BindToNull(ostring name);

@vrogier
Copy link
Owner

vrogier commented Aug 7, 2015

Hi,

you can use BindInfo::SetDataNull()

st.GetBind(":name").SetDataNull(true, 1);

or

st.GetBind(position).SetDataNull(true, 1);

For single bind, the second parameter must be 1.
For array bind, the second parameter is the index in the array

I haven't added yet an overloaded method for single binds...

@vrogier
Copy link
Owner

vrogier commented Aug 7, 2015

Little update, the second parameter is defaulted to 1 in its prototype.
Thus, for single bind, use:

st.GetBind(":name").SetDataNull(true);

or

st.GetBind(pos).SetDataNull(true);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants