Home  /  RSS  /  RSS Comments  /  Enter

CppDB 0.0.2 Released

1/3/11, by artyom ; Posted in: Storage; 5 comments

New Features:

Bugs:

Comments

Stefan, at 6/15/11, 7:09 PM

Could you please add following snippet to cppdb::statement? I'm (re)using prepared statements for a longer period of time where it is not actual clear whether the statement is prepared already. Instead of catching the exceptions from ref_ptr (Attempt to access an empty object) I would prefer having this kind of query:

// class statement {

// public:

// [...]

    operator bool () const {
        return (stat_);
    }

// [...]

// };

artyom, at 6/15/11, 9:41 PM

I'm (re)using prepared statements for a longer period of time where it is not actual clear whether the statement is prepared already.

You do not have to keep a statement object with you all the time.

{
  // Prepared first time and cached
  cppdb::statement st = sql << "INSERT ..." << 10 
  st.exec()
}
{
  // Fetched from cache 2nd time.
  cppdb::statement st = sql << "INSERT ..." << 20 
  st.exec()
}

So don't keep them, this is what cppdb does for you automatically.

In any case I can add following functions:

bool empty() const;
void clear();

Similarly to thous of cppdb::result

Stefan, at 6/16/11, 11:33 AM

Inserting the mentioned methods would be great.

Reusing the statement from cppdb internals cache is not a solution for me. I'm using cppdb for my own ORM framework, where e.g. the INSERT statement fir type Customer should be created once and rebuilding this query would be really bad regarding performance. Or can I access the cached version via a key (int) which could be stored instead the whole statement for every type statically?

artyom, at 6/16/11, 11:59 AM

Inserting the mentioned methods would be great.

I can add them,

I'm using cppdb for my own ORM framework, where e.g. the INSERT statement fir type Customer should be created once and rebuilding this query would be really bad regarding performance.

I see, you mean creating original prepared statement content.

Or can I access the cached version via a key (int) which could be stored instead the whole statement for every type statically?

They key is not int. But the statement (text) itself.

So you can't you'll have to use your own cache,

artyom, at 6/16/11, 12:27 PM

@Stefan,

Take a version from SVN- revision 1815

Add Comment:

 
 the email would not displayed
 

You can write your messages using Markdown syntax.

You must enable JavaScript in order to post comments.

Pages

Categories