aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-09-13 15:56:47 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-09-13 15:56:47 +0200
commit7234741fcd3824b36c7292e8245cc59bbe7de13e (patch)
treeb58fd62373dbc2807969115f8cb9d1d2c05ad04b
parent071fe5eef8d88ac51d4ed6436aa2ffc95283ae5b (diff)
Revert to previous select statement interface
-rw-r--r--odb/oracle/statement.cxx26
-rw-r--r--odb/oracle/statement.hxx51
2 files changed, 18 insertions, 59 deletions
diff --git a/odb/oracle/statement.cxx b/odb/oracle/statement.cxx
index f41c161..5aa025e 100644
--- a/odb/oracle/statement.cxx
+++ b/odb/oracle/statement.cxx
@@ -114,8 +114,7 @@ namespace odb
binding& cond,
binding& data)
: statement (conn, s),
- done_ (false),
- rows_ (0)
+ done_ (false)
{
bind_param (cond.bind, cond.count, 0);
bind_result (data.bind, data.count);
@@ -161,11 +160,10 @@ namespace odb
done_ = true;
}
-
}
- bool select_statement::
- next ()
+ select_statement::result select_statement::
+ fetch ()
{
if (!done_)
{
@@ -182,7 +180,7 @@ namespace odb
done_ = true;
}
- return !done_;
+ return done_ ? no_data : success;
}
//
@@ -202,12 +200,12 @@ namespace odb
typedef insert_statement::id_bind_type bind;
bind& b (*static_cast<bind*> (context));
- b.ind = -1;
+ b.indicator = -1;
*buffer = 0;
*len = 0;
*piece = OCI_ONE_PIECE;
- *reinterpret_cast<sb2**> (indicator) = &b.ind;
+ *reinterpret_cast<sb2**> (indicator) = &b.indicator;
return OCI_CONTINUE;
}
@@ -220,7 +218,7 @@ namespace odb
void** buffer,
ub4** len,
ub1*, // piece
- void** ind,
+ void** indicator,
ub2** rcode)
{
typedef insert_statement::id_bind_type bind;
@@ -229,14 +227,14 @@ namespace odb
#if (OCI_MAJOR_VERSION == 11 && OCI_MINOR_VERSION >=2) \
|| OCI_MAJOR_VERSION > 11
- *buffer = &b.id.value_64;
+ *buffer = &b.id.value64;
**len = sizeof (unsigned long long);
#else
- *buffer = &b.id.value_32;
+ *buffer = &b.id.value32;
**len = sizeof (unsigned int);
#endif
- *ind = &b.ind;
+ *indicator = &b.indicator;
*rcode = 0;
return OCI_CONTINUE;
@@ -334,9 +332,9 @@ namespace odb
{
#if (OCI_MAJOR_VERSION == 11 && OCI_MINOR_VERSION >=2) \
|| OCI_MAJOR_VERSION > 11
- return id_bind_.id.value_64;
+ return id_bind_.id.value64;
#else
- return id_bind_.id.value_32;
+ return id_bind_.id.value32;
#endif
}
diff --git a/odb/oracle/statement.hxx b/odb/oracle/statement.hxx
index 6e183a8..e999134 100644
--- a/odb/oracle/statement.hxx
+++ b/odb/oracle/statement.hxx
@@ -75,55 +75,17 @@ namespace odb
execute ();
result
- fetch ()
- {
- return next () ? load () : no_data;
- }
-
- // Never need to deal with truncation, so this is a dummy function.
- //
- void
- refetch ()
- {
- }
+ fetch ();
void
free_result ();
- // More fine-grained Oracle-specific interface that splits fetch() into
- // next() and load().
- //
- public:
- // Return false if there is no more rows. You should call next() until it
- // returns false or, alternatively, call free_result (). Otherwise, the
- // statement will remain unfinished.
- //
- bool
- next ();
-
- result
- load ()
- {
- if (done_)
- return no_data;
-
- return success;
- }
-
- // Never need to deal with truncation, so this is a dummy function.
- //
- void
- reload ()
- {
- }
-
private:
select_statement (const select_statement&);
select_statement& operator= (const select_statement&);
private:
bool done_;
- std::size_t rows_;
};
class LIBODB_ORACLE_EXPORT insert_statement: public statement
@@ -152,20 +114,19 @@ namespace odb
// Only OCI versions 11.2 and greater support conversion of the internal
// Oracle type NUMBER to an external 64-bit integer type. If we detect
- // version 11.2 or greater, we leverage this feature and provide an
- // unsigned long long image. Otherwise, we revert to using a 32-bit
- // unsigned integer.
+ // version 11.2 or greater we provide an unsigned long long image.
+ // Otherwise, we revert to using a 32-bit unsigned integer.
//
public:
struct id_bind_type
{
union
{
- unsigned int value_32;
- unsigned long long value_64;
+ unsigned int value32;
+ unsigned long long value64;
} id;
- sb2 ind;
+ sb2 indicator;
};
private: