Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2002
    Posts
    2

    Unanswered: Extended Stored Procedures 7.0 - 2000

    I have a problem with passing parameters into an extended stored procedure in sql 2000 that was not present in sql 7.0.

    I pass in a parameter of type varchar(8000) but sql 2000 truncates this value to 255 characters.

    I was using srv_paramdata(sproc,1) for example to get the pertinent data. Microsoft says that srv_paramdata has been superceded by srv_paraminfo, but this function is crashing my dll when I run it.....
    Code:
    BYTE        bType;
        unsigned long        cbMaxLen;
        unsigned long        cbActualLen;
        BOOL        fNull;
    	BYTE		data;
    
    	// Use srv_paraminfo to get data type and length information.
        srv_paraminfo(sproc, 2, &bType, &cbMaxLen, &cbActualLen,&data, &fNull);
    Any ideas?

    This worked in sql 7.0.
    Code:
    wsprintf(string,"%s",(const char*) srv_paramdata(sproc,1));
    Umm help appreciated.

    Wintermute

  2. #2
    Join Date
    Aug 2002
    Posts
    2
    Umm actual guys... thanks to anyone who has looked to help me out, but I think I have (*this).sorted->muchos[gracias++];

    umm in keeping with Open Source Software paradigms and stuff if anyone is curious
    Code:
    	PBYTE*data;
    	BYTE type;
    	unsigned long Maxlen;
    	unsigned long Reallen;
    	int nParams;
    	BOOL boolnull;
    	char head_descriptor[24];
    	FILE*file;
    
    	nParams=srv_rpcparams(sproc);
    
    	
    	data=new PBYTE[1];
    	if(data==NULL)
    	{
    		ServerErrorMsg(sproc,"Was unable to allocate the requisite memory for this data operation");
    		return -1;
    	};
    	memset(data,0,nParams*sizeof(PBYTE));
    	
    
    	srv_paraminfo(sproc,2,&type,&Maxlen,&Reallen,NULL,&boolnull);
    	
    	sprintf(head_descriptor,"Parameter 2: Input");
    	srv_describe(sproc,2,head_descriptor,SRV_NULLTERM,type,Reallen,type,Reallen,NULL);
    
    	if(boolnull==0)
    	{
    	 data[0]=(unsigned char*)malloc(Reallen);
    	 if(data[0]==NULL)
    	 {
    		 ServerErrorMsg(sproc,"Unable to allocate memory for this variable!");
    		 delete data;
    		 return -1;
    	 };
    
    	 srv_paraminfo(sproc,2,&type,&Maxlen,&Reallen,data[0],&boolnull);
    	}
    	else
    	{
    		ServerErrorMsg(sproc,"There Seems to be no data present for parameter 2");
    		return -1;
    	};
    
    	file=fopen("C:/bod.txt","a+");
    	if(file==NULL)
    	{
    		ServerErrorMsg(sproc,"Unable to access the specified filename for file input,  Please check the filename and try again!");
    		return -1;
    	};
    
    	fwrite(data[0],Reallen,1,file);
    	fclose(file);
    	
    
     return 0;
    };
    Regards
    Wintermute.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •