Table.cxx

Go to the documentation of this file.
00001 // -*- mode: C++ -*- 
00002 //
00003 // Copyright (C) 2006 Christian Holm Christensen <cholm@nbi.dk>
00004 //
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public License
00007 // as published by the Free Software Foundation; either version 2.1
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the Free
00017 // Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018 // 02111-1307 USA
00019 //
00025 #include "Table.h"
00026 #include "Sequence.h"
00027 #include <rcudb/Server.h>
00028 #include <rcudb/Sql.h>
00029 #include <rcudb/Row.h>
00030 #include <iostream>
00031 
00032 
00033 //_____________________________________________________________________
00034 RcuConf::Table::Table(RcuDb::Row& row)
00035 {
00036   row.Field(0, fId);
00037 }
00038 
00039 
00040 //_____________________________________________________________________
00041 bool
00042 RcuConf::Table::MakeId(RcuDb::Server& server) 
00043 {
00044   // Get a unique ID from the sequence table 
00045   fId = RcuConf::Sequence::Increment(server);
00046   if (fId < 0) return false;
00047   return true;
00048 }
00049 
00050 
00051 //_____________________________________________________________________
00052 bool
00053 RcuConf::Table::Drop(RcuDb::Server& server, const std::string& table) 
00054 {
00055   RcuDb::Sql sql;
00056   sql << "DROP TABLE " << table;
00057   return server.Exec(sql);
00058 }
00059 
00060 //_____________________________________________________________________
00061 //
00062 // EOF
00063 //
00064 
00065 
00066   
00067 
00068   
Top of page Last update Fri Apr 27 01:54:16 2007
Copyright © 2004 Christian Holm Created by DoxyGen 1.3.5