irods  4.2.8
About: iRODS (the integrated Rule Oriented Data System) is a distributed data-management system for creating data grids, digital libraries, persistent archives, and real-time data systems.
  Fossies Dox: irods-4.2.8.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

rsSimpleQuery.cpp
Go to the documentation of this file.
1 
3 /* This is script-generated code (for the most part). */
4 /* See simpleQuery.h for a description of this API call.*/
5 
6 #include "simpleQuery.h"
7 #include "rodsConnect.h"
9 #include "miscServerFunct.hpp"
11 #include "rsSimpleQuery.hpp"
12 
13 int
14 rsSimpleQuery( rsComm_t *rsComm, simpleQueryInp_t *simpleQueryInp,
15  simpleQueryOut_t **simpleQueryOut ) {
17  int status;
18 
19  status = getAndConnRcatHost( rsComm, MASTER_RCAT, ( const char* )NULL, &rodsServerHost );
20  if ( status < 0 ) {
21  return status;
22  }
23 
25  std::string svc_role;
26  irods::error ret = get_catalog_service_role(svc_role);
27  if(!ret.ok()) {
28  irods::log(PASS(ret));
29  return ret.code();
30  }
31 
32  if( irods::CFG_SERVICE_ROLE_PROVIDER == svc_role ) {
33  status = _rsSimpleQuery( rsComm, simpleQueryInp, simpleQueryOut );
34  } else if( irods::CFG_SERVICE_ROLE_CONSUMER == svc_role ) {
36  } else {
37  rodsLog(
38  LOG_ERROR,
39  "role not supported [%s]",
40  svc_role.c_str() );
42  }
43  }
44  else {
46  simpleQueryInp, simpleQueryOut );
47  }
48 
49  if ( status < 0 && status != CAT_NO_ROWS_FOUND ) {
51  "rsSimpleQuery: rcSimpleQuery failed, status = %d", status );
52  }
53  return status;
54 }
55 
56 int
57 _rsSimpleQuery( rsComm_t *rsComm, simpleQueryInp_t *simpleQueryInp,
58  simpleQueryOut_t **simpleQueryOut ) {
59  int status;
60 
61  int control;
62 
63  int maxBufSize;
64  char *outBuf;
65 
66  simpleQueryOut_t *myQueryOut;
67 
68  control = simpleQueryInp->control;
69 
70  maxBufSize = simpleQueryInp->maxBufSize;
71 
72  outBuf = ( char* )malloc( maxBufSize );
73 
74  status = chlSimpleQuery( rsComm, simpleQueryInp->sql,
75  simpleQueryInp->arg1,
76  simpleQueryInp->arg2,
77  simpleQueryInp->arg3,
78  simpleQueryInp->arg4,
79  simpleQueryInp->form,
80  &control, outBuf, maxBufSize );
81  if ( status < 0 ) {
82  if ( status != CAT_NO_ROWS_FOUND ) {
84  "_rsSimpleQuery: simpleQuery for %s, status = %d",
85  simpleQueryInp->sql, status );
86  }
87  return status;
88  }
89 
90  myQueryOut = ( simpleQueryOut_t* )malloc( sizeof( simpleQueryOut_t ) );
91  myQueryOut->control = control;
92  myQueryOut->outBuf = outBuf;
93 
94  *simpleQueryOut = myQueryOut;
95 
96  return status;
97 }
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
NULL
#define NULL
Definition: rodsDef.h:70
rsComm_t
Definition: rcConnect.h:145
irods::CFG_SERVICE_ROLE_CONSUMER
const std::string CFG_SERVICE_ROLE_CONSUMER("consumer")
irods_configuration_keywords.hpp
rodsServerHost::localFlag
int localFlag
Definition: rodsConnect.h:68
rsSimpleQuery.hpp
SYS_SERVICE_ROLE_NOT_SUPPORTED
@ SYS_SERVICE_ROLE_NOT_SUPPORTED
Definition: rodsErrorTable.h:217
rodsServerHost::conn
rcComm_t * conn
Definition: rodsConnect.h:64
PASS
#define PASS(prev_error_)
Definition: irods_error.hpp:118
simpleQueryOut_t::control
int control
Definition: simpleQuery.h:19
LOCAL_HOST
#define LOCAL_HOST
Definition: rodsConnect.h:44
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
rodsConnect.h
simpleQueryOut_t
Definition: simpleQuery.h:18
simpleQueryInp_t::arg2
char * arg2
Definition: simpleQuery.h:9
irods::error::code
long long code() const
Definition: irods_error.cpp:194
simpleQueryInp_t::maxBufSize
int maxBufSize
Definition: simpleQuery.h:14
simpleQueryOut_t::outBuf
char * outBuf
Definition: simpleQuery.h:20
irods::CFG_SERVICE_ROLE_PROVIDER
const std::string CFG_SERVICE_ROLE_PROVIDER("provider")
simpleQueryInp_t::form
int form
Definition: simpleQuery.h:13
SYS_NO_RCAT_SERVER_ERR
@ SYS_NO_RCAT_SERVER_ERR
Definition: rodsErrorTable.h:110
simpleQueryInp_t::arg3
char * arg3
Definition: simpleQuery.h:10
irods.pypyodbc.status
status
Definition: pypyodbc.py:467
irods::log
void log(const error &)
Definition: irods_log.cpp:13
LOG_NOTICE
#define LOG_NOTICE
Definition: rodsLog.h:33
irods::error
Definition: irods_error.hpp:23
miscServerFunct.hpp
simpleQuery.h
_rsSimpleQuery
int _rsSimpleQuery(rsComm_t *rsComm, simpleQueryInp_t *simpleQueryInp, simpleQueryOut_t **simpleQueryOut)
Definition: rsSimpleQuery.cpp:57
getAndConnRcatHost
int getAndConnRcatHost(rsComm_t *rsComm, int rcatType, const char *rcatZoneHint, rodsServerHost_t **rodsServerHost)
Definition: rodsConnect.cpp:26
terminate_irods_processes.control
control
Definition: terminate_irods_processes.py:16
MASTER_RCAT
#define MASTER_RCAT
Definition: rodsDef.h:85
get_catalog_service_role
irods::error get_catalog_service_role(std::string &_role)
Definition: miscServerFunct.cpp:3153
rodsServerHost
Definition: rodsConnect.h:62
CAT_NO_ROWS_FOUND
@ CAT_NO_ROWS_FOUND
Definition: rodsErrorTable.h:423
rcSimpleQuery
int rcSimpleQuery(rcComm_t *conn, simpleQueryInp_t *simpleQueryInp, simpleQueryOut_t **simpleQueryOut)
Definition: rcSimpleQuery.cpp:47
icatHighLevelRoutines.hpp
simpleQueryInp_t
Definition: simpleQuery.h:6
irods::error::ok
bool ok()
Definition: irods_error.cpp:258
simpleQueryInp_t::arg4
char * arg4
Definition: simpleQuery.h:11
simpleQueryInp_t::control
int control
Definition: simpleQuery.h:12
simpleQueryInp_t::sql
char * sql
Definition: simpleQuery.h:7
rsSimpleQuery
int rsSimpleQuery(rsComm_t *rsComm, simpleQueryInp_t *simpleQueryInp, simpleQueryOut_t **simpleQueryOut)
Definition: rsSimpleQuery.cpp:14
chlSimpleQuery
int chlSimpleQuery(rsComm_t *rsComm, const char *sql, const char *arg1, const char *arg2, const char *arg3, const char *arg4, int format, int *control, char *outBuf, int maxOutBuf)
Definition: icatHighLevelRoutines.cpp:1699
simpleQueryInp_t::arg1
char * arg1
Definition: simpleQuery.h:8