RetDAO.java (part1) ..reference. Is this logic good?

Ads

 
 
 

Share on Google+Share on Google+

prateek agarwal
RetDAO.java (part1) ..reference. Is this logic good?
0 Answer(s)      4 years and 11 months ago
Posted in : Java Beginners

public static int searchDelete(Connection conn,String ret_id) throws Exception {
//System.out.println(ret_id); st=conn.createStatement(); //System.out.println("Where"); ResultSet rs=st.executeQuery("select * from RETAILER where RETAILERID='"+retid+"'"); //System.out.println("asudhwdioq");

    if(rs.next())
    {
        return 1;
    }
    else return 0;
}

public static int chk_order(Connection conn,String ret_id) throws Exception
{
    int a=0;
    System.out.println("Where");
    System.out.println(ret_id);
    ResultSet rs=st.executeQuery("select * from ORDER_TABLE where RETAILER_ID='"+ret_id+"'");

    System.out.println("qwggggg");

    if(rs.next()==false)
    {
        return 2;
    }
    while(rs.next())
    {   
        System.out.println("qwggggg");
        if(rs.getString(4).equals("Allocated"))
        {
            System.out.println("Girish");
            a=0;
            break;
        }
        else a=1;
        System.out.println(rs.getString(4));
    }
    if(a==0)
    {
        return 0;     
    }
    else return 1;
}

public static int untag(Connection conn,String ret_id) throws Exception
{
    st=conn.createStatement();
    System.out.println("Delete ho ja");
    int k=st.executeUpdate("delete from tag_product_tbl where retailer_id='"+ret_id+"'");
    return k;
}


public static int deleteRet(Connection conn,String ret_id) throws Exception
{
    st=conn.createStatement(); 
    System.out.println("Delete yahape bhi hoga");

    rs=st.executeQuery("select * from retailer where retailer_id='"+ret_id+"'");
    rs.next();
    String s1=rs.getString(1);
    String s2=rs.getString(2);
    String s3=rs.getString(3);
    String s4=rs.getString(4);
    int s5=rs.getInt(5);
    String s6=rs.getString(6);
    String s7=rs.getString(8);
    String s8=rs.getString(9);

    System.out.println(s1);
    System.out.println(s2);
    System.out.println(s3);
    System.out.println(s4);
    System.out.println(s5);
    System.out.println(s6);
    System.out.println(s7);
    System.out.println(s8);

    int a=st.executeUpdate("insert into inactive values('"+s1+"','"+s2+"','"+s3+"','"+s4+"',"+s5+",'"+s6+"')");
    System.out.println("a="+a);

    int z=st.executeUpdate("delete from retailer where retailer_id='"+ret_id+"'");
    System.out.println("hua kya?");
    return z;
}
Ads
View Answers
Ads









Tutorials   
Java Spring Hibernate Struts Training ClassNotFoundException HttpRequestInterceptor java.lang.noclassdeffounderror: org/apache/http/httprequest noclassdeffounderror: org/apache/http/client/methods/httpurirequest java.lang.NoClassDefFoundError: org/apache/http/client/HttpClient How do I resolve this Java Class not found exception? httpclient java.lang.NoClassDefFoundError Apache Commons ioutils maven dependency Read/Convert an inputStream to a String What is the meaning of Java Platform? Why Java is a platform independent language? What is the benefits of learning Core Java? Which technology should I learn after Java? What is array in java with example? How to Convert ArrayList to Array? How to substring in Java? How to format number in Java? What is instance variable in Java? How to download MySQL JDBC driver? What is Calendar class in Java? Which is the best Java tutorials for beginners? How to rename a file in Java? How to delete file in Java code? How to get day from date in Java using Calendar? How to get day of week in Java? How to calculate Date Difference in Java? How to compare date in Java? How to declare array in Java? How to calculate average of array in Java? What is Array in Java? write a java program to find the summation of all the integers entered on command line Sum of two numbers using command line arguments in Java How to create and use Array in Java? How to pass command line arguments in Java? How to create Applet Hello World? Appending String efficiently in Java How to append String in Java? How to list even numbers between 1 and 100? How to add BigDecimal in Java? What is Abstraction In Java? Which is best Beginners Java Tutorial? What is java.util package? Create list from array in Java Filter collection in Java 8 What is the best way to filter a Java Collection? Easy way to transform Collection to Array? How to convert Collection to Array in Java? What are Basic Java Language Elements? Advanced Java Tutorials in 2017 Java brief history Best Reasons to learn Java

Ads

 
Advertisement null

Ads