Converts array of Object into sql.Array

@param conn  connection for which sql.Array object would be created
@param array array of objects
@return sql.Array from array of Object
@throws SQLException
176924
public static Object convertArray(Connection conn, Object[] array) throws SQLException {
        Object result = null;

        result = createArrayOf(conn, convertJavaClassToSqlType(array.getClass().getComponentType().getSimpleName()), array);

        return result;
    }
76105
public long[] executeInsert(Connection conn, DataObject object, boolean generatedKeys) throws SQLException {
        PreparedStatement statement = conn.prepareStatement(_sql, generatedKeys ? Statement.RETURN_GENERATED_KEYS : Statement.NO_GENERATED_KEYS);
        try {
            load(statement, object);
            long[] keys = new long[statement.executeUpdate()];
            if (generatedKeys) {
                ResultSet rs = statement.getGeneratedKeys();
                for (int i = 0; rs.next(); ++i) {
                    keys[i] = rs.getLong(1);
                }
                rs.close();
            }
            return keys;
        } finally {
            statement.close();
        }
    }
314478
public int[] insert(Connection conn, Collection<Entity> records) throws SQLException {
		return insert(conn, records.toArray(new Entity[records.size()]));
	}
708524
protected Stream<T> getAll(Connection conn) {
        return executeSelectAsStream(rowMapper, conn, true, calcSqlSelectAll());
    }
423092
public List<Entity> findIn(Connection conn, String tableName, String field, Object... values) throws SQLException{
		return findAll(conn, Entity.create(tableName).set(field, values));
	}
927085
public int[] insert(Collection<Entity> records) throws SQLException {
		Connection conn = null;
		try {
			conn = this.getConnection();
			return runner.insert(conn, records);
		} catch (SQLException e) {
			throw e;
		} finally {
			this.closeConnection(conn);
		}
	}
49835
public List<User> find(Connection conn, String str, Criteria criteria) throws SQLException {
        ResultSetHandler<List<User>> h = new BeanListHandler<User>(User.class);
        String sql = "\n";
        if (str !=null && !str.trim().isEmpty()) {
            sql = "WHERE username||fullname ~ '"+str+"' \n";
        }

        if (criteria != null && criteria.getLimit() >0) {
            ResultSetHandler<Long> scalar = new ScalarHandler<Long>(1);
            String totalSql = "SELECT COUNT(id) FROM userbase \n"+sql;
            int total = ((Long)run.query(conn, totalSql, scalar)).intValue();
            criteria.setTotal(total);
        }

        sql =
            "SELECT id,username,fullname,type,emailaddress,registered_ts,invited_by,enabled \n"+
            "FROM userbase \n"+sql;

        sql = SQLBuilder.getSortClause(sql,criteria);
        sql = SQLBuilder.getPagingClause(sql,criteria);
        return run.query(conn, sql, h);
    }
1154947
protected void setArrayValue(final PreparedStatement statement, final int i, Connection connection, Object[] array)
            throws SQLException {
        if (array == null || (isEmptyStoredAsNull() && array.length == 0)) {
            statement.setNull(i, Types.ARRAY);
        } else {
            statement.setArray(i, connection.createArrayOf(getDialectPrimitiveName(), array));
        }
    }
563874
protected static ResultSet getColumnMetaData (Connection conn, String table, String column)
        throws SQLException
    {
        ResultSet rs = conn.getMetaData().getColumns("", "", table, column);
        while (rs.next()) {
            String tname = rs.getString("TABLE_NAME");
            String cname = rs.getString("COLUMN_NAME");
            if (tname.equals(table) && cname.equals(column)) {
                return rs;
            }
        }
        throw new SQLException("Table or Column not defined. [table=" + table +
                               ", col=" + column + "].");
    }
