示例#1
0
void ring_vm_odbc_execute ( void *pPointer )
{
	ring_odbc *pODBC  ;
	SQLRETURN ret  ;
	if ( RING_API_PARACOUNT != 2 ) {
		RING_API_ERROR(RING_API_MISS2PARA);
		return ;
	}
	if ( RING_API_ISPOINTER(1) && RING_API_ISSTRING(2) ) {
		pODBC = (ring_odbc *) RING_API_GETCPOINTER(1,RING_VM_POINTER_ODBC) ;
		if ( pODBC == NULL ) {
			return ;
		}
		if ( pODBC->nFlag & RING_ODBC_FLAG_STMT ) {
			SQLFreeHandle(SQL_HANDLE_STMT,pODBC->stmt);
		}
		SQLAllocHandle(SQL_HANDLE_STMT, pODBC->dbc , &pODBC->stmt);
		ret = SQLExecDirect(pODBC->stmt, (SQLCHAR *) RING_API_GETSTRING(2) , (SQLINTEGER) RING_API_GETSTRINGSIZE(2));
		pODBC->nFlag = pODBC->nFlag | RING_ODBC_FLAG_STMT ;
		if ( SQL_SUCCEEDED(ret) ) {
			RING_API_RETNUMBER(1);
		} else {
			RING_API_RETNUMBER(0);
		}
	} else {
		RING_API_ERROR(RING_API_BADPARATYPE);
	}
}
示例#2
0
void ring_vm_refmeta_setattribute ( void *pPointer )
{
	List *pList  ;
	char *cStr  ;
	int x  ;
	if ( RING_API_PARACOUNT != 3 ) {
		RING_API_ERROR(RING_API_BADPARACOUNT);
		return ;
	}
	if ( RING_API_ISLIST(1) && RING_API_ISSTRING(2) ) {
		pList = RING_API_GETLIST(1) ;
		if ( ring_vm_oop_isobject(pList) ) {
			pList = ring_list_getlist(pList,RING_OBJECT_OBJECTDATA);
			cStr = RING_API_GETSTRING(2) ;
			ring_string_lower(cStr);
			for ( x = 1 ; x <= ring_list_getsize(pList) ; x++ ) {
				if ( strcmp(ring_list_getstring(ring_list_getlist(pList,x),RING_VAR_NAME),cStr) == 0 ) {
					pList = ring_list_getlist(pList,x) ;
					if ( RING_API_ISNUMBER(3) ) {
						ring_list_setdouble(pList,RING_VAR_VALUE,RING_API_GETNUMBER(3));
					}
					else if ( RING_API_ISSTRING(3) ) {
						ring_list_setstring2(pList,RING_VAR_VALUE,RING_API_GETSTRING(3),RING_API_GETSTRINGSIZE(3));
					}
					else if ( RING_API_ISLIST(3) ) {
						ring_list_setlist(pList,RING_VAR_VALUE);
						pList = ring_list_getlist(pList,RING_VAR_VALUE);
						ring_list_deleteallitems(pList);
						ring_list_copy(pList,RING_API_GETLIST(3));
					}
					return ;
				}
			}
			RING_API_ERROR("Error : Property is not found!");
		} else {
			RING_API_ERROR(RING_API_BADPARATYPE);
		}
	} else {
		RING_API_ERROR(RING_API_BADPARATYPE);
	}
}