Exemplo n.º 1
0
bool HbCli::scan(const string table, const string startRow, const vector<string> columns,
        const map<string, string> attrs, vector<TRowResult> &values)
{
    int scanner;
    const int32_t nRows = 100;
    vector<TRowResult>::const_iterator it;

    if(!isconnect())
        return false;
    scanner = client->scannerOpen(table, startRow, columns, attrs);
    try{
        while(true){
            vector<TRowResult> value;
            client->scannerGetList(value, scanner, nRows);
            if(0 == value.size())
                break;
            for(it = value.begin(); it != value.end(); ++it)
                values.push_back(*it);
        }
    }catch (const IOError &ioe) { 
        std::cerr << "FATAL: Scanner raised IOError" << std::endl;
        client->scannerClose(scanner);
        return false;
    }catch (const TTransportException &tte) { 
        std::cerr << "ERROR: " << tte.what() << std::endl; 
         _is_connected = false; 
        client->scannerClose(scanner); 
        return false;
    }
    client->scannerClose(scanner);
    return true;
}
Exemplo n.º 2
0
bool HbCli::getTables(vector<string> &tables)
{
    if(!isconnect())
        return false;
    try{
        client->getTableNames(tables);
    }catch (const IOError &ioe) {
        std::cerr << "FATAL: Scanner raised IOError" << std::endl;
        return false;
    }catch (const TTransportException &tte) {
        std::cerr << "ERROR: " << tte.what() << std::endl; 
        return false;
    }
    return true;
}
Exemplo n.º 3
0
WINLOCEX winlocex_create(HWND base, const HWND *child, UINT count) {

	WINLOCEX	ret;
	HWND		*list;
	UINT		inlist;
	UINT		i;
	UINT		j;
	HWND		hwnd;
	UINT		allocsize;
	WLEXWND		*wnd;
	RECT		rect;
	UINT8		connect;
	WLEXWND		*p;

	if (child == NULL) {
		count = 0;
	}
	ret = NULL;
	list = NULL;
	inlist = 0;
	if (count) {
		list = (HWND *)_MALLOC(count * sizeof(HWND *), "wnd list");
		if (list == NULL) {
			goto wlecre_err1;
		}
		for (i=0; i<count; i++) {
			hwnd = child[i];
			if ((hwnd != NULL) && (hwnd != base) &&
				(!(GetWindowLong(hwnd, GWL_STYLE) &
											(WS_MAXIMIZE | WS_MINIMIZE)))) {
				for (j=0; j<inlist; j++) {
					if (list[j] == hwnd) {
						break;
					}
				}
				if (j >= inlist) {
					list[inlist++] = hwnd;
				}
			}
		}
	}
	allocsize = sizeof(_WINLOCEX) + (sizeof(WLEXWND) * inlist);
	ret = (WINLOCEX)_MALLOC(allocsize, "winlocex");
	if (ret == NULL) {
		goto wlecre_err2;
	}
	ZeroMemory(ret, allocsize);
	wnd = (WLEXWND *)(ret + 1);

	if (base) {
		// 親と接続されてる?
		ret->base = base;
		GetWindowRect(base, &ret->rect);
		for (i=0; i<inlist; i++) {
			hwnd = list[i];
			if (hwnd) {
				GetWindowRect(hwnd, &rect);
				connect = isconnect(&ret->rect, &rect);
				if (connect) {
					list[i] = NULL;
					wnd->hwnd = hwnd;
					CopyMemory(&wnd->rect, &rect, sizeof(RECT));
					wnd->connect = connect;
//					wnd->parent = 0;
					wnd++;
					ret->count++;
				}
			}
		}
		// 子と接続されてる?
		p = (WLEXWND *)(ret + 1);
		for (i=0; i<ret->count; i++, p++) {
			for (j=0; j<inlist; j++) {
				hwnd = list[j];
				if (hwnd) {
					GetWindowRect(hwnd, &rect);
					connect = isconnect(&p->rect, &rect);
					if (connect) {
						list[j] = NULL;
						wnd->hwnd = hwnd;
						CopyMemory(&wnd->rect, &rect, sizeof(RECT));
						wnd->connect = connect;
						wnd->parent = i + 1;
						wnd++;
						ret->count++;
					}
				}
			}
		}
	}

	for (i=0; i<inlist; i++) {
		hwnd = list[i];
		if (hwnd) {
			wnd->hwnd = hwnd;
			GetWindowRect(hwnd, &wnd->rect);
			wnd++;
			ret->count++;
		}
	}

wlecre_err2:
	if (list) {
		_MFREE(list);
	}

wlecre_err1:
	return(ret);
}