Beispiel #1
0
int VertexServer_api_select(VertexServer *self)
{
	PNode *node = PDB_allocNode(self->pdb);
	PQuery *q = PNode_query(node);
	VertexServer_setupPQuery_(self, q);
	Datum *opName;
	
	if (VertexServer_api_setCursorPathOnNode_(self, node)) return 2;
	
	opName = HttpRequest_queryValue_(self->httpRequest, "op");

	if (opName)
	{ 
		PNodeOp *op = (PNodeOp *)CHash_at_(self->ops, opName);
		
		if (op)
		{
			return op(node, self->result);
		}
	}

	VertexServer_setErrorCString_(self, "invalid node op");
	
	return -1;
}
Beispiel #2
0
IoSymbol *IoState_symbolWithUArray_copy_(IoState *self, UArray *ba, int copy)
{
	IoSymbol *ioSymbol = CHash_at_(self->symbols, ba);

	if (!ioSymbol)
	{
		ioSymbol = IoSeq_newSymbolWithUArray_copy_(self, ba, copy);
		return IoState_addSymbol_(self, ioSymbol);
	}

	if (!copy)
	{
		UArray_free(ba);
	}

	IoState_stackRetain_(self, ioSymbol);
	return ioSymbol;
}
Beispiel #3
0
int VertexServer_process(VertexServer *self)
{	
	Datum *actionName = (Datum *)HttpRequest_queryValue_(self->httpRequest, "action");

	//if(self->debug) { Log_Printf_("REQUEST ERROR: %s\n", HttpRequest_uri(self->httpRequest)); }

	if (Datum_size(actionName))
	{ 
		VertexAction *action = (VertexAction *)CHash_at_(self->actions, actionName);
		
		if (action)
		{
			return action(self);
		}
	}
	else 
	{
		return VertexServer_api_view(self);
	}
	
	VertexServer_setErrorCString_(self, "invalid action");

	return -1;
}