/* (non-Javadoc)
@see org.springframework.jdbc.core.namedparam.SqlParameterSource#getSqlType(java.lang.String)
541090
@Override
    public int getSqlType(String paramName) {
        if (!hasValue(paramName)) {
            return TYPE_UNKNOWN;
        }
        Object value = getValue(paramName);
        return StatementCreatorUtils.javaTypeToSqlParameterType(value.getClass());
    }
975609
public String getSQLType(boolean bIncludeLength, Map<String, Object> properties) 
    {
        String strType = (String)properties.get(DBSQLTypes.BOOLEAN);
        if (strType == null)
            strType = DBSQLTypes.BYTE;      // The default SQL Type (Byte)
        return strType;
    }
710536
private DataSource lookupDatasource(JDBCIdentitySource config) {
        DataSource ds;
        try {
            InitialContext ctx = new InitialContext();
            ds = lookupDS(ctx, config.getDatasourcePath());
            if (ds == null) {
                ds = lookupDS(ctx, "java:comp/env/" + config.getDatasourcePath()); //$NON-NLS-1$
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        if (ds == null) {
            throw new RuntimeException("Datasource not found: " + config.getDatasourcePath()); //$NON-NLS-1$
        }
        return ds;
    }
156527
private String extractSQLForJavaDoc(final SQLiteModelMethod method) {
		final One<Boolean> usedInWhere = new One<>(false);
		String sqlForJavaDoc = JQLChecker.getInstance().replace(method, method.jql, new JQLReplacerListenerImpl(method) {

			@Override
			public String onColumnNameToUpdate(String columnName) {
				return currentEntity.findPropertyByName(columnName).columnName;
			}

			@Override
			public String onColumnName(String columnName) {
				return currentEntity.findPropertyByName(columnName).columnName;
			}

			@Override
			public String onBindParameter(String bindParameterName, boolean inStatement) {
				if (!usedInWhere.value0) {
					if (bindParameterName.contains(".")) {
						String[] a = bindParameterName.split("\\.");

						if (a.length == 2) {
							bindParameterName = a[1];
						}
					}

					return ":" + bindParameterName;
				} else {
					return null;
				}
			}

			@Override
			public void onWhereStatementBegin(Where_stmtContext ctx) {
				usedInWhere.value0 = true;
			}

			@Override
			public void onWhereStatementEnd(Where_stmtContext ctx) {
				usedInWhere.value0 = false;
			};

		});
		return sqlForJavaDoc;
	}
581945
public static Object stringToSqlValue(String value, int sqlType, boolean isRequired, boolean isEmptyStringNulled) {
        // 设置变量
        String sourceValue = value;
        if (SqlUtils.isTextType(sqlType)) {
            if ((sourceValue == null) || (true == StringUtils.isEmpty(sourceValue) && isEmptyStringNulled)) {
                return isRequired ? REQUIRED_FIELD_NULL_SUBSTITUTE : null;
            } else {
                return sourceValue;
            }
        } else {
            if (StringUtils.isEmpty(sourceValue)) {
                return isEmptyStringNulled ? null : sourceValue;// oracle的返回null，保持兼容
            } else {
                Class<?> requiredType = sqlTypeToJavaTypeMap.get(sqlType);
                if (requiredType == null) {
                    throw new IllegalArgumentException("unknow java.sql.Types - " + sqlType);
                } else if (requiredType.equals(String.class)) {
                    return sourceValue;
                } else if (true == isNumeric(sqlType)) {
                    return convertUtilsBean.convert(sourceValue.trim(), requiredType);
                } else {
                    return convertUtilsBean.convert(sourceValue, requiredType);
                }
            }
        }
    }
1113923
public function getSqlType($value)
    {
        if ('boolean' === gettype($value)) {
            return $this->connection->getDatabasePlatform()->convertBooleans($value);
        } elseif (null === $value || 'null' === $value) {
            return 'NULL';
        }

        return $this->connection->quote($value);
    }
365542
public final int getJdbcType()
    {
        switch (this.fieldSource)
        {
            case SOURCE_FIELD :
                return this.getFieldRef().getJdbcType().getType();
            case SOURCE_NULL :
                return java.sql.Types.NULL;
            case SOURCE_VALUE :
                return java.sql.Types.VARCHAR;
            default :
                return java.sql.Types.NULL;
        }
    }
567219
public static SqlType getSqlTypeForTypeVal(int typeVal) {
		// iterate through to save on the extra HashMap since only for errors
		for (Map.Entry<SqlType, int[]> entry : typeToValMap.entrySet()) {
			for (int val : entry.getValue()) {
				if (val == typeVal) {
					return entry.getKey();
				}
			}
		}
		return SqlType.UNKNOWN;
	}
501835
String getQuery(String key)
    {
        String res = this.adapter.getSqlText(key);
        if (res == null)
        {
            throw new DatabaseException("Query " + key + " does not exist");
        }
        return res;
    }
1372729
public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException
    {
        if (this.isNull())
            statement.setNull(iParamColumn, Types.BIT);
        else
        {
            String strBitSupported = DBConstants.TRUE;
            if (this.getRecord() != null)
                if (this.getRecord().getTable() != null)
                    if (this.getRecord().getTable().getDatabase().getProperties() != null)
                strBitSupported = (String)this.getRecord().getTable().getDatabase().getProperties().get(SQLParams.BIT_TYPE_SUPPORTED);
            if (DBConstants.TRUE.equals(strBitSupported))
                statement.setBoolean(iParamColumn, this.getState());
            else
                statement.setByte(iParamColumn, (this.getState() ? (byte)1 : (byte)0));
        }
    }
1110896
def _cachedSqlType(cls):
        
        if not hasattr(cls, "_cached_sql_type"):
            cls._cached_sql_type = cls.sqlType()
        return cls._cached_sql_type
771628
public String getSQLQuery(boolean bUseCurrentValues, Vector<BaseField> vParamList)
    {
        String strRecordset = this.makeTableNames(false);
        String strFields = this.getSQLFields(DBConstants.SQL_SELECT_TYPE, bUseCurrentValues);
        boolean bIsQueryRecord = this.isQueryRecord();
        String strSortParams = this.addSortParams(bIsQueryRecord, true);

        this.handleInitialKey();        // Set up the smaller key
        String strStartRange = this.addSelectParams(">=", DBConstants.START_SELECT_KEY, true, bIsQueryRecord, bUseCurrentValues, vParamList, true, false);   // Add only if changed
        this.handleEndKey();            // Set up the larger key
        String strEndRange = this.addSelectParams("<=", DBConstants.END_SELECT_KEY, true, bIsQueryRecord, bUseCurrentValues, vParamList, true, false);   // Add only if changed
        String strWhere = DBConstants.BLANK;
        if (strStartRange.length() == 0)
            strWhere = strEndRange;
        else
        {
            if (strEndRange.length() == 0)
                strWhere = strStartRange;
            else
                strWhere = strStartRange + " AND " + strEndRange;
        }
        //      Next, get the recordset filter
            StringBuffer strbFilter = new StringBuffer();
            this.handleRemoteCriteria(strbFilter, bIsQueryRecord, vParamList);  // Add any selection criteria (from behaviors)
            if (strbFilter.length() > 0)
            {
                if (strWhere.length() == 0)
                    strWhere = strbFilter.toString();
                else
                    strWhere += " AND (" + strbFilter.toString() + ")";
            }

        if (strWhere.length() > 0)
            strWhere = " WHERE " + strWhere;
        strRecordset = "SELECT" + strFields + " FROM " + strRecordset + strWhere + strSortParams;
        return strRecordset;
    }
338892
public static Sql getSql(String query, Map<String, Object> parameters) {
		SqlBuilder builder = new SqlBuilder();
		String sql = builder.replaceVariables(query, parameters);
		return new Sql(sql, parameters);
	}
1177572
protected PreparedStatement executeSqlFromScript(String script,
    MapSqlParameterSource args)
  {
    File fScript = new File(scriptPath, script);
    if (fScript.canRead() && fScript.isFile())
    {
      Resource resource = new FileSystemResource(fScript);
      log.debug("executing SQL script: " + resource.getFilename());
      String sql = readSqlFromResource(resource);
      return executeSql(sql, args);
    }
    else
    {
      log.debug("SQL script " + fScript.getName() + " does not exist");
      return null;
    }
  }
1167918
static BindTransform getSqlTransform(TypeName typeName) {
		if (Time.class.getName().equals(typeName.toString())) {
			return new SQLTimeBindTransform();
		}

		if (java.sql.Date.class.getName().equals(typeName.toString())) {
			return new SQLDateBindTransform();
		}

		return null;
	}
850160
public RelDataType getRelDataType(final RelDataTypeFactory typeFactory)
  {
    final RelDataTypeFactory.Builder builder = typeFactory.builder();
    for (final String columnName : columnNames) {
      final ValueType columnType = getColumnType(columnName);
      final RelDataType type;

      if (ColumnHolder.TIME_COLUMN_NAME.equals(columnName)) {
        type = Calcites.createSqlType(typeFactory, SqlTypeName.TIMESTAMP);
      } else {
        switch (columnType) {
          case STRING:
            // Note that there is no attempt here to handle multi-value in any special way. Maybe one day...
            type = Calcites.createSqlTypeWithNullability(typeFactory, SqlTypeName.VARCHAR, true);
            break;
          case LONG:
            type = Calcites.createSqlType(typeFactory, SqlTypeName.BIGINT);
            break;
          case FLOAT:
            type = Calcites.createSqlType(typeFactory, SqlTypeName.FLOAT);
            break;
          case DOUBLE:
            type = Calcites.createSqlType(typeFactory, SqlTypeName.DOUBLE);
            break;
          case COMPLEX:
            // Loses information about exactly what kind of complex column this is.
            type = Calcites.createSqlTypeWithNullability(typeFactory, SqlTypeName.OTHER, true);
            break;
          default:
            throw new ISE("WTF?! valueType[%s] not translatable?", columnType);
        }
      }

      builder.add(columnName, type);
    }

    return builder.build();
  }
1216096
@Nullable
    public <T> T get(ResultSet rs, @Nullable Path<?> path, int i, Class<T> clazz) throws SQLException {
        return getType(path, clazz).getValue(rs, i);
    }