Exemple #1
0
static int IoSQLite3_resultRow(void *context, int argc, char **argv, char **azColName)
{
	IoSQLite3 *self = context;
	IoState_pushRetainPool(IOSTATE);

	{
		IoMap *map = IoMap_new(IOSTATE);
		PHash *hash = IoMap_rawHash(map);
		int i;
		IoSymbol *key, *value;

		for(i = 0; i < argc; i ++)
		{
			key = IOSYMBOL(azColName[i]);

			if (argv[i])
			{
				value = IOSYMBOL(argv[i]);
			}
			else
			{
				value = IOSYMBOL((char *)"NULL");
			}

			PHash_at_put_(hash, key, value);
			/*printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL"); */
		}

		IoList_rawAppend_(DATA(self)->results, map);
	}

	IoState_popRetainPool(IOSTATE);

	return 0;
}
Exemple #2
0
void IoState_registerProtoWithFunc_(IoState *self, IoObject *proto, IoStateProtoFunc *func)
{
	if (PHash_at_(self->primitives, (void *)func))
	{
		IoState_fatalError_(self, "IoState_registerProtoWithFunc_() Error: attempt to add the same proto twice");
	}

	IoState_retain_(self, proto);
	PHash_at_put_(self->primitives, (void *)func, proto);
	//printf("registered %s\n", IoObject_name(proto));
}
Exemple #3
0
Fichier : PHash.c Projet : ADTSH/io
void PHash_insertRecords(PHash *self, unsigned char *oldRecords, size_t oldSize)
{
	int i;
	
	for (i = 0; i < oldSize; i ++)
	{
		PHashRecord *r = Records_recordAt_(oldRecords, i);
		
		if (r->k)
		{
			PHash_at_put_(self, r->k, r->v);
		}
	}
}
Exemple #4
0
Fichier : PHash.c Projet : ADTSH/io
void PHash_insert_(PHash *self, PHashRecord *x)
{	
	int n;
	
	for (n = 0; n < PHASH_MAXLOOP; n ++)
	{ 
		PHashRecord *r;
		
		r = PHash_record1_(self, x->k);
		PHashRecord_swapWith_(x, r);
		if(x->k == 0x0) { self->keyCount ++; return; }
		 
		r = PHash_record2_(self, x->k);
		PHashRecord_swapWith_(x, r);
		if(x->k == 0x0) { self->keyCount ++; return; }
	}
	
	PHash_grow(self); 
	PHash_at_put_(self, x->k, x->v);
}