package com.alibaba.druid.sql.builder.impl;

import com.alibaba.druid.DbType;
import com.alibaba.druid.sql.ast.SQLExpr;
import com.alibaba.druid.sql.ast.expr.SQLBooleanExpr;
import com.alibaba.druid.sql.ast.expr.SQLCharExpr;
import com.alibaba.druid.sql.ast.expr.SQLIntegerExpr;
import com.alibaba.druid.sql.ast.expr.SQLNullExpr;
import com.alibaba.druid.sql.ast.expr.SQLNumberExpr;
import com.alibaba.druid.sql.builder.SQLBuilder;

public class SQLBuilderImpl implements SQLBuilder {
   public static SQLExpr toSQLExpr(Object obj, DbType dbType) {
      if (obj == null) {
         return new SQLNullExpr();
      } else if (obj instanceof Integer) {
         return new SQLIntegerExpr((Integer)obj);
      } else if (obj instanceof Number) {
         return new SQLNumberExpr((Number)obj);
      } else if (obj instanceof String) {
         return new SQLCharExpr((String)obj);
      } else if (obj instanceof Boolean) {
         return new SQLBooleanExpr((Boolean)obj);
      } else {
         throw new IllegalArgumentException("not support : " + obj.getClass().getName());
      }
   }
}
