Debea Library 1.4.2

genericfetcher.h

00001 // File: genericfetcher.h
00002 // Purpose: SQLIdFetcher generic implementation
00003 // Author: Lukasz Michalski <lm at zork.pl>, Copyright 2003
00004 // License: See COPYING file that comes with this distribution
00005 //
00006 // This file is a part of debea library (http://debea.net)
00007
00008
00009 #ifndef DBAGENERICFETCHER_H
00010 #define DBAGENERICFETCHER_H
00011 
00012 #include "dba/sqlidfetcher.h"
00013 #include "dba/sqlarchive.h"
00014 #include <memory>
00015
00016 namespace dba {
00017
00023 class dbaDLLEXPORT GenericFetcher : public dba::SQLIdFetcher {
00024   public:
00025     GenericFetcher();
00026     virtual int getNextId(dba::DbConnection& pConn, const char*) {
00027       std::auto_ptr<dba::DbResult> res(pConn.sendQuery("SELECT id FROM debea_object_count"));
00028       if (!res->fetchRow())
00029         throw dba::DataException("Unable to allocate next object id");
00030       int id = res->getInt(0);
00031       res.reset();
00032       pConn.sendUpdate("UPDATE debea_object_count SET id = id + 1");
00033       return id;
00034     };
00035     virtual ~GenericFetcher();
00036 };
00037
00038 };//namespace
00039
00040
00041 #endif

Documentation
Quick start
Examples

API Documentation
Class hierarchy
Member index
API Reference
Store filters
Store table macros
Back

Generated by doxygen at Fri Oct 22 23:15:38 2010