TKDBPutProperty.java :  » Content-Management-System » webman » com » teamkonzept » webman » mainint » db » queries » duplication » Java Open Source

Java Open Source » Content Management System » webman 
webman » com » teamkonzept » webman » mainint » db » queries » duplication » TKDBPutProperty.java
package com.teamkonzept.webman.mainint.db.queries.duplication;

import com.teamkonzept.db.*;
//import com.teamkonzept.lib.*;

import java.io.*;
import java.util.*;
import java.sql.*;

/**
 * 
 */
public class TKDBPutProperty extends TKPrepQuery{

  public final static boolean isPrepared =
    true;
  
  public final static String[] paramOrder =
    { "NAME", "VALUE"};
  
  public final static Object[][] paramTypes =
    {{ "NAME", new Integer(Types.VARCHAR) },
     { "VALUE", new Integer(Types.VARCHAR) }
      };
        
  public final static boolean[] setRelevants =
    null;
    
  public final static String sqlString =
  
  " DECLARE @NAME varchar(254) " 
  +" DECLARE @VALUE varchar(254) " 
  +" SELECT @NAME = ? "
  +" SELECT @VALUE = ? "

  +" DELETE FROM PROPERTY "
  +" WHERE NAME = @NAME "
  
  +" INSERT INTO PROPERTY (PROPERTY_ID, NAME, VALUE) "
  +" SELECT ISNULL( MAX(PROPERTY_ID)+1,1), @NAME, @VALUE "
  +" FROM PROPERTY ";

      
 
  
  public void initQuery(Connection con) {
    super.initQuery(
      con, 
      isPrepared, 
      paramOrder, 
      paramTypes,
      setRelevants,
      sqlString ); 
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.