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)  

genQueryMS.cpp
Go to the documentation of this file.
1 
7 #include "genQuery.h"
8 #include "rsGenQuery.hpp"
9 #include "rcMisc.h"
10 #include "irods_re_structs.hpp"
11 
12 #include <unistd.h>
13 #include <sys/types.h>
14 #include <pwd.h>
15 
16 int _makeQuery( char *sel, char *cond, char **sql );
17 
48 int msiExecStrCondQuery( msParam_t* queryParam, msParam_t* genQueryOutParam, ruleExecInfo_t *rei ) {
49  genQueryInp_t genQueryInp;
50  int i;
51  genQueryOut_t *genQueryOut = NULL;
52  char *query;
53 
54  query = ( char * ) malloc( strlen( ( const char* )queryParam->inOutStruct ) + 10 + MAX_NAME_LEN * 8 );
55 
56  strcpy( query, ( const char* )queryParam->inOutStruct );
57 
58  memset( &genQueryInp, 0, sizeof( genQueryInp_t ) );
59  i = fillGenQueryInpFromStrCond( query, &genQueryInp );
60  free( query );
61  if ( i < 0 ) {
62  return i;
63  }
64  genQueryInp.maxRows = MAX_SQL_ROWS;
65  genQueryInp.continueInx = 0;
66 
67  i = rsGenQuery( rei->rsComm, &genQueryInp, &genQueryOut );
68  if ( i < 0 ) {
69  if ( i == CAT_NO_ROWS_FOUND ) {
70  genQueryOutParam->type = strdup( GenQueryOut_MS_T );
71  genQueryOut = ( genQueryOut_t * ) malloc( sizeof( genQueryOut_t ) );
72  memset( genQueryOut, 0, sizeof( genQueryOut_t ) );
73  genQueryOutParam->inOutStruct = genQueryOut;
74  return 0;
75  }
76  else {
77  return i;
78  }
79  }
80  genQueryOutParam->type = strdup( GenQueryOut_MS_T );
81  genQueryOutParam->inOutStruct = genQueryOut;
82  return 0;
83 }
84 
117 int msiExecGenQuery( msParam_t* genQueryInParam, msParam_t* genQueryOutParam, ruleExecInfo_t *rei ) {
118  genQueryInp_t *genQueryInp;
119  int i;
120  genQueryOut_t *genQueryOut = NULL;
121 
122 
123  genQueryInp = ( genQueryInp_t* )genQueryInParam->inOutStruct;
124 
125  i = rsGenQuery( rei->rsComm, genQueryInp, &genQueryOut );
126  if ( i < 0 ) {
127  if ( i == CAT_NO_ROWS_FOUND ) {
128  genQueryOutParam->type = strdup( GenQueryOut_MS_T );
129  genQueryOutParam->inOutStruct = genQueryOut;
130  return 0;
131  }
132  else {
133  freeGenQueryOut(&genQueryOut);
134  return i;
135  }
136  }
137  genQueryOutParam->type = strdup( GenQueryOut_MS_T );
138  genQueryOutParam->inOutStruct = genQueryOut;
139  return 0;
140 }
141 
142 
143 
176 int
177 msiGetContInxFromGenQueryOut( msParam_t* genQueryOutParam, msParam_t* continueInx, ruleExecInfo_t *rei ) {
178  genQueryOut_t *genQueryOut;
179 
180  RE_TEST_MACRO( " Calling msiGetContInxFromGenQueryOut" )
181  /* check for non null parameters */
182  if ( !genQueryOutParam ) {
183  rodsLog( LOG_ERROR, "msiGetContInxFromGenQueryOut: Missing parameter(s)" );
184  return USER__NULL_INPUT_ERR;
185  }
186  /* check for proper input types */
187  if ( strcmp( genQueryOutParam->type, GenQueryOut_MS_T ) ) {
189  "msiGetContInxFromGenQueryOut: genQueryOutParam type is %s, should be GenQueryOut_MS_T",
190  genQueryOutParam->type );
191  return USER_PARAM_TYPE_ERR;
192  }
193 
194  genQueryOut = ( genQueryOut_t* )genQueryOutParam->inOutStruct;
195  fillIntInMsParam( continueInx, genQueryOut->continueInx );
196  return 0;
197 }
198 
199 
200 int
201 _makeQuery( char *sel, char *cond, char **sql ) {
202  *sql = ( char * ) malloc( strlen( sel ) + strlen( cond ) + 20 );
203  if ( strlen( cond ) > 0 ) {
204  sprintf( *sql, "SELECT %s WHERE %s", sel, cond );
205  }
206  else {
207  sprintf( *sql, "SELECT %s ", sel );
208  }
209  return 0;
210 }
211 
243 int
244 msiMakeQuery( msParam_t* selectListParam, msParam_t* conditionsParam,
245  msParam_t* queryOutParam, ruleExecInfo_t* ) {
246  char *sql, *sel, *cond;
247  int i;
248  sel = ( char * ) selectListParam->inOutStruct;
249  cond = ( char * ) conditionsParam->inOutStruct;
250  i = _makeQuery( sel, cond, &sql );
251  queryOutParam->type = strdup( STR_MS_T );
252  queryOutParam->inOutStruct = sql;
253  return i;
254 }
255 
256 
257 
291 int
292 msiGetMoreRows( msParam_t *genQueryInp_msp, msParam_t *genQueryOut_msp, msParam_t *continueInx, ruleExecInfo_t *rei ) {
293  genQueryInp_t *genQueryInp;
294  genQueryOut_t *genQueryOut;
295 
296 
297  RE_TEST_MACRO( " Calling msiGetMoreRows" )
298 
299  if ( rei == NULL || rei->rsComm == NULL ) {
300  rodsLog( LOG_ERROR, "msiGetMoreRows: input rei or rsComm is NULL." );
302  }
303 
304 
305  /* check for non null parameters */
306  if ( !genQueryInp_msp || !genQueryOut_msp ) {
307  rodsLog( LOG_ERROR, "msiGetMoreRows: Missing parameter(s)" );
308  return USER__NULL_INPUT_ERR;
309  }
310 
311 
312  /* check for proper input types */
313  if ( strcmp( genQueryOut_msp->type, GenQueryOut_MS_T ) ) {
314  rodsLog( LOG_ERROR, "msiGetMoreRows: genQueryOut_msp type is %s, should be GenQueryOut_MS_T", genQueryOut_msp->type );
315  return USER_PARAM_TYPE_ERR;
316  }
317 
318  if ( strcmp( genQueryInp_msp->type, GenQueryInp_MS_T ) ) {
319  rodsLog( LOG_ERROR, "msiGetMoreRows: query_msp type is %s, should be GenQueryInp_MS_T", genQueryInp_msp->type );
320  return USER_PARAM_TYPE_ERR;
321  }
322 
323 
324  /* retrieve genQueryXXX data structures */
325  genQueryOut = ( genQueryOut_t* )genQueryOut_msp->inOutStruct;
326  genQueryInp = ( genQueryInp_t* )genQueryInp_msp->inOutStruct;
327 
328 
329  /* match continuation indexes */
330  genQueryInp->continueInx = genQueryOut->continueInx;
331 
332  if ( genQueryInp->continueInx > 0 ) {
333  /* get the next batch */
334  genQueryInp->maxRows = MAX_SQL_ROWS;
335  }
336  else {
337  /* close query */
338  genQueryInp->maxRows = -1;
339  }
340 
341 
342  /* free memory allocated for previous results */
343  freeGenQueryOut( &genQueryOut );
344 
345 
346  /* query */
347  rei->status = rsGenQuery( rei->rsComm, genQueryInp, &genQueryOut );
348 
349  /* return query results */
350  genQueryOut_msp->inOutStruct = genQueryOut;
351 
352  if ( rei->status == 0 || rei->status == CAT_NO_ROWS_FOUND) {
353  /* return continuation index separately in case it is needed in conditional expressions */
354  resetMsParam( continueInx );
355  fillIntInMsParam( continueInx, genQueryOut->continueInx );
356  rei->status = 0;
357  }
358 
359  return rei->status;
360 }
361 
362 
363 
394 int
395 msiCloseGenQuery( msParam_t *genQueryInp_msp, msParam_t *genQueryOut_msp, ruleExecInfo_t *rei ) {
396 
397  genQueryInp_t *genQueryInp;
398  genQueryOut_t *genQueryOut;
399 
400  RE_TEST_MACRO( " Calling msiCloseGenQuery" )
401 
402  if ( rei == NULL || rei->rsComm == NULL ) {
403  rodsLog( LOG_ERROR, "msiCloseGenQuery: input rei or rsComm is NULL." );
405  }
406 
407  /* check for non null parameters */
408  if ( genQueryInp_msp == NULL || genQueryOut_msp == NULL ) {
409  rodsLog( LOG_ERROR, "msiCloseGenQuery: Missing parameter(s)" );
410  return USER__NULL_INPUT_ERR;
411  }
412 
413  /* no double close */
414  if ( genQueryOut_msp->type == NULL ) {
415  return 0;
416  }
417 
418  /* check for proper input types */
419  if ( strcmp( genQueryOut_msp->type, GenQueryOut_MS_T ) ) {
420  rodsLog( LOG_ERROR, "msiCloseGenQuery: genQueryOut_msp type is %s, should be GenQueryOut_MS_T", genQueryOut_msp->type );
421  return USER_PARAM_TYPE_ERR;
422  }
423 
424  if ( strcmp( genQueryInp_msp->type, GenQueryInp_MS_T ) ) {
425  rodsLog( LOG_ERROR, "msiCloseGenQuery: query_msp type is %s, should be GenQueryInp_MS_T", genQueryInp_msp->type );
426  return USER_PARAM_TYPE_ERR;
427  }
428 
429  /* retrieve genQueryXXX data structures */
430  genQueryOut = ( genQueryOut_t* )genQueryOut_msp->inOutStruct;
431  genQueryInp = ( genQueryInp_t* )genQueryInp_msp->inOutStruct;
432 
433  /* set contiuation index so icat know which statement to free */
434  genQueryInp->continueInx = genQueryOut->continueInx;
435  genQueryInp->maxRows = -1;
436 
437  /* free memory allocated for previous results */
438  freeGenQueryOut( &genQueryOut );
439 
440  if ( genQueryInp->continueInx == 0 ) {
441  /* query already closed */
442  rei->status = 0;
443  return rei->status;
444  }
445 
446  /* close query */
447  rei->status = rsGenQuery( rei->rsComm, genQueryInp, &genQueryOut );
448 
449  /* free memory allocated */
450  freeGenQueryOut( &genQueryOut );
451 
452  if ( rei->status == 0 ) {
453  /* clear output parameter */
454  genQueryOut_msp->type = NULL;
455  genQueryOut_msp->inOutStruct = NULL;
456  }
457 
458  return rei->status;
459 }
460 
461 
462 
497 int
498 msiMakeGenQuery( msParam_t* selectListStr, msParam_t* condStr, msParam_t* genQueryInpParam, ruleExecInfo_t *rei ) {
499  char *sel, *cond, *rawQuery, *query;
500 
501 
502  RE_TEST_MACRO( " Calling msiMakeGenQuery" )
503 
504  if ( rei == NULL || rei->rsComm == NULL ) {
505  rodsLog( LOG_ERROR, "msiMakeGenQuery: input rei or rsComm is NULL." );
507  }
508 
509 
510  /* parse selectListStr */
511  if ( ( sel = parseMspForStr( selectListStr ) ) == NULL ) {
512  rodsLog( LOG_ERROR, "msiMakeGenQuery: input selectListStr is NULL." );
513  return USER__NULL_INPUT_ERR;
514  }
515 
516 
517  /* parse condStr */
518  if ( ( cond = parseMspForStr( condStr ) ) == NULL ) {
519  rodsLog( LOG_ERROR, "msiMakeGenQuery: input condStr is NULL." );
520  return USER__NULL_INPUT_ERR;
521  }
522 
523 
524  /* The code below is partly taken from msiMakeQuery and msiExecStrCondQuery. There may be a better way to do this. */
525 
526  /* Generate raw SQL query string */
527  rei->status = _makeQuery( sel, cond, &rawQuery );
528 
529  /* allocate more memory for query string with expanded variable names */
530  query = ( char * )malloc( strlen( rawQuery ) + 10 + MAX_NAME_LEN * 8 );
531  strcpy( query, rawQuery );
532 
533  /* allocate memory for genQueryInp */
534  genQueryInp_t * genQueryInp = ( genQueryInp_t* )malloc( sizeof( genQueryInp_t ) );
535  memset( genQueryInp, 0, sizeof( genQueryInp_t ) );
536 
537  /* set up GenQueryInp */
538  genQueryInp->maxRows = MAX_SQL_ROWS;
539  genQueryInp->continueInx = 0;
540  rei->status = fillGenQueryInpFromStrCond( query, genQueryInp );
541  if ( rei->status < 0 ) {
542  rodsLog( LOG_ERROR, "msiMakeGenQuery: fillGenQueryInpFromStrCond failed." );
543  freeGenQueryInp( &genQueryInp );
544  free( rawQuery ); // cppcheck - Memory leak: rawQuery
545  free( query );
546  return rei->status;
547  }
548 
549 
550  /* return genQueryInp through GenQueryInpParam */
551  genQueryInpParam->type = strdup( GenQueryInp_MS_T );
552  genQueryInpParam->inOutStruct = genQueryInp;
553 
554 
555  /* cleanup */
556  free( rawQuery );
557  free( query );
558 
559  return rei->status;
560 }
561 
562 
593 int
594 msiPrintGenQueryInp( msParam_t *where, msParam_t* genQueryInpParam, ruleExecInfo_t *rei ) {
595  genQueryInp_t *genQueryInp;
596  int i, j;
597  char *writeId;
598  char writeStr[MAX_NAME_LEN * 2];
599  int len;
600  int *ip1, *ip2;
601  char *cp;
602  char **cpp;
603 
604  RE_TEST_MACRO( " Calling msiPrintGenQueryInp" );
605 
606  if ( rei == NULL || rei->rsComm == NULL ) {
607  rodsLog( LOG_ERROR, "msiPrintGenQueryInp: input rei or rsComm is NULL." );
609  }
610  if ( !where ) {
611  rodsLog( LOG_ERROR, "msiPrintGenQueryInp: No destination provided for writing." );
612  return USER__NULL_INPUT_ERR;
613  }
614  /* where are we writing to? */
615  if ( where->inOutStruct != NULL ) {
616  writeId = ( char* )where->inOutStruct;
617  }
618  else {
619  writeId = where->label;
620  }
621 
622  /* genQueryInp = (genQueryInp_t *) strtol((char *)genQueryInpParam->inOutStruct,
623  (char **) NULL,0); */
624 
625  genQueryInp = ( genQueryInp_t * ) genQueryInpParam->inOutStruct;
626 
627 
628  /* print each selection pair to writeStr */
629  len = genQueryInp->selectInp.len;
630  ip1 = genQueryInp->selectInp.inx;
631  ip2 = genQueryInp->selectInp.value;
632  for ( i = 0; i < len; i++ ) {
633  sprintf( writeStr, "Selected Column %d With Option %d\n", *ip1, *ip2 );
634  j = _writeString( writeId, writeStr, rei );
635  if ( j < 0 ) {
636  return j;
637  }
638  ip1++;
639  ip2++;
640  }
641 
642  len = genQueryInp->sqlCondInp.len;
643  ip1 = genQueryInp->sqlCondInp.inx;
644  cpp = genQueryInp->sqlCondInp.value;
645  cp = *cpp;
646  for ( i = 0; i < len; i++ ) {
647  sprintf( writeStr, "Condition Column %d %s\n", *ip1, cp );
648  j = _writeString( writeId, writeStr, rei );
649  if ( j < 0 ) {
650  return j;
651  }
652  ip1++;
653  cpp++;
654  cp = *cpp;
655  }
656  return 0;
657 }
658 
659 
660 
698 int
699 msiAddSelectFieldToGenQuery( msParam_t *select, msParam_t *function, msParam_t *queryInput, ruleExecInfo_t *rei ) {
700  char *column_str;
701  int column_inx, function_inx;
702  genQueryInp_t *genQueryInp;
703 
704 
706  /* For testing mode when used with irule --test */
707  RE_TEST_MACRO( " Calling msiAddSelectFieldToGenQuery" )
708 
709  /* Sanity checks */
710  if ( rei == NULL || rei->rsComm == NULL ) {
711  rodsLog( LOG_ERROR, "msiAddSelectFieldToGenQuery: input rei or rsComm is NULL." );
713  }
714 
715 
716 
718  /* Parse select */
719  if ( ( column_str = parseMspForStr( select ) ) == NULL ) {
720  rodsLog( LOG_ERROR, "msiAddSelectFieldToGenQuery: input select is NULL." );
721  return USER__NULL_INPUT_ERR;
722  }
723 
724  /* Parse function and convert to index directly, getSelVal() returns 1 if string is NULL or empty. */
725  function_inx = getSelVal( parseMspForStr( function ) );
726 
727  /* Check for proper parameter type for queryInput */
728  if ( queryInput->type && strcmp( queryInput->type, GenQueryInp_MS_T ) ) {
729  rodsLog( LOG_ERROR, "msiAddSelectfieldToGenQuery: queryInput is not of type GenQueryInp_MS_T." );
730  return USER_PARAM_TYPE_ERR;
731  }
732 
733  /* Parse queryInput. Create new structure if empty. */
734  if ( !queryInput->inOutStruct ) {
735  /* Set content */
736  genQueryInp = ( genQueryInp_t* )malloc( sizeof( genQueryInp_t ) );
737  memset( genQueryInp, 0, sizeof( genQueryInp_t ) );
738  genQueryInp->maxRows = MAX_SQL_ROWS;
739  queryInput->inOutStruct = ( void* )genQueryInp;
740 
741  /* Set type */
742  if ( !queryInput->type ) {
743  queryInput->type = strdup( GenQueryInp_MS_T );
744  }
745  }
746  else {
747  genQueryInp = ( genQueryInp_t* )queryInput->inOutStruct;
748  }
749 
750 
751 
753  /* Get column index */
754  column_inx = getAttrIdFromAttrName( column_str );
755 
756  /* Error? */
757  if ( column_inx < 0 ) {
758  rodsLog( LOG_ERROR, "msiAddSelectfieldToGenQuery: Unable to get valid ICAT column index." );
759  return column_inx;
760  }
761 
762  /* Add column and function to genQueryInput */
763  addInxIval( &genQueryInp->selectInp, column_inx, function_inx );
764 
765 
766 
767  return 0;
768 }
769 
770 
807 int
809  genQueryInp_t *genQueryInp;
810  char condStr[MAX_NAME_LEN];
811  char *att_str, *op_str, *val_str;
812  int att_inx;
813 
814 
816  /* For testing mode when used with irule --test */
817  RE_TEST_MACRO( " Calling msiAddConditionToGenQuery" )
818 
819  /* Sanity checks */
820  if ( rei == NULL || rei->rsComm == NULL ) {
821  rodsLog( LOG_ERROR, "msiAddConditionToGenQuery: input rei or rsComm is NULL." );
823  }
824 
825 
826 
828  /* Parse attribute */
829  if ( ( att_str = parseMspForStr( attribute ) ) == NULL ) {
830  rodsLog( LOG_ERROR, "msiAddConditionToGenQuery: input attribute is NULL." );
831  return USER__NULL_INPUT_ERR;
832  }
833 
834  /* Parse operator */
835  if ( ( op_str = parseMspForStr( opr ) ) == NULL ) {
836  rodsLog( LOG_ERROR, "msiAddConditionToGenQuery: input opr is NULL." );
837  return USER__NULL_INPUT_ERR;
838  }
839 
840  /* Parse value */
841  if ( ( val_str = parseMspForStr( value ) ) == NULL ) {
842  rodsLog( LOG_ERROR, "msiAddConditionToGenQuery: input value is NULL." );
843  return USER__NULL_INPUT_ERR;
844  }
845 
846  /* Check for proper parameter type for queryInput */
847  if ( queryInput->type && strcmp( queryInput->type, GenQueryInp_MS_T ) ) {
848  rodsLog( LOG_ERROR, "msiAddConditionToGenQuery: queryInput is not of type GenQueryInp_MS_T." );
849  return USER_PARAM_TYPE_ERR;
850  }
851 
852  /* Parse queryInput. Must not be empty. */
853  if ( !queryInput->inOutStruct ) {
854  rodsLog( LOG_ERROR, "msiAddConditionToGenQuery: input queryInput is NULL." );
855  return USER__NULL_INPUT_ERR;
856  }
857  else {
858  genQueryInp = ( genQueryInp_t* )queryInput->inOutStruct;
859  }
860 
861 
862 
864  /* Get attribute index */
865  att_inx = getAttrIdFromAttrName( att_str );
866 
867  /* Error? */
868  if ( att_inx < 0 ) {
869  rodsLog( LOG_ERROR, "msiAddConditionToGenQuery: Unable to get valid ICAT column index." );
870  return att_inx;
871  }
872 
873  /* Make the condition */
874  snprintf( condStr, MAX_NAME_LEN, " %s '%s'", op_str, val_str );
875 
876  /* Add condition to genQueryInput */
877  addInxVal( &genQueryInp->sqlCondInp, att_inx, condStr ); /* condStr gets strdup'ed */
878 
879 
880 
881  return 0;
882 }
883 
884 
885 
918 int
920 
922  /* For testing mode when used with irule --test */
923  RE_TEST_MACRO( " Calling msiPrintGenQueryOutToBuffer" )
924 
925  /* Sanity checks */
926  if ( rei == NULL || rei->rsComm == NULL ) {
927  rodsLog( LOG_ERROR, "msiPrintGenQueryOutToBuffer: input rei or rsComm is NULL." );
929  }
930 
931 
933  /* Check for proper param type */
934  if ( !queryOut || !queryOut->inOutStruct || !queryOut->type || strcmp( queryOut->type, GenQueryOut_MS_T ) ) {
935  rodsLog( LOG_ERROR, "msiPrintGenQueryOutToBuffer: Invalid input for queryOut." );
936  return USER_PARAM_TYPE_ERR;
937  }
938  genQueryOut_t *genQueryOut = (genQueryOut_t*)queryOut->inOutStruct;
939 
940  /* Parse format */
941  char *format_str = parseMspForStr( format );
942 
943 
945  /* Let's use printGenQueryOut() here for the sake of consistency over efficiency (somewhat). It needs a stream. */
946  char filename[] = "/tmp/msiPrintGenQueryOutToBufferXXXXXX";
947  umask( S_IRUSR | S_IWUSR );
948  int fd = mkstemp( filename );
949  if ( fd < 0 ) { /* Since it won't be caught by printGenQueryOut */
950  rodsLog( LOG_ERROR, "msiPrintGenQueryOutToBuffer: mkstemp() failed. [%s] %d - %d", filename, fd, errno );
951  return ( FILE_OPEN_ERR ); /* accurate enough */
952  }
953  FILE *stream = fdopen( fd, "w" );
954  if ( !stream ) { /* Since it won't be caught by printGenQueryOut */
955  rodsLog( LOG_ERROR, "msiPrintGenQueryOutToBuffer: fdopen() failed." );
956  return ( FILE_OPEN_ERR ); /* accurate enough */
957  }
958 
959  /* Write results to temp file */
960  rei->status = printGenQueryOut( stream, format_str, NULL, genQueryOut );
961  if ( rei->status < 0 ) {
962  rodsLog( LOG_ERROR, "msiPrintGenQueryOutToBuffer: printGenQueryOut() failed, status = %d", rei->status );
963  fclose( stream );
964  return rei->status;
965  }
966 
967  /* bytesBuf init */
968  bytesBuf_t *bytesBuf = (bytesBuf_t*)malloc(sizeof(*bytesBuf));
969  memset( bytesBuf, 0, sizeof( *bytesBuf ) );
970 
971  /* Read from temp file and write to bytesBuf */
972  rewind( stream );
973  char readbuffer[MAX_NAME_LEN];
974  while ( fgets( readbuffer, sizeof(readbuffer), stream ) != NULL ) {
975  appendToByteBuf( bytesBuf, readbuffer );
976  }
977 
978 
979 
981  /* Free memory previously allocated for previous result batches (when used in loop). */
982  resetMsParam( buffer );
983 
984  /* Fill bytesBuf in our buffer output */
985  fillBufLenInMsParam( buffer, bytesBuf->len, bytesBuf );
986  fclose( stream );
987 
988  return 0;
989 
990 }
rodsLog
void rodsLog(int level, const char *formatStr,...)
Definition: rodsLog.cpp:86
MAX_SQL_ROWS
#define MAX_SQL_ROWS
Definition: rodsGenQuery.h:16
_makeQuery
int _makeQuery(char *sel, char *cond, char **sql)
Definition: genQueryMS.cpp:201
NULL
#define NULL
Definition: rodsDef.h:70
SYS_INTERNAL_NULL_INPUT_ERR
@ SYS_INTERNAL_NULL_INPUT_ERR
Definition: rodsErrorTable.h:92
GenQueryInp::continueInx
int continueInx
Definition: rodsGenQuery.h:28
GenQueryInp_MS_T
#define GenQueryInp_MS_T
Definition: msParam.h:46
_writeString
int _writeString(char *writeId, char *writeStr, ruleExecInfo_t *rei)
Definition: irods_re_structs.cpp:278
RuleExecInfo::status
int status
Definition: irods_re_structs.hpp:19
fillBufLenInMsParam
void fillBufLenInMsParam(msParam_t *msParam, int myInt, bytesBuf_t *bytesBuf)
Definition: msParam.cpp:287
GenQueryInp
Definition: rodsGenQuery.h:24
rcMisc.h
freeGenQueryInp
int freeGenQueryInp(genQueryInp_t **genQueryInp)
Definition: rcMisc.cpp:1101
parseMspForStr
char * parseMspForStr(msParam_t *inpParam)
Definition: msParam.cpp:893
InxIvalPair::len
int len
Definition: objInfo.h:206
InxValPair::inx
int * inx
Definition: objInfo.h:215
addInxVal
int addInxVal(inxValPair_t *inxValPair, int inx, const char *value)
Definition: rcMisc.cpp:921
LOG_ERROR
#define LOG_ERROR
Definition: rodsLog.h:43
msiMakeGenQuery
int msiMakeGenQuery(msParam_t *selectListStr, msParam_t *condStr, msParam_t *genQueryInpParam, ruleExecInfo_t *rei)
Definition: genQueryMS.cpp:498
MsParam::type
char * type
Definition: msParam.h:78
GenQueryInp::selectInp
inxIvalPair_t selectInp
Definition: rodsGenQuery.h:53
GenQueryInp::maxRows
int maxRows
Definition: rodsGenQuery.h:25
STR_MS_T
#define STR_MS_T
Definition: msParam.h:21
InxValPair::value
char ** value
Definition: objInfo.h:216
RuleExecInfo::rsComm
rsComm_t * rsComm
Definition: irods_re_structs.hpp:22
BytesBuf::len
int len
Definition: rodsDef.h:198
GenQueryOut_MS_T
#define GenQueryOut_MS_T
Definition: msParam.h:47
msiGetContInxFromGenQueryOut
int msiGetContInxFromGenQueryOut(msParam_t *genQueryOutParam, msParam_t *continueInx, ruleExecInfo_t *rei)
Definition: genQueryMS.cpp:177
msiExecGenQuery
int msiExecGenQuery(msParam_t *genQueryInParam, msParam_t *genQueryOutParam, ruleExecInfo_t *rei)
Definition: genQueryMS.cpp:117
msiCloseGenQuery
int msiCloseGenQuery(msParam_t *genQueryInp_msp, msParam_t *genQueryOut_msp, ruleExecInfo_t *rei)
Definition: genQueryMS.cpp:395
GenQueryOut::continueInx
int continueInx
Definition: rodsGenQuery.h:70
getSelVal
int getSelVal(char *c)
Definition: rcMisc.cpp:2792
msiMakeQuery
int msiMakeQuery(msParam_t *selectListParam, msParam_t *conditionsParam, msParam_t *queryOutParam, ruleExecInfo_t *)
Definition: genQueryMS.cpp:244
appendToByteBuf
int appendToByteBuf(bytesBuf_t *bytesBuf, char *str)
Definition: rcMisc.cpp:3048
InxIvalPair::inx
int * inx
Definition: objInfo.h:207
GenQueryInp::sqlCondInp
inxValPair_t sqlCondInp
Definition: rodsGenQuery.h:56
genQuery.h
MAX_NAME_LEN
#define MAX_NAME_LEN
Definition: rodsDef.h:61
addInxIval
int addInxIval(inxIvalPair_t *inxIvalPair, int inx, int value)
Definition: rcMisc.cpp:883
irods.pypyodbc.buffer
buffer
Definition: pypyodbc.py:46
msiAddConditionToGenQuery
int msiAddConditionToGenQuery(msParam_t *attribute, msParam_t *opr, msParam_t *value, msParam_t *queryInput, ruleExecInfo_t *rei)
Definition: genQueryMS.cpp:808
GenQueryOut
Definition: rodsGenQuery.h:67
get_irods_version.value
dictionary value
Definition: get_irods_version.py:27
MsParam
Definition: msParam.h:76
printGenQueryOut
int printGenQueryOut(FILE *fd, char *format, char *hint, genQueryOut_t *genQueryOut)
Definition: rcMisc.cpp:3001
msiPrintGenQueryOutToBuffer
int msiPrintGenQueryOutToBuffer(msParam_t *queryOut, msParam_t *format, msParam_t *buffer, ruleExecInfo_t *rei)
Definition: genQueryMS.cpp:919
InxIvalPair::value
int * value
Definition: objInfo.h:208
BytesBuf
Definition: rodsDef.h:197
InxValPair::len
int len
Definition: objInfo.h:214
MsParam::label
char * label
Definition: msParam.h:77
USER_PARAM_TYPE_ERR
@ USER_PARAM_TYPE_ERR
Definition: rodsErrorTable.h:254
resetMsParam
int resetMsParam(msParam_t *msParam)
Definition: msParam.cpp:491
CAT_NO_ROWS_FOUND
@ CAT_NO_ROWS_FOUND
Definition: rodsErrorTable.h:423
RuleExecInfo
Definition: irods_re_structs.hpp:18
irods_re_structs.hpp
RE_TEST_MACRO
#define RE_TEST_MACRO(msg)
Definition: reDefines.h:58
FILE_OPEN_ERR
@ FILE_OPEN_ERR
Definition: rodsErrorTable.h:494
fillIntInMsParam
void fillIntInMsParam(msParam_t *msParam, const int myInt)
Definition: msParam.cpp:242
rsGenQuery.hpp
MsParam::inOutStruct
void * inOutStruct
Definition: msParam.h:80
msiExecStrCondQuery
int msiExecStrCondQuery(msParam_t *queryParam, msParam_t *genQueryOutParam, ruleExecInfo_t *rei)
Definition: genQueryMS.cpp:48
msiPrintGenQueryInp
int msiPrintGenQueryInp(msParam_t *where, msParam_t *genQueryInpParam, ruleExecInfo_t *rei)
Definition: genQueryMS.cpp:594
getAttrIdFromAttrName
int getAttrIdFromAttrName(char *cname)
Definition: rcMisc.cpp:2751
freeGenQueryOut
int freeGenQueryOut(genQueryOut_t **genQueryOut)
Definition: rcMisc.cpp:1133
rsGenQuery
int rsGenQuery(rsComm_t *rsComm, genQueryInp_t *genQueryInp, genQueryOut_t **genQueryOut)
Definition: rsGenQuery.cpp:604
fillGenQueryInpFromStrCond
int fillGenQueryInpFromStrCond(char *str, genQueryInp_t *genQueryInp)
Definition: rcMisc.cpp:2921
msiAddSelectFieldToGenQuery
int msiAddSelectFieldToGenQuery(msParam_t *select, msParam_t *function, msParam_t *queryInput, ruleExecInfo_t *rei)
Definition: genQueryMS.cpp:699
USER__NULL_INPUT_ERR
@ USER__NULL_INPUT_ERR
Definition: rodsErrorTable.h:247
msiGetMoreRows
int msiGetMoreRows(msParam_t *genQueryInp_msp, msParam_t *genQueryOut_msp, msParam_t *continueInx, ruleExecInfo_t *rei)
Definition: genQueryMS.cpp:292