GDBMS 1.0
GDBMS_for_documentation/transaction_mode_commands.cpp
Go to the documentation of this file.
00001 #include "maininclude.h"
00002 #include "listi.h"
00003 #include "settings.h"
00004 #include "hash_table.h"
00005 #include "tr_twin_ht.h"
00006 #include "file_semaphore.h"
00007 #include "some_functions.h"
00008 #include "initial_mode_commands.h"
00009 #include "session_mode_commands.h"
00010 #include "transaction_mode_commands.h"
00011 #include "transaction_mode_commands_types.h"
00012 #include "transaction_mode_commands_nodes.h"
00013 #include "transaction_mode_commands_edges.h"
00014 #include "transaction_mode_commands_find.h"
00015 using namespace std;
00016 int transaction_mode_commands::CloseTransaction(int transaction_USCOREid, ns1__CloseTransactionResponse& _param_13)
00017 {
00018     char *grphidstr=0;
00019   char *tridstr=0;
00020   tridstr=inttostr(transaction_USCOREid);
00021   grphidstr=settings::getGraphfromTransaction(tridstr);
00022   if(grphidstr&&tridstr){
00023     string trfolder;
00024   
00025     trfolder+="admin/";
00026     trfolder+=grphidstr;
00027     trfolder+="/";
00028     trfolder+=tridstr;
00029     string cmd;
00030     
00031   
00032     string edgfolder;
00033     edgfolder+=trfolder;
00034     edgfolder+="/edges";
00035   
00036     string nodefolder;
00037     nodefolder=trfolder;
00038     nodefolder+="/nodes";
00039   
00040   
00041     string grfolder;
00042     grfolder+="admin/";
00043     grfolder+=grphidstr;
00044     
00045     
00046     string realedges_folder;
00047     realedges_folder+=grfolder;
00048     realedges_folder+="/edges";
00049   
00050     string realnodes_folder;
00051     realnodes_folder+=grfolder;
00052     realnodes_folder+="/nodes";
00053     
00054     hash_table trn("transactions", "admin/transactions", "id;user_id;graph_id;time_started", "id;user_id;graph_id", "id");
00055     
00056     
00057     hash_table real_edges("edges", realedges_folder.c_str(), "id;name;data;inodes;onodes;type_id;tr_id", "id;name;inodes;onodes;type_id;tr_id", "id");
00058     hash_table real_nodes("nodes", realnodes_folder.c_str(), "id;name;data;iedges;oedges;type_id;tr_id", "id;name;iedges;oedges;type_id;tr_id", "id");
00059   
00060     tr_twin_ht edgtwin("edges", edgfolder.c_str(), "id;name;data;inodes;onodes;type_id;tr_id", "id;name;inodes;onodes;type_id;tr_id", "id", transaction_USCOREid, edgfolder.c_str(), &real_edges);
00061     tr_twin_ht nodtwin("nodes", nodefolder.c_str(), "id;name;data;iedges;oedges;type_id;tr_id", "id;name;iedges;oedges;type_id;tr_id", "id", transaction_USCOREid, nodefolder.c_str(), &real_nodes);
00062     
00063     
00064     
00065     
00066     file_semaphore ssem("admin/transactions/ssem");
00067     ssem.getResource();
00068     edgtwin.end_transaction(&nodtwin, "inodes", "onodes");
00069     nodtwin.end_transaction(&edgtwin, "iedges", "oedges");
00070     //changewithrealconnections
00071     edgtwin.changewithrealconnections(&nodtwin, "inodes", "onodes");
00072     nodtwin.changewithrealconnections(&edgtwin, "iedges", "oedges");
00073     
00074     //erase transaction folders
00075     edgtwin.deletetransfolder();
00076     nodtwin.deletetransfolder();
00077     char *buf1=inttostr(transaction_USCOREid);
00078     trn.DeleteRecord("id", buf1);
00079     delete buf1;
00080     ssem.freeResource();
00081     
00082    _param_13.retvalue=0;
00083    
00084     
00085     delete grphidstr;
00086     delete tridstr;
00087   }else{
00088     _param_13.retvalue=3;
00089   }
00090   return 0;
00091 }
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines