try this . You check out value in StringBuffer object as soon as u create it
i mean here

 StringBuffer query_buffer = new StringBuffer();
---->here check value
 query_buffer.append("WS2_COMPONENTS_PARTNO like '%
gc%'");
        Iam sure u will see object is empty.There might be another problem

------------- Original Message --------------
Maya Vayner <[EMAIL PROTECTED]> wrote:
To:[EMAIL PROTECTED]
From:Maya Vayner <[EMAIL PROTECTED]>
Date:Tue, 31 Jul 2001 10:37:24 -0700
Subject: Re: local String during the same session

Here we go:

This is a call from servlet:
String = CLASS.MY_METHOD(category_name, pricel, priceh,
vendor_name, valuel, valueh, search);
The long list of parameteres passed are the search
boundaries for query to be built from.

This is the code in
MY_METHOD(category_name, pricel, priceh, vendor_name,
valuel, valueh, search):
{
 .....
 String result = new String();
 String query_string = new String();
 .....
 StringBuffer query_buffer = new StringBuffer();
 query_buffer.append("WS2_COMPONENTS_PARTNO like '%
gc%'");
        if(isUsed(category_name))
        {
            query_buffer.append(" AND
WS2_COMPONENTS_LINK_C="+category_id);
        }

        if(isUsed(pricel) && isUsed(priceh))
        {
            query_buffer.append(" AND
WS2_COMPONENTS_PRICE > '"+pricel+"' AND
WS2_COMPONENTS_PRICE < '"+priceh+"'");
        }
        if(isUsed(vendor_name))
        {
            query_buffer.append(" AND
WS2_COMPONENTS_VENDOR_NM = '"+vendor_name+"'");
        }
        if(isUsed(search))
        {
            query_buffer.append(" AND
WS2_COMPONENTS_DESCRIPTION like '%"+search+"%'");
        }
        if(isUsed(valuel) && isUsed(valueh))
        {
            query_buffer.append(" AND
WS2_COMPONENTS_SIZE_1 > '"+valuel+"' AND
WS2_COMPONENTS_SIZE_1 < '"+valueh+"'");
        }
   query_string = query_buffer.toString();
   // just to make sure
   //it doesn't contain anything anymore:
   query_buffer.delete(0, query_buffer.length());
   ....
   while (something is true)
   {
     //here I am using that query_string
     //to retrieve data from db
   }
   query_string = null;

   //setting it to null at the end of method
   //- doesn't really help
   return result;
}
Maya

--- "Matthew L. Penner" <[EMAIL PROTECTED]> wrote:
> Can you post the code segment?  that often helps for
> the users on this list
> to diagnose your problem.
>
> ~Matt
>
>
> On Tue, 31 Jul 2001, Maya Vayner wrote:
>
> > Hi All:
> > I am writing here for the first time, sorry if this
> > problem is difficult to understand. Ask me if
> > something/all is not clear.
> > This is a Jakarta Tomcat question:
> > Does anybody have an idea why a local variable,
> which
> > is initialized and processed in a class method,
> keeps
> > itself in the memory, i.e. it is a query_string
> which
> > is getting built each time a new request is
> processed.
> > The class method is called by the servlet to return
> > some data from database. The string is created in
> the
> > class method, and at the end I set it equal to
> null.
> > But nothing seems to work :(
> > Thanks.
> > Maya Vayner
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Make international calls for as low as $.04/minute
> with Yahoo! Messenger
> > http://phonecard.yahoo.com/
> >
> >
>
___________________________________________________________________________
> > To unsubscribe, send email to [EMAIL PROTECTED]
> and include in the body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives:
>
http://archives.java.sun.com/archives/servlet-interest.html
> > Resources:
>
http://java.sun.com/products/servlet/external-resources.html
> > LISTSERV Help:
> http://www.lsoft.com/manuals/user/user.html
> >
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED]
> and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives:
>
http://archives.java.sun.com/archives/servlet-interest.html
> Resources:
>
http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help:
> http://www.lsoft.com/manuals/user/user.html
>


__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html


_________________________________________________________
For Rs. 2,000,000 worth of Aptech scholarships click below
http://events.rediff.com/aptechsch/scholarship.htm

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to