Package org.eclipse.imp.pdb.facts

Examples of org.eclipse.imp.pdb.facts.IInteger


  }
 
  public IConstructor createConnection(IString connectString) {
    try {
      Connection conn = DriverManager.getConnection(connectString.getValue());
      IInteger newKey = vf.integer(++connectionCounter);
      connectionMap.put(newKey, conn);
      return vf.constructor(JDBC.jdbcConnection, newKey);
    } catch (SQLException sqle) {
      throw RuntimeExceptionFactory.illegalArgument(connectString, null, null, addMessage("Could not connect with given connect string", sqle));
    }
View Full Code Here


    }
  }
 
  public void closeConnection(IConstructor connection) {
    try {
      IInteger connectionId = (IInteger) connection.get(0);
      if (connectionMap.containsKey(connectionId)) {
        Connection conn = connectionMap.get(connectionId);
        conn.close();
        connectionMap.remove(connectionId);
      } else {
View Full Code Here

    }
  }

  public IList getTableTypes(IConstructor connection) {
    try {
      IInteger connectionId = (IInteger) connection.get(0);
      if (connectionMap.containsKey(connectionId)) {
        Connection conn = connectionMap.get(connectionId);
        DatabaseMetaData dmd = conn.getMetaData();
        ResultSet rs = dmd.getTableTypes();
        IListWriter resultWriter = this.vf.listWriter(TF.stringType());
View Full Code Here

    }
  }

  public ISet getTableNames(IConstructor connection) {
    try {
      IInteger connectionId = (IInteger) connection.get(0);
      if (connectionMap.containsKey(connectionId)) {
        Connection conn = connectionMap.get(connectionId);
        DatabaseMetaData dmd = conn.getMetaData();
        ResultSet rs = dmd.getTables(null, null, null, new String[] { "TABLE" });
        HashSet<String> tables = new HashSet<String>();
View Full Code Here

    }
  }

  public ISet getViewNames(IConstructor connection) {
    try {
      IInteger connectionId = (IInteger) connection.get(0);
      if (connectionMap.containsKey(connectionId)) {
        Connection conn = connectionMap.get(connectionId);
        DatabaseMetaData dmd = conn.getMetaData();
        ResultSet rs = dmd.getTables(null, null, null, new String[] { "VIEW" });
        HashSet<String> tables = new HashSet<String>();
View Full Code Here

  }
 
  private ISet getTablesOrViews(IConstructor connection, String[] tableTypes) {
    // TODO: Add code to check and make sure the table types are valid
    try {
      IInteger connectionId = (IInteger) connection.get(0);
      if (connectionMap.containsKey(connectionId)) {
        Connection conn = connectionMap.get(connectionId);
        DatabaseMetaData dmd = conn.getMetaData();
        ResultSet rs = dmd.getTables(null, null, null, tableTypes);
        HashSet<String> tables = new HashSet<String>();
View Full Code Here

  }
 
  // TODO: Handle the case where the table name does not exist
  public IConstructor getTable(IConstructor connection, IString tableName) {
    try {
      IInteger connectionId = (IInteger) connection.get(0);
      if (connectionMap.containsKey(connectionId)) {
        Connection conn = connectionMap.get(connectionId);
        DatabaseMetaData dmd = conn.getMetaData();
        ResultSet rs = dmd.getColumns(null, null, tableName.getValue(), null);
        IListWriter listRes = vf.listWriter(Column);
View Full Code Here

 
 
  // TODO: Add more error handling code...
  public IValue loadTable(IValue resultType, IConstructor connection, IString tableName) {
    try {
      IInteger connectionId = (IInteger) connection.get(0);
      if (connectionMap.containsKey(connectionId)) {
        Connection conn = connectionMap.get(connectionId);
        PreparedStatement stmt = conn.prepareStatement("SELECT * FROM " + tableName.getValue());
        ResultSet rs = stmt.executeQuery();
       
View Full Code Here

  }

  // TODO: Add more error handling code...
  public IValue loadTable(IConstructor connection, IString tableName) {
    try {
      IInteger connectionId = (IInteger) connection.get(0);
      if (connectionMap.containsKey(connectionId)) {
        Connection conn = connectionMap.get(connectionId);
        PreparedStatement stmt = conn.prepareStatement("SELECT * FROM " + tableName.getValue());
        ResultSet rs = stmt.executeQuery();
       
View Full Code Here

    }
  }

  public IValue loadTableOrdered(IValue resultType, IConstructor connection, IString tableName) {
    try {
      IInteger connectionId = (IInteger) connection.get(0);
      if (connectionMap.containsKey(connectionId)) {
        Connection conn = connectionMap.get(connectionId);
        PreparedStatement stmt = conn.prepareStatement("SELECT * FROM " + tableName.getValue());
        ResultSet rs = stmt.executeQuery();
       
View Full Code Here

TOP

Related Classes of org.eclipse.imp.pdb.facts.IInteger

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.