1155496
function(conn) {
    var coll = CollMethods.Instance(dbLit, conn);
    var dbMethods = DBMethods(dbLit, conn);
    var dbMethodKeys = Object.keys(dbMethods);

    return {
      getOwnPropertyNames: function() {
        conn.db.collectionNames(conn.flow.add());

        return conn.flow.wait().map(function(obj) {
          var collName = obj.name;
          return collName.substr(collName.indexOf('.') + 1);
        }).concat(dbMethodKeys.map(function(methodName) {
          return util.format('%s(', methodName);
        }));
      },
      getOwnPropertyDescriptor: function(proxy, collectionName) {
        return {
          writable: false,
          enumerable: false,
          configurable: true
        };
      },
      getPropertyDescriptor: function(proxy, collectionName) {
        return this.getOwnPropertyDescriptor(proxy, collectionName);
      },
      get: function(proxy, op1) {
        if (op1 === 'getConn') {
          return function() { return conn; };
        } else if (op1 === '_name') {
          return conn.db.databaseName;
        } else if (op1 === 'toString') {
          return function() { return conn.db.databaseName; };
        }

        if (dbMethodKeys.indexOf(op1) !== -1) {
          return dbMethods[op1];
        }

        var collOps = coll(op1);
        var collOpKeys = Object.keys(collOps);
        var _this = this;
        return Proxy.create({
          getOwnPropertyNames: function() {
            var collNames = _this.getOwnPropertyNames();
            var matchColls = collNames.filter(function(collName) {
              return collName !== op1 &&
                collName.indexOf(op1) !== -1;
            }).map(function(collName) {
              var ext = collName.substr(collName.indexOf('.') + 1);
              var subExt = ext.indexOf(op1);
              if (subExt != -1) {
                return '';
              }
              return ext;
            }).filter(function(collName) {
              return collName.length;
            });
            if (matchColls.length) {
              return matchColls;
            }
            return collOpKeys.map(function(collOpKey) {
              return util.format('%s(', collOpKey);
            });
          },
          getOwnPropertyDescriptor: function(proxy, op) {
            return _this.getOwnPropertyDescriptor(proxy, op);
          },
          getPropertyDescriptor: function(proxy, op) {
            return _this.getPropertyDescriptor(proxy, op);
          },
          get: function(proxy, op2) {
            if (collOpKeys.indexOf(op2) !== -1) {
              return collOps[op2];
            }
            return _this.get(proxy, op1 + '.' + op2);
          }
        });
      }
    };
  }
1336246
private function connect(array &$connections)
    {
        $exceptions = [];
        while (count($connections) > 0) {
            /** @var Connection $connection */
            $connection = array_pop($connections);

            try {
                if ($connection->open()) {
                    return $connection;
                }
            } catch (DatabaseException $e) {
                $exceptions[] = $e->getMessage();
            }
        }

        throw new ConnectionException(
            'Unable to select connection.',
            '',
            0,
            count($exceptions) > 0 ? new ConnectionException(implode(' ', $exceptions)) : null
        );
    }
570331
public static int[] executeBatch(Connection conn, String sql, Iterable<Object[]> paramsBatch) throws SQLException {
		PreparedStatement ps = null;
		try {
			ps = StatementUtil.prepareStatementForBatch(conn, sql, paramsBatch);
			return ps.executeBatch();
		} finally {
			DbUtil.close(ps);
		}
	}
1339964
public static PreparedStatement prepareStatement(Connection conn, String sql, Collection<Object> params) throws SQLException {
		return prepareStatement(conn, sql, params.toArray(new Object[params.size()]));
	}
320106
public List<Entity> findBy(Connection conn, String tableName, String field, Object value) throws SQLException{
		return findAll(conn, Entity.create(tableName).set(field, value));
	}
1077712
public static Object convertSqlXml(Connection conn, byte[] value) throws SQLException {
        Object result = createSQLXML(conn);

        result = convertSqlXml(result, value);

        return result;
    }
612068
function ExecuteSQLArray($sql, $continueOnError = true)
	{
		$rez = 2;
		$conn = $this->connection;
		$saved = $conn->debug;
		foreach($sql as $line) {

			if ($this->debug) $conn->debug = true;
			$ok = $conn->Execute($line);
			$conn->debug = $saved;
			if (!$ok) {
				if ($this->debug) ADOConnection::outp($conn->ErrorMsg());
				if (!$continueOnError) return 0;
				$rez = 1;
			}
		}
		return $rez;
	}
1355710
public int executeProcedure(Connection conn, DataObject object) throws SQLException {
        CallableStatement statement = conn.prepareCall(_sql);
        try {
            for (int i = 0; i < _params.length; ++i) {
                if ((_params[i].direction & Param.OUT) == 0) continue;
                statement.registerOutParameter(i+1, _params[i].type);
            }
            load(statement, object);
            statement.execute();

            int result = statement.getUpdateCount();

            if (object != null) {
                Class<? extends DataObject> type = object.getClass();
                for (int i = 0; i < _params.length; ++i) {
                    if ((_params[i].direction & Param.OUT) == 0) continue;
                    try {
                        Beans.setValue(object, Beans.getKnownField(type, _params[i].name), statement.getObject(i+1));
                    } catch (NoSuchFieldException x) {
                        // ignore
                    } catch (Exception x) {
                        throw new SQLException("Exception in storage of '" + _params[i].name + "' into DataObject (" + type.getName() + ')', x);
                    }
                }
            }
            return result;
        } finally {
            statement.close();
        }
    }