OKlibrary  0.2.1.6
Special_update.cpp
Go to the documentation of this file.
00001 // Oliver Kullmann, 28.6.2002 (Swansea)
00002 /* Copyright 2002 - 2007 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007 
00008 #include <string>
00009 
00010 #include <OKlib/General/DatabaseHandler01.hpp>
00011 #include <OKlib/General/StringHandling.hpp>
00012 
00013 using namespace std;
00014 
00015 const string database = "OKRandGen";
00016 
00017 const int start = 1400001;
00018 const int end = 5000000;
00019 const int jump = 1000;
00020 
00021 const string update = "update bcls_info set an = (select an from b_measures where b_measures.b_info_id = bcls_info.b_info_id)";
00022 const string counter_field = "b_info_id";
00023 
00024 int main() {
00025 
00026   using namespace DatabaseHandler01;
00027   using namespace StringHandling;
00028 
00029   Connection Conn(database);
00030   Command C(Conn);
00031 
00032   const string update_query_0 = update + " where " + counter_field + " >= ";
00033   const string update_query_1 = " and " + counter_field + " < ";
00034 
00035   for (int i = start; i <= end; i += jump) {
00036     C.issue(update_query_0 + toString(i) + update_query_1 + toString(i + jump) + ";");
00037     if (C.changed_tuples() != jump)
00038       break;
00039   }
00040 
00041   return 0;
00042 
00043 }
00044 
00045