Revision 3109 trunk/extensions/extJDBC/src/com/iver/cit/gvsig/fmap/drivers/jdbc/postgis/testPostGis.java

View differences:

testPostGis.java
74 74
      String dbuser = "postgres";
75 75
      String dbpass = "aquilina";
76 76

  
77
      String dbtable = "vias";
77
      String dbtable = "provin";
78 78

  
79 79
     java.sql.Connection conn; 
80 80
        try 
......
104 104
          /* 
105 105
          * Create a statement and execute a select query. 
106 106
          */
107
            // String strSQL = "select ASBINARY(the_geom) as geom, nom_provin from " + dbtable;
108
            String strSQL = "select ASBINARY(the_geom) as geom from " + dbtable;
107
            String strSQL = "select ASBINARY(the_geom) as geom, nom_provin from " + dbtable;
108
            // String strSQL = "select ASBINARY(the_geom) as geom from " + dbtable;
109 109
            // strSQL = "select ASTEXT(the_geom), nom_provin as geom from " + dbtable;
110 110
            /* String strSQL = "SELECT gid, rd_3, rd_5, rd_6, rd_10, rd_11, rd_12, rd_13, rd_14,"; 
111 111
            strSQL = strSQL + " rd_15, rd_16, kilometers, cost, metros, AsText(force_2d(the_geom)) FROM vias"; 
......
118 118
            
119 119
            // Statement s = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
120 120
            // s.setFetchSize(5);
121
            int fetchSize = 200000;
121
            int fetchSize = 5;
122 122
			s.execute("declare wkb_cursor binary cursor for " + strSQL);
123
			// ResultSet r =	s.executeQuery("fetch forward " + fetchSize + " in wkb_cursor");
124
            ResultSet r =   s.executeQuery("fetch forward all in wkb_cursor");
123
			ResultSet r =	s.executeQuery("fetch forward " + fetchSize + " in wkb_cursor");
124
            /// ResultSet r =   s.executeQuery("fetch forward all in wkb_cursor");
125 125
            			
126 126
            // ResultSet r = s.executeQuery(strSQL);
127 127
			long t2 = System.currentTimeMillis();
......
151 151
              // Object obj = r.getObject(2);
152 152
              byte[] arrayByte = r.getBytes(1);
153 153
              IGeometry gp = parser.parse(arrayByte);
154
              // String strAux = r.getString(1);
154
              String strAux = r.getString(2);
155 155
              // int id = r.getInt(2);
156 156
              // System.out.println("Fila " + id + ":" + obj.toString());
157 157
              id++;
158 158
              // Geometry regeom = PGgeometry.geomFromString(obj.toString());
159 159
              
160 160
            // PGgeometry geom = (PGgeometry)obj; 
161
            /* int id = r.getInt(2);
162
            System.out.println("Row " + id + ":"); 
163
            System.out.println(geom.toString()); */ 
161
             // int id = r.getInt(2);
162
            System.out.println("Row " + id + ":" + strAux); 
163
            // System.out.println(geom.toString()); 
164 164
              // System.out.println("provin=" + r.getString(2));
165 165
              if ((id % fetchSize) == 0)
166 166
              {

Also available in: Unified diff