summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames H. Hill <hilljh82@gmail.com>2010-01-02 07:25:01 +0000
committerJames H. Hill <hilljh82@gmail.com>2010-01-02 07:25:01 +0000
commite3dd5dc8552197f689a7e57c0cda52e2362c3729 (patch)
treee2f23c19b81d97265fa09d7529d016930c6cfafd
parent9cbf83d11266ff7f86ed405fa623fa7f3e2b9971 (diff)
downloadATCD-e3dd5dc8552197f689a7e57c0cda52e2362c3729.tar.gz
Sat Jan 2 02:23:02 UTC 2010 James H. Hill <hillj at cs dot iupui dot edu>
-rw-r--r--ADBC/ChangeLog5
-rw-r--r--ADBC/adbc/Query.h4
-rw-r--r--ADBC/adbc/SQLite/Query.cpp5
-rw-r--r--ADBC/adbc/SQLite/Query.h4
-rw-r--r--ADBC/adbc/SQLite/Query.inl2
-rw-r--r--ADBC/examples/SQLite/dynamic/dynamic.cpp12
-rw-r--r--ADBC/examples/SQLite/simple/simple.cpp12
7 files changed, 24 insertions, 20 deletions
diff --git a/ADBC/ChangeLog b/ADBC/ChangeLog
index a466940e296..b072b5d047c 100644
--- a/ADBC/ChangeLog
+++ b/ADBC/ChangeLog
@@ -10,6 +10,11 @@ Sat Jan 2 02:23:02 UTC 2010 James H. Hill <hillj at cs dot iupui dot edu>
executed. Instead, it return an embedded record, which
should not be deallocated () by the client.
+ * examples/SQLite/dynamic/dynamic.cpp:
+ * examples/SQLite/simple/simple.cpp:
+
+ Updated the examples.
+
Wed Dec 30 22:54:02 UTC 2009 James H. Hill <hillj@dre.vanderbilt.edu>
* adbc/SQLite/Query.h:
diff --git a/ADBC/adbc/Query.h b/ADBC/adbc/Query.h
index 549c648109f..c76587ef5aa 100644
--- a/ADBC/adbc/Query.h
+++ b/ADBC/adbc/Query.h
@@ -67,7 +67,7 @@ public:
*
* @return Pointer to a record.
*/
- virtual Record * execute (const char * query) = 0;
+ virtual Record & execute (const char * query) = 0;
/**
* Execute a prepared query. This method is useful with the query is
@@ -77,7 +77,7 @@ public:
*
* @return Pointer to a record.
*/
- virtual Record * execute (void) = 0;
+ virtual Record & execute (void) = 0;
/// Cancel the current query.
virtual void cancel (void) = 0;
diff --git a/ADBC/adbc/SQLite/Query.cpp b/ADBC/adbc/SQLite/Query.cpp
index 1cee7ebfe41..eb1816aa252 100644
--- a/ADBC/adbc/SQLite/Query.cpp
+++ b/ADBC/adbc/SQLite/Query.cpp
@@ -73,7 +73,7 @@ void Query::execute_no_record (void)
//
// execute
//
-Record * Query::execute (void)
+Record & Query::execute (void)
{
if (this->stmt_ == 0)
throw Exception ();
@@ -90,8 +90,7 @@ Record * Query::execute (void)
// Update the record's state for the new query.
this->record_.state_ = retval;
this->needs_reseting_ = true;
-
- return &this->record_;
+ return this->record_;
}
//
diff --git a/ADBC/adbc/SQLite/Query.h b/ADBC/adbc/SQLite/Query.h
index d082e7ec209..9be5c3db392 100644
--- a/ADBC/adbc/SQLite/Query.h
+++ b/ADBC/adbc/SQLite/Query.h
@@ -82,7 +82,7 @@ public:
*
* @return Pointer to a record.
*/
- virtual Record * execute (const char * query);
+ virtual Record & execute (const char * query);
/**
* Execute a prepared query. This method is useful with the query is
@@ -92,7 +92,7 @@ public:
*
* @return Pointer to a record.
*/
- virtual Record * execute (void);
+ virtual Record & execute (void);
/// Cancel the current query.
virtual void cancel (void);
diff --git a/ADBC/adbc/SQLite/Query.inl b/ADBC/adbc/SQLite/Query.inl
index be8e8affb64..03b9d89fca6 100644
--- a/ADBC/adbc/SQLite/Query.inl
+++ b/ADBC/adbc/SQLite/Query.inl
@@ -43,7 +43,7 @@ void Query::execute_no_record (const char * query)
// execute
//
ADBC_INLINE
-Record * Query::execute (const char * query)
+Record & Query::execute (const char * query)
{
this->prepare (query);
return this->execute ();
diff --git a/ADBC/examples/SQLite/dynamic/dynamic.cpp b/ADBC/examples/SQLite/dynamic/dynamic.cpp
index 8d9f6dbb715..46762086685 100644
--- a/ADBC/examples/SQLite/dynamic/dynamic.cpp
+++ b/ADBC/examples/SQLite/dynamic/dynamic.cpp
@@ -51,17 +51,17 @@ int ACE_TMAIN (int argc, char * argv [])
query->execute_no_record (__INSERT_STMT__);
// Execute a query that has a record.
- ::ADBC::SQLite::Record * record = query->execute (__SELECT_STMT__);
+ ::ADBC::SQLite::Record & record = query->execute (__SELECT_STMT__);
// View the results of the query.
ACE_CString timeofday, firstname, middlename, surname;
- for ( ; !record->done (); record->advance ())
+ for ( ; !record.done (); record.advance ())
{
- record->get_data (1, timeofday);
- record->get_data (2, firstname);
- record->get_data (3, middlename);
- record->get_data (4, surname);
+ record.get_data (1, timeofday);
+ record.get_data (2, firstname);
+ record.get_data (3, middlename);
+ record.get_data (4, surname);
std::cout << timeofday << " - "
<< firstname << " " << middlename << " " << surname
diff --git a/ADBC/examples/SQLite/simple/simple.cpp b/ADBC/examples/SQLite/simple/simple.cpp
index 2c21036531e..5b5b77e1de1 100644
--- a/ADBC/examples/SQLite/simple/simple.cpp
+++ b/ADBC/examples/SQLite/simple/simple.cpp
@@ -45,17 +45,17 @@ int ACE_TMAIN (int argc, char * argv [])
query.execute_no_record (__INSERT_STMT__);
// Execute a query that has a record.
- ::ADBC::SQLite::Record * record = query.execute (__SELECT_STMT__);
+ ::ADBC::SQLite::Record & record = query.execute (__SELECT_STMT__);
// View the results of the query.
ACE_CString timeofday, firstname, middlename, surname;
- for ( ; !record->done (); record->advance ())
+ for ( ; !record.done (); record.dvance ())
{
- record->get_data (1, timeofday);
- record->get_data (2, firstname);
- record->get_data (3, middlename);
- record->get_data (4, surname);
+ record.get_data (1, timeofday);
+ record.get_data (2, firstname);
+ record.get_data (3, middlename);
+ record.get_data (4, surname);
std::cout << timeofday << " - "
<< firstname << " " << middlename << " " << surname