本文整理汇总了C++中freeGenQueryOut函数的典型用法代码示例。如果您正苦于以下问题:C++ freeGenQueryOut函数的具体用法?C++ freeGenQueryOut怎么用?C++ freeGenQueryOut使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了freeGenQueryOut函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: getUserId
int
getUserId( rsComm_t *rsComm, char *userName, char *zoneName ) {
genQueryInp_t genQueryInp;
genQueryOut_t *genQueryOut = NULL;
char tmpStr[MAX_NAME_LEN];
char tmpStr2[MAX_NAME_LEN];
int status;
memset( &genQueryInp, 0, sizeof( genQueryInp_t ) );
snprintf( tmpStr, NAME_LEN, "='%s'", userName );
snprintf( tmpStr2, NAME_LEN, "='%s'", zoneName );
addInxVal( &genQueryInp.sqlCondInp, COL_USER_NAME, tmpStr );
addInxVal( &genQueryInp.sqlCondInp, COL_USER_ZONE, tmpStr2 );
addInxIval( &genQueryInp.selectInp, COL_USER_ID, 1 );
genQueryInp.maxRows = 2;
status = rsGenQuery( rsComm, &genQueryInp, &genQueryOut );
clearGenQueryInp( &genQueryInp );
if ( status >= 0 ) {
sqlResult_t *userIdRes;
if ( ( userIdRes = getSqlResultByInx( genQueryOut, COL_USER_ID ) ) ==
NULL ) {
rodsLog( LOG_ERROR,
"getUserId: getSqlResultByInx for COL_USER_ID failed" );
freeGenQueryOut( &genQueryOut );
return UNMATCHED_KEY_OR_INDEX;
}
status = atoi( userIdRes->value );
freeGenQueryOut( &genQueryOut );
}
return status;
}
开发者ID:bpow,项目名称:irods,代码行数:33,代码来源:objMetaOpr.cpp
示例2: printCollInheritance
int
printCollInheritance( rcComm_t *conn, char *collName ) {
genQueryOut_t *genQueryOut = NULL;
int status;
sqlResult_t *inheritResult;
char *inheritStr;
status = queryCollInheritance( conn, collName, &genQueryOut );
if ( status < 0 ) {
freeGenQueryOut( &genQueryOut );
return status;
}
if ( ( inheritResult = getSqlResultByInx( genQueryOut, COL_COLL_INHERITANCE ) ) == NULL ) {
rodsLog( LOG_ERROR,
"printCollInheritance: getSqlResultByInx for COL_COLL_INHERITANCE failed" );
freeGenQueryOut( &genQueryOut );
return UNMATCHED_KEY_OR_INDEX;
}
inheritStr = &inheritResult->value[0];
printf( " Inheritance - " );
if ( *inheritStr == '1' ) {
printf( "Enabled\n" );
}
else {
printf( "Disabled\n" );
}
freeGenQueryOut( &genQueryOut );
return status;
}
开发者ID:javenwu,项目名称:irods,代码行数:34,代码来源:lsUtil.cpp
示例3: getTokenId
int
getTokenId(rsComm_t *rsComm, char *tokenNameSpace, char *tokenName)
{
genQueryInp_t genQueryInp;
genQueryOut_t *genQueryOut = NULL;
char tmpStr[MAX_NAME_LEN];
char tmpStr2[MAX_NAME_LEN];
int status;
memset (&genQueryInp, 0, sizeof (genQueryInp_t));
snprintf (tmpStr, NAME_LEN, "='%s'", tokenNameSpace);
snprintf (tmpStr2, NAME_LEN, "='%s'", tokenName);
addInxVal (&genQueryInp.sqlCondInp, COL_TOKEN_NAMESPACE, tmpStr);
addInxVal (&genQueryInp.sqlCondInp, COL_TOKEN_NAME, tmpStr2);
addInxIval (&genQueryInp.selectInp, COL_TOKEN_ID, 1);
genQueryInp.maxRows = 2;
status = rsGenQuery (rsComm, &genQueryInp, &genQueryOut);
clearGenQueryInp (&genQueryInp);
if (status >= 0) {
sqlResult_t *tokenIdRes;
if ((tokenIdRes = getSqlResultByInx (genQueryOut, COL_TOKEN_ID)) ==
NULL) {
rodsLog (LOG_ERROR,
"getTokenId: getSqlResultByInx for COL_TOKEN_ID failed");
freeGenQueryOut (&genQueryOut);
return (UNMATCHED_KEY_OR_INDEX);
}
status = atoi(tokenIdRes->value);
freeGenQueryOut (&genQueryOut);
}
return(status);
}
开发者ID:DICE-UNC,项目名称:iRODS-FUSE-Mod,代码行数:34,代码来源:objMetaOpr.c
示例4: checkDupReplica
/* checkDupReplica - Check if a given object with a given rescName
* and physical path already exist. If it does, returns the replNum.
* JMC - backport 4497 */
int
checkDupReplica( rsComm_t *rsComm, rodsLong_t dataId, char *rescName,
char *filePath ) {
genQueryInp_t genQueryInp;
genQueryOut_t *genQueryOut = NULL;
char tmpStr[MAX_NAME_LEN];
int status;
if ( rsComm == NULL || rescName == NULL || filePath == NULL ) {
return USER__NULL_INPUT_ERR;
}
bzero( &genQueryInp, sizeof( genQueryInp_t ) );
rodsLong_t resc_id;
irods::error ret = resc_mgr.hier_to_leaf_id(rescName,resc_id);
if(!ret.ok()) {
irods::log(PASS(ret));
return ret.code();
}
std::string resc_id_str = boost::lexical_cast<std::string>(resc_id);
snprintf( tmpStr, MAX_NAME_LEN, "='%s'", resc_id_str.c_str() );
addInxVal( &genQueryInp.sqlCondInp, COL_D_RESC_ID, tmpStr );
snprintf( tmpStr, MAX_NAME_LEN, "='%s'", filePath );
addInxVal( &genQueryInp.sqlCondInp, COL_D_DATA_PATH, tmpStr );
snprintf( tmpStr, MAX_NAME_LEN, "='%lld'", dataId );
addInxVal( &genQueryInp.sqlCondInp, COL_D_DATA_ID, tmpStr );
addInxIval( &genQueryInp.selectInp, COL_DATA_REPL_NUM, 1 );
genQueryInp.maxRows = 2;
status = rsGenQuery( rsComm, &genQueryInp, &genQueryOut );
clearGenQueryInp( &genQueryInp );
if ( status >= 0 ) {
int intReplNum;
sqlResult_t *replNum;
if ( ( replNum = getSqlResultByInx( genQueryOut, COL_DATA_REPL_NUM ) ) ==
NULL ) {
freeGenQueryOut( &genQueryOut );
rodsLog( LOG_ERROR,
"checkDupReplica: getSqlResultByInx COL_DATA_REPL_NUM failed" );
return UNMATCHED_KEY_OR_INDEX;
}
intReplNum = atoi( replNum->value );
freeGenQueryOut( &genQueryOut );
return intReplNum;
}
else {
freeGenQueryOut( &genQueryOut );
return status;
}
}
开发者ID:QuarkDoe,项目名称:irods,代码行数:56,代码来源:objMetaOpr.cpp
示例5: isData
int
isData(rsComm_t *rsComm, char *objName, rodsLong_t *dataId) {
char logicalEndName[MAX_NAME_LEN]{};
char logicalParentDirName[MAX_NAME_LEN]{};
auto status{splitPathByKey(objName, logicalParentDirName, MAX_NAME_LEN, logicalEndName, MAX_NAME_LEN, '/')};
if (status < 0) {
const auto err{ERROR(status,
(boost::format("splitPathByKey failed for [%s]") %
objName).str().c_str())};
irods::log(err);
return err.code();
}
genQueryInp_t genQueryInp{};
genQueryOut_t *genQueryOut{};
char tmpStr[MAX_NAME_LEN]{};
memset(&genQueryInp, 0, sizeof(genQueryInp_t));
snprintf(tmpStr, MAX_NAME_LEN, "='%s'", logicalEndName);
addInxVal(&genQueryInp.sqlCondInp, COL_DATA_NAME, tmpStr);
addInxIval(&genQueryInp.selectInp, COL_D_DATA_ID, 1);
snprintf(tmpStr, MAX_NAME_LEN, "='%s'", logicalParentDirName);
addInxVal(&genQueryInp.sqlCondInp, COL_COLL_NAME, tmpStr);
addInxIval(&genQueryInp.selectInp, COL_COLL_ID, 1);
genQueryInp.maxRows = 2;
status = rsGenQuery(rsComm, &genQueryInp, &genQueryOut);
if (status < 0) {
freeGenQueryOut(&genQueryOut);
clearGenQueryInp(&genQueryInp);
return status;
}
sqlResult_t *dataIdRes{getSqlResultByInx(genQueryOut, COL_D_DATA_ID)};
if (NULL == dataIdRes) {
const auto err{ERROR(UNMATCHED_KEY_OR_INDEX, "getSqlResultByInx for COL_D_DATA_ID failed")};
irods::log(err);
return err.code();
}
if (NULL != dataId) {
*dataId = strtoll(dataIdRes->value, 0, 0);
}
freeGenQueryOut(&genQueryOut);
clearGenQueryInp(&genQueryInp);
return status;
}
开发者ID:QuarkDoe,项目名称:irods,代码行数:48,代码来源:objMetaOpr.cpp
示例6: isColl
int
isColl( rsComm_t *rsComm, char *objName, rodsLong_t *collId ) {
genQueryInp_t genQueryInp;
genQueryOut_t *genQueryOut = NULL;
char tmpStr[MAX_NAME_LEN];
int status;
memset( &genQueryInp, 0, sizeof( genQueryInp_t ) );
snprintf( tmpStr, MAX_NAME_LEN, "='%s'", objName );
addInxVal( &genQueryInp.sqlCondInp, COL_COLL_NAME, tmpStr );
addInxIval( &genQueryInp.selectInp, COL_COLL_ID, 1 );
genQueryInp.maxRows = 2;
status = rsGenQuery( rsComm, &genQueryInp, &genQueryOut );
if ( status >= 0 ) {
sqlResult_t *collIdRes;
if ( ( collIdRes = getSqlResultByInx( genQueryOut, COL_COLL_ID ) ) ==
NULL ) {
rodsLog( LOG_ERROR,
"isColl: getSqlResultByInx for COL_D_DATA_ID failed" );
return UNMATCHED_KEY_OR_INDEX;
}
if ( collId != NULL ) {
*collId = strtoll( collIdRes->value, 0, 0 );
}
freeGenQueryOut( &genQueryOut );
}
clearGenQueryInp( &genQueryInp );
return status;
}
开发者ID:bpow,项目名称:irods,代码行数:32,代码来源:objMetaOpr.cpp
示例7: checkPermitForResource
int
checkPermitForResource( rsComm_t *rsComm, char *objName, int userId, int operId ) {
genQueryInp_t genQueryInp;
genQueryOut_t *genQueryOut = NULL;
char t1[MAX_NAME_LEN]; // JMC cppcheck - snprintf out of bounds
char t2[MAX_NAME_LEN]; // JMC cppcheck - snprintf out of bounds
char t4[MAX_NAME_LEN]; // JMC cppcheck - snprintf out of bounds
int status;
snprintf( t1, MAX_NAME_LEN, " = '%s'", objName );
snprintf( t2, MAX_NAME_LEN, " = '%i'", userId );
snprintf( t4, MAX_NAME_LEN, " >= '%i' ", operId );
memset( &genQueryInp, 0, sizeof( genQueryInp_t ) );
addInxIval( &genQueryInp.selectInp, COL_R_RESC_ID, 1 );
addInxVal( &genQueryInp.sqlCondInp, COL_R_RESC_NAME, t1 );
addInxVal( &genQueryInp.sqlCondInp, COL_RESC_ACCESS_USER_ID, t2 );
addInxVal( &genQueryInp.sqlCondInp, COL_RESC_ACCESS_TYPE, t4 );
genQueryInp.maxRows = 2;
status = rsGenQuery( rsComm, &genQueryInp, &genQueryOut );
clearGenQueryInp( &genQueryInp );
if ( status >= 0 ) {
freeGenQueryOut( &genQueryOut );
return 1;
}
else {
return 0;
}
}
开发者ID:bpow,项目名称:irods,代码行数:29,代码来源:objMetaOpr.cpp
示例8: checkPermitForDataObject
int
checkPermitForDataObject( rsComm_t *rsComm, char *objName, int userId, int operId ) {
genQueryInp_t genQueryInp;
genQueryOut_t *genQueryOut = NULL;
char t1[MAX_NAME_LEN]; // JMC cppcheck - snprintf out of bounds
char t11[MAX_NAME_LEN]; // JMC cppcheck - snprintf out of bounds
char t2[MAX_NAME_LEN]; // JMC cppcheck - snprintf out of bounds
char t3[MAX_NAME_LEN]; // JMC cppcheck - snprintf out of bounds
char logicalEndName[MAX_NAME_LEN];
char logicalParentDirName[MAX_NAME_LEN];
int status;
splitPathByKey( objName, logicalParentDirName, MAX_NAME_LEN, logicalEndName, MAX_NAME_LEN, '/' );
snprintf( t1, MAX_NAME_LEN, " = '%s'", logicalEndName );
snprintf( t11, MAX_NAME_LEN, " = '%s'", logicalParentDirName );
snprintf( t2, MAX_NAME_LEN, " = '%i'", userId );
snprintf( t3, MAX_NAME_LEN, " >= '%i' ", operId );
memset( &genQueryInp, 0, sizeof( genQueryInp_t ) );
addInxIval( &genQueryInp.selectInp, COL_D_DATA_ID, 1 );
addInxVal( &genQueryInp.sqlCondInp, COL_DATA_NAME, t1 );
addInxVal( &genQueryInp.sqlCondInp, COL_COLL_NAME, t11 );
addInxVal( &genQueryInp.sqlCondInp, COL_DATA_ACCESS_USER_ID, t2 );
addInxVal( &genQueryInp.sqlCondInp, COL_DATA_ACCESS_TYPE, t3 );
genQueryInp.maxRows = 2;
status = rsGenQuery( rsComm, &genQueryInp, &genQueryOut );
freeGenQueryOut( &genQueryOut );
clearGenQueryInp( &genQueryInp );
if ( status >= 0 ) {
return 1;
}
else {
return 0;
}
}
开发者ID:QuarkDoe,项目名称:irods,代码行数:35,代码来源:objMetaOpr.cpp
示例9: getSpecCollCache
int
getSpecCollCache( rsComm_t *rsComm, char *objPath,
int inCachOnly, specCollCache_t **specCollCache ) {
int status;
genQueryOut_t *genQueryOut = NULL;
if ( ( *specCollCache = matchSpecCollCache( objPath ) ) != NULL ) {
return 0;
}
else if ( inCachOnly > 0 ) {
return SYS_SPEC_COLL_NOT_IN_CACHE;
}
status = querySpecColl( rsComm, objPath, &genQueryOut );
if ( status < 0 ) {
return status;
}
status = queueSpecCollCache( rsComm, genQueryOut, objPath ); // JMC - backport 4680
freeGenQueryOut( &genQueryOut );
if ( status < 0 ) {
return status;
}
*specCollCache = SpecCollCacheHead; /* queued at top */
return 0;
}
开发者ID:bpow,项目名称:irods,代码行数:28,代码来源:specColl.cpp
示例10: readICatUserInfo
int readICatUserInfo( char *userName, char *attr, char userInfo[MAX_NAME_LEN], rsComm_t *rsComm ) {
int status;
genQueryInp_t genQueryInp;
genQueryOut_t *genQueryOut = NULL;
char condstr[MAX_NAME_LEN];
memset( &genQueryInp, 0, sizeof( genQueryInp ) );
genQueryInp.maxRows = MAX_SQL_ROWS;
snprintf( condstr, MAX_NAME_LEN, "= '%s'", userName );
addInxVal( &genQueryInp.sqlCondInp, COL_USER_NAME, condstr );
snprintf( condstr, MAX_NAME_LEN, "= '%s'", attr );
addInxVal( &genQueryInp.sqlCondInp, COL_META_USER_ATTR_NAME, condstr );
addInxIval( &genQueryInp.selectInp, COL_META_USER_ATTR_VALUE, 1 );
status = rsGenQuery( rsComm, &genQueryInp, &genQueryOut );
userInfo[0] = '\0';
if ( status >= 0 && genQueryOut->rowCnt > 0 ) {
if ( sqlResult_t *r = getSqlResultByInx( genQueryOut, COL_META_USER_ATTR_VALUE ) ) {
rstrcpy( userInfo, &r->value[0], MAX_NAME_LEN );
}
genQueryInp.continueInx = genQueryOut->continueInx;
}
clearGenQueryInp( &genQueryInp );
freeGenQueryOut( &genQueryOut );
return status;
}
开发者ID:bpow,项目名称:irods,代码行数:28,代码来源:configuration.cpp
示例11: get_query_array
irods::error get_query_array(
rsComm_t* _comm,
json_t*& _queries ) {
if( !_comm ) {
return ERROR(
SYS_INVALID_INPUT_PARAM,
"comm is null" );
}
_queries = json_array();
if ( !_queries ) {
return ERROR(
SYS_MALLOC_ERR,
"allocation of json object failed" );
}
specificQueryInp_t spec_inp;
memset( &spec_inp, 0, sizeof( specificQueryInp_t ) );
spec_inp.maxRows = MAX_SQL_ROWS;
spec_inp.continueInx = 0;
spec_inp.sql = "ls";
genQueryOut_t* gen_out = 0;
int status = rsSpecificQuery(
_comm,
&spec_inp,
&gen_out );
if( status < 0 ) {
return ERROR(
status,
"rsSpecificQuery for 'ls' failed" );
}
// first attribute is the alias of the specific query
int len = gen_out->sqlResult[ 0 ].len;
char* values = gen_out->sqlResult[ 0 ].value;
for( int i = 0 ;
i < gen_out->rowCnt ;
++i ) {
char* alias = &values[ len * i ];
if( !alias ) {
rodsLog(
LOG_ERROR,
"get_query_array - alias at %d is null",
i );
continue;
}
json_array_append( _queries, json_string( alias ) );
} // for i
freeGenQueryOut( &gen_out );
return SUCCESS();
} // get_query_array
开发者ID:cchapati,项目名称:irods,代码行数:60,代码来源:rsIESClientHints.cpp
示例12: checkCollExists
int checkCollExists( rcComm_t *conn, rodsArguments_t *myRodsArgs, const char *collPath ) {
int status;
genQueryInp_t genQueryInp;
genQueryOut_t *genQueryOut = NULL;
char condStr[MAX_NAME_LEN];
memset( &genQueryInp, 0, sizeof( genQueryInp ) );
addInxIval( &genQueryInp.selectInp, COL_COLL_ID, 1 );
genQueryInp.maxRows = 0;
genQueryInp.options = AUTO_CLOSE;
snprintf( condStr, MAX_NAME_LEN, "='%s'", collPath );
addInxVal( &genQueryInp.sqlCondInp, COL_COLL_NAME, condStr );
status = rcGenQuery( conn, &genQueryInp, &genQueryOut );
clearGenQueryInp( &genQueryInp );
freeGenQueryOut( &genQueryOut );
if ( status == CAT_NO_ROWS_FOUND ) {
return 0;
} else {
return 1;
}
}
开发者ID:QuarkDoe,项目名称:irods,代码行数:25,代码来源:rmdirUtil.cpp
示例13: qdelUtil
int
qdelUtil( rcComm_t *conn, char *userName, int allFlag,
rodsArguments_t *myRodsArgs ) {
genQueryInp_t genQueryInp;
int status, i, continueInx;
char tmpStr[MAX_NAME_LEN];
sqlResult_t *execId;
char *execIdStr;
genQueryOut_t *genQueryOut = NULL;
int savedStatus = 0;
if ( allFlag == 1 && userName != NULL ) {
rodsLog( LOG_ERROR,
"qdelUtil: all(-a) and user(-u) cannot be used together" );
return USER_INPUT_OPTION_ERR;
}
memset( &genQueryInp, 0, sizeof( genQueryInp_t ) );
if ( userName != NULL ) {
snprintf( tmpStr, MAX_NAME_LEN, " = '%s'", userName );
addInxVal( &genQueryInp.sqlCondInp, COL_RULE_EXEC_USER_NAME, tmpStr );
}
addInxIval( &genQueryInp.selectInp, COL_RULE_EXEC_ID, 1 );
genQueryInp.maxRows = MAX_SQL_ROWS;
continueInx = 1; /* a fake one so it will do the first query */
while ( continueInx > 0 ) {
status = rcGenQuery( conn, &genQueryInp, &genQueryOut );
if ( status < 0 ) {
if ( status != CAT_NO_ROWS_FOUND ) {
savedStatus = status;
}
break;
}
if ( ( execId = getSqlResultByInx( genQueryOut, COL_RULE_EXEC_ID ) ) ==
NULL ) {
rodsLog( LOG_ERROR,
"qdelUtil: getSqlResultByInx for COL_RULE_EXEC_ID failed" );
return UNMATCHED_KEY_OR_INDEX;
}
for ( i = 0; i < genQueryOut->rowCnt; i++ ) {
execIdStr = &execId->value[execId->len * i];
if ( myRodsArgs->verbose ) {
printf( "Deleting %s\n", execIdStr );
}
status = rmDelayedRule( execIdStr );
if ( status < 0 ) {
rodsLog( LOG_ERROR,
"qdelUtil: rmDelayedRule %s error. status = %d",
execIdStr, status );
savedStatus = status;
}
}
continueInx = genQueryInp.continueInx = genQueryOut->continueInx;
freeGenQueryOut( &genQueryOut );
}
clearGenQueryInp( &genQueryInp );
return savedStatus;
}
开发者ID:0x414A,项目名称:irods,代码行数:59,代码来源:iqdel.cpp
示例14: get_resource_path
static int get_resource_path( rsComm_t *conn, char *rescName, char *rescPath ) {
genQueryInp_t genQueryInp;
int i1a[10];
int i1b[10];
int i2a[10];
char *condVal[2];
char v1[200];
genQueryOut_t *genQueryOut = NULL;
sqlResult_t *vaultPathSTruct;
char *vaultPath;
int t;
memset( &genQueryInp, 0, sizeof( genQueryInp_t ) );
i1a[0] = COL_R_VAULT_PATH;
i1b[0] = 0;
genQueryInp.selectInp.inx = i1a;
genQueryInp.selectInp.value = i1b;
genQueryInp.selectInp.len = 1;
i2a[0] = COL_R_RESC_NAME;
genQueryInp.sqlCondInp.inx = i2a;
sprintf( v1, "='%s'", rescName );
condVal[0] = v1;
genQueryInp.sqlCondInp.value = condVal;
genQueryInp.sqlCondInp.len = 1;
genQueryInp.maxRows = 2;
genQueryInp.continueInx = 0;
t = rsGenQuery( conn, &genQueryInp, &genQueryOut );
if ( NULL == genQueryOut ) { // JMC cppecheck - nullptr
rodsLog( LOG_ERROR, "get_resource_path :: genQueryOut is NULL" );
return 0;
}
if ( t < 0 ) {
if ( t == CAT_NO_ROWS_FOUND ) { /* no data is found */
return 0;
}
return( t );
}
if ( genQueryOut->rowCnt < 0 ) {
return -1;
}
vaultPathSTruct = getSqlResultByInx( genQueryOut, COL_R_VAULT_PATH );
vaultPath = &vaultPathSTruct->value[0];
strcpy( rescPath, vaultPath );
freeGenQueryOut( &genQueryOut );
return 0;
}
开发者ID:leesab,项目名称:irods,代码行数:55,代码来源:reAutoReplicateService.cpp
示例15: getNumSubfilesInBunfileObj
// =-=-=-=-=-=-=-
// JMC - backport 4552
int
getNumSubfilesInBunfileObj( rsComm_t *rsComm, char *objPath ) {
int status;
genQueryOut_t *genQueryOut = NULL;
genQueryInp_t genQueryInp;
int totalRowCount;
char condStr[MAX_NAME_LEN];
bzero( &genQueryInp, sizeof( genQueryInp ) );
genQueryInp.maxRows = 1;
genQueryInp.options = RETURN_TOTAL_ROW_COUNT;
snprintf( condStr, MAX_NAME_LEN, "='%s'", objPath );
addInxVal( &genQueryInp.sqlCondInp, COL_D_DATA_PATH, condStr );
snprintf( condStr, MAX_NAME_LEN, "='%s'", BUNDLE_RESC_CLASS );
addInxVal( &genQueryInp.sqlCondInp, COL_R_CLASS_NAME, condStr );
addKeyVal( &genQueryInp.condInput, ZONE_KW, objPath );
addInxIval( &genQueryInp.selectInp, COL_COLL_NAME, 1 );
addInxIval( &genQueryInp.selectInp, COL_DATA_NAME, 1 );
addInxIval( &genQueryInp.selectInp, COL_DATA_SIZE, 1 );
status = rsGenQuery( rsComm, &genQueryInp, &genQueryOut );
if ( genQueryOut == NULL || status < 0 ) {
freeGenQueryOut( &genQueryOut );
clearGenQueryInp( &genQueryInp );
if ( status == CAT_NO_ROWS_FOUND ) {
return 0;
}
else {
return status;
}
}
totalRowCount = genQueryOut->totalRowCount;
freeGenQueryOut( &genQueryOut );
/* clear result */
genQueryInp.maxRows = 0;
rsGenQuery( rsComm, &genQueryInp, &genQueryOut );
clearGenQueryInp( &genQueryInp );
return totalRowCount;
}
开发者ID:QuarkDoe,项目名称:irods,代码行数:44,代码来源:objMetaOpr.cpp
示例16: printDataAcl
int
printDataAcl (rcComm_t *conn, char *dataId)
{
genQueryOut_t *genQueryOut = NULL;
int status;
int i;
sqlResult_t *userName, *userZone, *dataAccess;
char *userNameStr, *userZoneStr, *dataAccessStr;
status = queryDataObjAcl (conn, dataId, zoneHint, &genQueryOut);
printf (" ACL - ");
if (status < 0) {
printf ("\n");
return (status);
}
if ((userName = getSqlResultByInx (genQueryOut, COL_USER_NAME)) == NULL) {
rodsLog (LOG_ERROR,
"printDataAcl: getSqlResultByInx for COL_USER_NAME failed");
return (UNMATCHED_KEY_OR_INDEX);
}
if ((userZone = getSqlResultByInx (genQueryOut, COL_USER_ZONE)) == NULL) {
rodsLog (LOG_ERROR,
"printDataAcl: getSqlResultByInx for COL_USER_ZONE failed");
return (UNMATCHED_KEY_OR_INDEX);
}
if ((dataAccess = getSqlResultByInx (genQueryOut, COL_DATA_ACCESS_NAME))
== NULL) {
rodsLog (LOG_ERROR,
"printDataAcl: getSqlResultByInx for COL_DATA_ACCESS_NAME failed");
return (UNMATCHED_KEY_OR_INDEX);
}
for (i = 0; i < genQueryOut->rowCnt; i++) {
userNameStr = &userName->value[userName->len * i];
userZoneStr = &userZone->value[userZone->len * i];
dataAccessStr = &dataAccess->value[dataAccess->len * i];
printf ("%s#%s:%s ", userNameStr, userZoneStr, dataAccessStr);
}
printf ("\n");
freeGenQueryOut (&genQueryOut);
return (status);
}
开发者ID:iPlantCollaborativeOpenSource,项目名称:iRODS3.2-custom,代码行数:50,代码来源:lsUtil.c
示例17: checkCollIsEmpty
int checkCollIsEmpty( rcComm_t *conn, rodsArguments_t *myRodsArgs, const char *collPath ) {
int status;
genQueryInp_t genQueryInp1, genQueryInp2;
genQueryOut_t *genQueryOut1 = NULL, *genQueryOut2 = NULL;
int noDataFound = 0;
int noCollFound = 0;
char condStr[MAX_NAME_LEN];
memset( &genQueryInp1, 0, sizeof( genQueryInp1 ) );
memset( &genQueryInp2, 0, sizeof( genQueryInp2 ) );
snprintf( condStr, MAX_NAME_LEN, "select COLL_ID where COLL_NAME like '%s/%%'", collPath );
fillGenQueryInpFromStrCond( condStr, &genQueryInp1 );
status = rcGenQuery( conn, &genQueryInp1, &genQueryOut1 );
clearGenQueryInp( &genQueryInp1 );
freeGenQueryOut( &genQueryOut1 );
if ( status == CAT_NO_ROWS_FOUND ) {
noCollFound = 1;
}
snprintf( condStr, MAX_NAME_LEN, "select DATA_ID where COLL_NAME like '%s%%'", collPath );
fillGenQueryInpFromStrCond( condStr, &genQueryInp2 );
status = rcGenQuery( conn, &genQueryInp2, &genQueryOut2 );
clearGenQueryInp( &genQueryInp2 );
freeGenQueryOut( &genQueryOut2 );
if ( status == CAT_NO_ROWS_FOUND ) {
noDataFound = 1;
}
return ( noDataFound && noCollFound );
}
开发者ID:QuarkDoe,项目名称:irods,代码行数:37,代码来源:rmdirUtil.cpp
示例18: msiCheckHostAccessControl
/**
* \fn msiCheckHostAccessControl (ruleExecInfo_t *rei)
*
* \brief This microservice sets the access control policy. It checks the
* access control by host and user based on the the policy given in the
* HostAccessControl file.
*
* \module core
*
* \since pre-2.1
*
* \author Jean-Yves Nief
* \date 2007-09
*
* \note This microservice controls access to the iRODS service
* based on the information in the host based access configuration file:
* HOST_ACCESS_CONTROL_FILE
*
* \usage See clients/icommands/test/rules3.0/
*
* \param[in,out] rei - The RuleExecInfo structure that is automatically
* handled by the rule engine. The user does not include rei as a
* parameter in the rule invocation.
*
* \DolVarDependence none
* \DolVarModified none
* \iCatAttrDependence none
* \iCatAttrModified none
* \sideeffect none
*
* \return integer
* \retval 0 upon success
* \pre N/A
* \post N/A
* \sa N/A
**/
int msiCheckHostAccessControl( ruleExecInfo_t *rei ) {
char group[MAX_NAME_LEN], *hostclient, *result, *username;
char condstr[MAX_NAME_LEN];
int i, rc, status;
genQueryInp_t genQueryInp;
genQueryOut_t *genQueryOut = NULL;
rsComm_t *rsComm;
RE_TEST_MACRO( " Calling msiCheckHostAccessControl" )
/* the above line is needed for loop back testing using irule -i option */
group[0] = '\0';
rsComm = rei->rsComm;
/* retrieve user name */
username = rsComm->clientUser.userName;
/* retrieve client IP address */
hostclient = inet_ntoa( rsComm->remoteAddr.sin_addr );
/* retrieve groups to which the user belong */
memset( &genQueryInp, 0, sizeof( genQueryInp ) );
snprintf( condstr, MAX_NAME_LEN, "= '%s'", username );
addInxVal( &genQueryInp.sqlCondInp, COL_USER_NAME, condstr );
addInxIval( &genQueryInp.selectInp, COL_USER_GROUP_NAME, 1 );
genQueryInp.maxRows = MAX_SQL_ROWS;
status = rsGenQuery( rsComm, &genQueryInp, &genQueryOut );
if ( status >= 0 ) {
for ( i = 0; i < genQueryOut->rowCnt; i++ ) {
result = genQueryOut->sqlResult[0].value;
result += i * genQueryOut->sqlResult[0].len;
strcat( group, result );
strcat( group, " " );
}
}
else {
rstrcpy( group, "all", MAX_NAME_LEN );
}
clearGenQueryInp( &genQueryInp );
freeGenQueryOut( &genQueryOut );
rc = checkHostAccessControl( username, hostclient, group );
if ( rc < 0 ) {
rodsLog( LOG_NOTICE, "Access to user %s from host %s has been refused.\n", username, hostclient );
rei->status = rc;
}
return rei->status;
}
开发者ID:dthain,项目名称:irods,代码行数:84,代码来源:reIn2p3SysRule.cpp
示例19: isResc
int
isResc( rsComm_t *rsComm, char *objName ) {
genQueryInp_t genQueryInp;
genQueryOut_t *genQueryOut = NULL;
char tmpStr[NAME_LEN];
int status;
memset( &genQueryInp, 0, sizeof( genQueryInp_t ) );
snprintf( tmpStr, NAME_LEN, "='%s'", objName );
addInxVal( &genQueryInp.sqlCondInp, COL_R_RESC_NAME, tmpStr );
addInxIval( &genQueryInp.selectInp, COL_R_RESC_ID, 1 );
genQueryInp.maxRows = 2;
status = rsGenQuery( rsComm, &genQueryInp, &genQueryOut );
freeGenQueryOut( &genQueryOut );
clearGenQueryInp( &genQueryInp );
return status;
}
开发者ID:bpow,项目名称:irods,代码行数:17,代码来源:objMetaOpr.cpp
示例20: checkDupReplica
/* checkDupReplica - Check if a given object with a given rescName
* and physical path already exist. If it does, returns the replNum.
* JMC - backport 4497 */
int
checkDupReplica( rsComm_t *rsComm, rodsLong_t dataId, char *rescName,
char *filePath ) {
genQueryInp_t genQueryInp;
genQueryOut_t *genQueryOut = NULL;
char tmpStr[MAX_NAME_LEN];
int status;
if ( rsComm == NULL || rescName == NULL || filePath == NULL ) {
return USER__NULL_INPUT_ERR;
}
bzero( &genQueryInp, sizeof( genQueryInp_t ) );
snprintf( tmpStr, MAX_NAME_LEN, "='%s'", rescName );
addInxVal( &genQueryInp.sqlCondInp, COL_D_RESC_NAME, tmpStr );
snprintf( tmpStr, MAX_NAME_LEN, "='%s'", filePath );
addInxVal( &genQueryInp.sqlCondInp, COL_D_DATA_PATH, tmpStr );
snprintf( tmpStr, MAX_NAME_LEN, "='%lld'", dataId );
addInxVal( &genQueryInp.sqlCondInp, COL_D_DATA_ID, tmpStr );
addInxIval( &genQueryInp.selectInp, COL_DATA_REPL_NUM, 1 );
genQueryInp.maxRows = 2;
status = rsGenQuery( rsComm, &genQueryInp, &genQueryOut );
clearGenQueryInp( &genQueryInp );
if ( status >= 0 ) {
int intReplNum;
sqlResult_t *replNum;
if ( ( replNum = getSqlResultByInx( genQueryOut, COL_DATA_REPL_NUM ) ) ==
NULL ) {
rodsLog( LOG_ERROR,
"checkDupReplica: getSqlResultByInx COL_DATA_REPL_NUM failed" );
return UNMATCHED_KEY_OR_INDEX;
}
intReplNum = atoi( replNum->value );
freeGenQueryOut( &genQueryOut );
return intReplNum;
}
else {
return status;
}
}
开发者ID:bpow,项目名称:irods,代码行数:45,代码来源:objMetaOpr.cpp
注:本文中的freeGenQueryOut函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论