Revision 20976 branches/v10/extensions/extArcims/src/es/prodevelop/cit/gvsig/arcims/fmap/drivers/ArcImsInMemoryAttsTableDriver.java

View differences:

ArcImsInMemoryAttsTableDriver.java
279 279
        return ((Integer) idToIndex.get(new Integer(id))).intValue();
280 280
    }
281 281

  
282
    //	public int getRowId(DataSourceFactory dsf, int row) throws DriverException {
283
    //		/*
284
    //		 SELECT * FROM Customers WHERE LastName = 'Smith'
285
    //		 */
286
    //		String sqlStr = "select " + idFieldName + " from " + tableName + " where ";
287
    //		sqlStr = sqlStr + rowIndexFieldName + " = ";
288
    //		sqlStr = sqlStr + row + ";";
289
    //		/*
290
    //		* INSERT INTO Table1 (Column1, Column2, Column3?)
291
    //		* VALUES (Value1, Value2, Value3?)
292
    //		*/
293
    //		DataSource ds = null;
294
    //		try {
295
    //			
296
    //			ds = dsf.executeSQL(sqlStr, DataSourceFactory.AUTOMATIC_OPENING);
297
    //			// int respind = ds.getFieldIndexByName(idFieldName);
298
    //			IntValue resp = (IntValue) ds.getFieldValue(0, 0);
299
    //			return resp.intValue();
300
    //		} catch (Exception e) {
301
    //			DriverException de = new DriverException(e.getMessage());
302
    //			throw de;
303
    //		}
304
    //	}
305
    //	
306
    //	public int getRowIndex(DataSourceFactory dsf, int id) throws DriverException {
307
    //		String sqlStr = "select " + rowIndexFieldName + " from " + tableName + " where ";
308
    //		sqlStr = sqlStr + idFieldName + " = ";
309
    //		sqlStr = sqlStr + id + ";";
310
    //		/*
311
    //		* INSERT INTO Table1 (Column1, Column2, Column3?)
312
    //		* VALUES (Value1, Value2, Value3?)
313
    //		*/
314
    //		DataSource ds = null;
315
    //		try {
316
    //			ds = dsf.executeSQL(sqlStr, DataSourceFactory.AUTOMATIC_OPENING);
317
    //
318
    //			System.err.println("getRowIndex of id = " + id);
319
    //			System.err.println(ds.getAsString());
320
    //			System.err.println("------------------------------");
321
    //			// int respind = ds.getFieldIndexByName(idFieldName);
322
    //			IntValue resp = (IntValue) ds.getFieldValue(0, 0);
323
    //			return resp.intValue();
324
    //		} catch (Exception e) {
325
    //			DriverException de = new DriverException(e.getMessage());
326
    //			throw de;
327
    //		}
328
    //	}
282

  
329 283
    public boolean isNonRequestedRow(int rowind) {
330 284
        // TODO Auto-generated method stub
331 285
        return (!requested.get(rowind));
332 286
    }
333 287

  
334
    // public void updateRow(DataSourceFactory dsf, Value[] new_row, String[] fld_q) throws DriverException {
335 288
    // TODO so far, this method is called with
336 289
    // a full field query (except rowindex)
337 290
    public void updateRow(Value[] upd_row, String[] fld_q, int rowind)
......
378 331
            }
379 332
        }
380 333

  
381
        //		data.set()
382
        //		String[] fld_query = null;
383
        //		if (fld_q[0].compareTo("#ALL#") == 0) {
384
        //			
385
        //			int count = getFieldCount() - 1;
386
        //			fld_query = new String[count];
387
        //			for (int i=0; i<count; i++) {
388
        //				fld_query[i] = getFieldName(i);
389
        //			}
390
        //			
391
        //			
392
        //		} else {
393
        //			fld_query = new String[fld_q.length];
394
        //			for (int i=0; i<fld_q.length; i++) {
395
        //				fld_query[i] = ArcImsSqlUtils.getSqlCompliantFieldName(fld_q[i]);
396
        //			}
397
        //		}
398
        //		
399
        //		IntValue id = null;
