00001 #ifndef Impala_Util_DatabaseWriteString_h
00002 #define Impala_Util_DatabaseWriteString_h
00003
00004 #include "Util/Database.h"
00005
00006 namespace Impala
00007 {
00008 namespace Util
00009 {
00010
00011 #ifndef REPOSITORY_USED // Here comes the deprecated stuff
00012
00013 template <class Iterator>
00014 bool
00015 DatabaseWriteString(IOBuffer* buf, Iterator begin, Iterator end, int count = -1)
00016 {
00017 if (! (buf && buf->Valid()))
00018 {
00019 return false;
00020 }
00021 int c=0;
00022 for (Iterator it=begin ; it!=end ; it++)
00023 {
00024 String s = *it;
00025 buf->Puts(s);
00026 if (++c == count)
00027 break;
00028 }
00029 return true;
00030 }
00031
00032 template <class Iterator>
00033 bool
00034 DatabaseWriteString(String fileName, Database* db, Iterator begin, Iterator end,
00035 int count = -1)
00036 {
00037 IOBuffer* buf = db->GetIOBuffer(fileName, false, false, "tmp");
00038
00039 bool ret = DatabaseWriteString(buf, begin, end, count);
00040
00041 delete buf;
00042 return ret;
00043 }
00044 #endif // REPOSITORY_USED
00045
00046
00047 }
00048 }
00049
00050 #endif