Package anvil.core

Examples of anvil.core.Any


    ftpClient.login(ftpURL.user,ftpURL.pass);
    ftpClient.binary();
    ftpClient.cd(ftpURL.dir);

    BufferedReader reader;
    Any result;

    switch (returnType) {

    case StreamUtils.TYPE_STRING:
      reader = new BufferedReader(new InputStreamReader(ftpClient.get(ftpURL.file)));
View Full Code Here


    ftpClient.login(ftpURL.user,ftpURL.pass);
    ftpClient.binary();
    ftpClient.cd(ftpURL.dir);

    BufferedWriter writer;
    Any result;

    switch (type) {

    case StreamUtils.TYPE_STRING:
      writer = new BufferedWriter(new OutputStreamWriter(ftpClient.put(ftpURL.file)));
View Full Code Here

    ftpClient.cd(ftpURL.dir);

    BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(ftpClient.put(ftpURL.file)));
    writer.write(string);
    writer.close();
    Any result = Any.TRUE;
    try {
      ftpClient.closeServer();
    } catch (Exception e) {
      //anvil.Log.log().error("Can not close ftp connection");
    }
View Full Code Here

    case StreamUtils.TYPE_BINARY:
      return streamToAnyByteArray(new FileInputStream(file));

    case StreamUtils.TYPE_DATA:
      InputStream inputStream = new FileInputStream(file);
      Any data = Serialization.unserialize(context, inputStream);
      inputStream.close();
      return data;

    default:
      return Any.NULL;
View Full Code Here

    if (query.indexOf('?')>-1)  {
      int n = query.length();
      int param = offset;
      int paramCount = parameters.length;
      char ch;
      Any data;
      StringBuffer buffer = new StringBuffer(1 + n + n/2);
      int i = 0;
      while(i<n) {
        switch((ch = query.charAt(i++))) {
        case '?':
          if (i<n && query.charAt(i) == '?') {
            buffer.append('?');
            i++;
            break;
          }
          data = ((parameters != null) && (param < paramCount)) ? parameters[param++] : Any.NULL;
          switch(data.typeOf()) {
          case Any.IS_NULL:
          case Any.IS_UNDEFINED:
            buffer.append("null");
            break;

          case Any.IS_BOOLEAN:
            buffer.append(data.toBoolean() ? "'true'" : "'false'");
            break;

          case Any.IS_INT:
            buffer.append(data.toLong());
            break;

          case Any.IS_DOUBLE:
            buffer.append(data.toDouble());
            break;

          case Any.IS_STRING:
          case Any.IS_BUFFER:
          case Any.IS_BINARY:
            buffer.append('\'');
            Conversions.escape(buffer, data.toString(), true);
            buffer.append('\'');
            break;

          default:
            buffer.append("null");
            break;
          }
          break;

        case '$':
          if (i<n && query.charAt(i) == '$') {
            buffer.append('$');
            i++;
          } else {
            data = ((parameters != null) && (param < paramCount)) ? parameters[param++] : Any.NULL;
            buffer.append(data.toString());
          }
          break;

        default:
          buffer.append(ch);
View Full Code Here

  }


  public Any getVariable(String name)
  {
    Any value = (Any)_variables.get(name);
    return value != null ? value : Any.UNDEFINED;
  }
View Full Code Here

  private final anvil.core.Array getRow(Context context) throws SQLException
  {
    ResultSetMetaData metadata = getMetaData();
    int n = metadata.getColumnCount();
    anvil.core.Array row = new anvil.core.Array(n);
    Any value;
    String name;
    for(int i=1; i<=n; i++) {
      value = SQLUtil.getField(_resultSet, metadata, i);
      name = metadata.getColumnName(i);
      if (name != null) {
View Full Code Here

      return NULL;
    }
    int n = list.length;
    Array files = new Array(n);
    for(int i=0; i<n; i++) {
      Any name = Any.create(list[i]);
      files.put(name, name);
    }
    return files;
  }
View Full Code Here

  {
    int n = parameters.length;
    try {
      ensureOpen(context, "rw");
      for(int i=0; i<n; i++) {
        Any value = parameters[i];
        switch(value.typeOf()) {
        case IS_NULL:
        case IS_UNDEFINED:
          break;
        case IS_INT:
          _access.write(value.toInt());
          break;
        case IS_BINARY:
          n = value.sizeOf();
          if (n > 0) {
            _access.write(value.toBinary(), 0, n);
          }
          break;
        default:
          String buffer = value.toString();
          if (buffer.length()>0) {
            _access.writeBytes(buffer);
          }
        }
      }
View Full Code Here

        queryString = query;
      } else {
        queryString = SQLUtil.buildQueryString(query, parameters, 0);
      }
     
      Any returnValue;
      if (stmt.execute(queryString)) {
        returnValue = new AnyResultSet(stmt.getResultSet(), stmt);
        // statement is closed when resultset.close() is called
      } else {
        if (stmt.getClass().getSuperclass().getName().equals("com.mysql.jdbc.Statement")) {
View Full Code Here

TOP

Related Classes of anvil.core.Any

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.