400
        //		for (int i=0; i<fld_query.length; i++) {
401
        //			if (fld_query[i].compareTo(idFieldName) == 0) {
402
        //				id = (IntValue) new_row[i];
403
        //			}
404
        //		}
405
        //		if (id == null) {
406
        //			DriverException de = new DriverException("id_not_found");
407
        //			throw de;
408
        //		}
409
        //		int intid = id.intValue();
410
        //		
411
        //		String sqlStr = "update " + tableName + " set ";
412
        //		String nthFieldName, nthFieldValue;
413
        //		for (int i=0; i<fld_query.length; i++) {
414
        //			nthFieldName = fld_query[i];
415
        //			nthFieldValue = this.getValueInSqlFormat(new_row[i]);
416
        //			sqlStr = sqlStr + nthFieldName + " = ";
417
        //			sqlStr = sqlStr + nthFieldValue + ", ";
418
        //		}
419
        //		sqlStr = sqlStr.substring(0, sqlStr.length() - 2);
420
        //		sqlStr = sqlStr + " where " + idFieldName + " = " + intid + ";";
421
        //		try {
422
        //			// dsf.executeSQL(sqlStr, DataSourceFactory.AUTOMATIC_OPENING);
423
        //			execute(sqlStr);
424
        //		} catch (Exception e) {
425
        //			DriverException de = new DriverException(e.getMessage());
426
        //			throw de;
427
        //		}
428 334
    }
429 335

  
430 336
    public int getFieldIndexByName(String arg0) throws DriverException {
......
450 356
        throws DriverException {
451 357
        return (Value[]) data.get(n);
452 358

  
453
        //		String sqlStr = "select * from " + tableName + " where ";
454
        //		sqlStr = sqlStr + rowIndexFieldName + " = " + n + ";";
455
        //
456
        //		try {
457
        //			DataSource ds =
458
        //				dsf.executeSQL(sqlStr, DataSourceFactory.AUTOMATIC_OPENING);
459
        //			// int respind = ds.getFieldIndexByName(idFieldName);
460
        //			int count = ds.getFieldCount();
461
        //			Value[] resp = new Value[count];
462
        //			for (int i=0; i<count; i++) {
463
        //				resp[i] = ds.getFieldValue(0, i);
464
        //			}
465
        //			return resp;
466
        //		} catch (Exception e) {
467
        //			DriverException de = new DriverException(e.getMessage());
468
        //			throw de;
469
        //		}
470 359
    }
471 360

  
472
    //	public String getRowIndexFieldName() {
473
    //		return rowIndexFieldName;
474
    //	}
475 361
    public void setRequested(int n, boolean req) {
476 362
        requested.set(n, req);
477 363
    }
......
496 382
        return ((Integer) columnTypes.get(i)).intValue();
497 383
    }
498 384

  
499
    //	public void addInIndexToIdHashMap(int rwcount, int i) {
500
    //		indexToId.put(new Integer(rwcount), new Integer (i));
501
    //	}
502 385
    public void addInIdToIndexHashMap(int i, int rwcount) {
503 386
        idToIndex.put(new Integer(i), new Integer(rwcount));
504 387
    }
505 388

  
506
    //	public String getColumnName(int i) {
507
    //		return (String) columnNames.get(i);
508
    //	}
509

  
510
    //	public void increaseRowCount(boolean req) {
511
    //		requested.set(data.size(), req);
512
    //		theRowCount++;
513
    //	}
514 389
    public void addAsRequested(FBitSet fbs) {
515 390
        requested.or(fbs);
516 391
    }
......
598 473
            lastRequest.width + " ]");
599 474
    }
600 475

  
601
    //	public Value getCachedValue(int row, int attind) {
602
    //		return attsCache.getAttribute(row, attind);
603
    //	}
604
    //	
605
    //	public void setCachedValue(int row, int attind, Value v) {
606
    //		attsCache.addToCache(row, attind, v);
607
    //	}
608 476
    public int getIdColumnInd(ArrayList col_Types) {
609 477
        int coltype;
610 478
        int idindex = -1;

Also available in: Unified diff