Query *
rewriteTargetSublinkUsingLeftJoin (Query *newTop, Query *query, SublinkInfo *info, Index subList[])
{
	Query *rewrittenSublink;
	Index subIndex;

	/* here we are sure that the sublink is rewritten using MOVE-strategy there say so */
	LOGNOTICE("use Move");
	addUsedMethod("Move");

	/* rewrite Sublink query */
	rewrittenSublink = rewriteQueryNode(copyObject(info->sublink->subselect));
	info->rewrittenSublinkQuery = rewrittenSublink;

	/* join query RTEs */
	joinQueryRTEs(query);

	/* add left join for subink */
	subIndex = addLeftJoinWithRewrittenSublink (newTop, info);
	subList[info->sublinkPos] = subIndex;

	/* create the join condition for the left join with the rewritten sublink */
	createJoinCondition (newTop, info, true);

	return query;
}
Exemple #2
0
int write_socket(int fd, const void *buf, size_t nbyte)
{
	int ret;

	ret = wait_write_select(fd, 5);
	if (ret < 1) {
		if (!ret)
			LOGNOTICE("Select timed out in write_socket");
		else
			LOGNOTICE("Select failed in write_socket");
		goto out;
	}
	ret = write_length(fd, buf, nbyte);
	if (ret < 0)
		LOGNOTICE("Failed to write in write_socket");
out:
	return ret;
}
Exemple #3
0
//-------------------------------------------------------
void ofLog::_log(ofLogLevel logLevel, string message){
	if(logLevel >= currentLogLevel){
		if(logLevel == OF_LOG_VERBOSE){
			#ifdef TARGET_ANDROID
				LOGVERBOSE(message.c_str());
			#else
				printf("OF_VERBOSE: ");
			#endif
		}
		else if(logLevel == OF_LOG_NOTICE){
			#ifdef TARGET_ANDROID
				LOGNOTICE(message.c_str());
			#else
						printf("OF_NOTICE: ");
			#endif
		}
		else if(logLevel == OF_LOG_WARNING){
			#ifdef TARGET_ANDROID
				LOGWARNING(message.c_str());
			#else
				printf("OF_WARNING: ");
			#endif
		}
		else if(logLevel == OF_LOG_ERROR){
			#ifdef TARGET_ANDROID
				LOGERROR(message.c_str());
			#else
				printf("OF_ERROR: ");
			#endif
		}
		else if(logLevel == OF_LOG_FATAL_ERROR){
			#ifdef TARGET_ANDROID
				LOGFATAL(message.c_str());
			#else
				printf("OF_FATAL_ERROR: ");
			#endif
		}
		#ifndef TARGET_ANDROID
			printf("%s\n",message.c_str());
		#endif
	}
}
Exemple #4
0
int connect_socket(char *url, char *port)
{
	struct addrinfo servinfobase, *servinfo, hints, *p;
	int sockd = -1;

	memset(&hints, 0, sizeof(struct addrinfo));
	hints.ai_family = AF_UNSPEC;
	hints.ai_socktype = SOCK_STREAM;
	memset(&servinfobase, 0, sizeof(struct addrinfo));
	servinfo = &servinfobase;

	if (getaddrinfo(url, port, &hints, &servinfo) != 0) {
		LOGWARNING("Failed to resolve (?wrong URL) %s:%s", url, port);
		goto out;
	}

	for (p = servinfo; p != NULL; p = p->ai_next) {
		sockd = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
		if (sockd == -1) {
			LOGDEBUG("Failed socket");
			continue;
		}

		/* Iterate non blocking over entries returned by getaddrinfo
		 * to cope with round robin DNS entries, finding the first one
		 * we can connect to quickly. */
		noblock_socket(sockd);
		if (connect(sockd, p->ai_addr, p->ai_addrlen) == -1) {
			int selret;

			if (!sock_connecting()) {
				Close(sockd);
				LOGDEBUG("Failed sock connect");
				continue;
			}
			selret = wait_write_select(sockd, 5);
			if  (selret > 0) {
				socklen_t len;
				int err, n;

				len = sizeof(err);
				n = getsockopt(sockd, SOL_SOCKET, SO_ERROR, (void *)&err, &len);
				if (!n && !err) {
					LOGDEBUG("Succeeded delayed connect");
					block_socket(sockd);
					break;
				}
			}
			Close(sockd);
			LOGDEBUG("Select timeout/failed connect");
			continue;
		}
		LOGDEBUG("Succeeded immediate connect");
		if (sockd >= 0)
			block_socket(sockd);

		break;
	}
	if (p == NULL) {
		LOGNOTICE("Failed to connect to %s:%s", url, port);
		sockd = -1;
	}
	freeaddrinfo(servinfo);
out:
	return sockd;
}