From: cvs@openprivacy.orgCVS update: sierra/src/java/org/openprivacy/sierra/query/talon/implementations/simple
Date: Tuesday March 13, 19101 @ 19:25
Author: burton
CVSWEB Options: -------------------
Main CVSWeb: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi
View this module: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/query/talon/implementations/simple
-----------------------------------
Update of /usr/local/cvs/public/sierra/src/java/org/openprivacy/sierra/query/talon/implementations/simple
In directory giga:/tmp/cvs-serv606/src/java/org/openprivacy/sierra/query/talon/implementations/simple
Modified Files:
SimpleQueryEngine.java
Log Message:
seems like all db inserts work correctly without violating SQL db integrity..
*****************************************************************
File: sierra/src/java/org/openprivacy/sierra/query/talon/implementations/simple/SimpleQueryEngine.java
CVSWEB Options: -------------------
CVSWeb: Annotate this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/query/talon/implementations/simple/SimpleQueryEngine.java?annotate=1.4
CVSWeb: View this file: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/query/talon/implementations/simple/SimpleQueryEngine.java?rev=1.4&content-type=text/x-cvsweb-markup
CVSWeb: Diff to previous version: http://openprivacy.org/cgi-bin/cvsweb/cvsweb.cgi/sierra/src/java/org/openprivacy/sierra/query/talon/implementations/simple/SimpleQueryEngine.java.diff?r1=1.4&r2=1.3
-----------------------------------
Index: sierra/src/java/org/openprivacy/sierra/query/talon/implementations/simple/SimpleQueryEngine.java
diff -u sierra/src/java/org/openprivacy/sierra/query/talon/implementations/simple/SimpleQueryEngine.java:1.3 sierra/src/java/org/openprivacy/sierra/query/talon/implementations/simple/SimpleQueryEngine.java:1.4
--- sierra/src/java/org/openprivacy/sierra/query/talon/implementations/simple/SimpleQueryEngine.java:1.3 Tue Mar 13 15:43:50 2001
+++ sierra/src/java/org/openprivacy/sierra/query/talon/implementations/simple/SimpleQueryEngine.java Tue Mar 13 19:25:49 2001
@@ -37,7 +37,7 @@
/**
* @see QueryManager
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: SimpleQueryEngine.java,v 1.3 2001/03/13 23:43:50 burton Exp $
+ * @version $Id: SimpleQueryEngine.java,v 1.4 2001/03/14 03:25:49 burton Exp $
*/
public class SimpleQueryEngine extends BaseComponent implements Component, QueryEngine {
@@ -60,7 +60,7 @@
/**
* @see QueryEngine
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: SimpleQueryEngine.java,v 1.3 2001/03/13 23:43:50 burton Exp $
+ * @version $Id: SimpleQueryEngine.java,v 1.4 2001/03/14 03:25:49 burton Exp $
*/
public Result execute( Query query ) throws SierraException {
return null;
@@ -71,7 +71,7 @@
* Add a reputation for indexing...
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: SimpleQueryEngine.java,v 1.3 2001/03/13 23:43:50 burton Exp $
+ * @version $Id: SimpleQueryEngine.java,v 1.4 2001/03/14 03:25:49 burton Exp $
*/
public void addReputation( Reputation reputation ) throws SierraException {
@@ -133,7 +133,7 @@
*
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: SimpleQueryEngine.java,v 1.3 2001/03/13 23:43:50 burton Exp $
+ * @version $Id: SimpleQueryEngine.java,v 1.4 2001/03/14 03:25:49 burton Exp $
*/
private void insertIntoPropertiesTable( DatabaseConnectionPool dcp, Payload payload )
throws Exception {
@@ -169,22 +169,40 @@
Enumeration keys = pmp.getKeys();
while ( keys.hasMoreElements() ) {
-
- //FIXME: I am adding all records as strings here. This is a BAD
- //idea. It is much better to add the appropriate types.
- String name = (String)keys.nextElement();
- String value = pmp.getString( name );
- Insert insert = new Insert();
- insert.setDatabaseConnectionPool( dcp )
+ //only update if there are no properties already entered from this reputation.
+
+ Select verify = new Select();
+ verify.setDatabaseConnectionPool( dcp )
.setTable( "properties" )
.addInteger( "reputation", reputation )
- .addInteger( "identifier", identifier )
- .addString( "name", name )
- .addString( "value", value )
- .addString( "type", "string" );
+ .addInteger( "identifier", identifier );
- insert.commit();
+ verify.commit();
+
+
+ if ( verify.getResultSet().next() == false) {
+
+ //FIXME: I am adding all records as strings here. This is a BAD
+ //idea. It is much better to add the appropriate types.
+ String name = (String)keys.nextElement();
+ String value = pmp.getString( name );
+
+ Insert insert = new Insert();
+ insert.setDatabaseConnectionPool( dcp )
+ .setTable( "properties" )
+ .addInteger( "reputation", reputation )
+ .addInteger( "identifier", identifier )
+ .addString( "name", name )
+ .addString( "value", value )
+ .addString( "type", "string" );
+
+ insert.commit();
+
+ } else {
+ break;
+ }
+
}
@@ -194,7 +212,7 @@
*
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: SimpleQueryEngine.java,v 1.3 2001/03/13 23:43:50 burton Exp $
+ * @version $Id: SimpleQueryEngine.java,v 1.4 2001/03/14 03:25:49 burton Exp $
*/
private void insertIntoIdentifiersTable( DatabaseConnectionPool dcp, Payload payload )
throws Exception {
@@ -228,7 +246,7 @@
*
*
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: SimpleQueryEngine.java,v 1.3 2001/03/13 23:43:50 burton Exp $
+ * @version $Id: SimpleQueryEngine.java,v 1.4 2001/03/14 03:25:49 burton Exp $
*/
private void insertIntoReputationsTable( DatabaseConnectionPool dcp, Reputation reputation )
throws Exception {
@@ -262,7 +280,7 @@
/**
* @see QueryEngine
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: SimpleQueryEngine.java,v 1.3 2001/03/13 23:43:50 burton Exp $
+ * @version $Id: SimpleQueryEngine.java,v 1.4 2001/03/14 03:25:49 burton Exp $
*/
public boolean supports( Reputation reputation ) {
@@ -286,7 +304,7 @@
/**
* @see QueryEngine
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: SimpleQueryEngine.java,v 1.3 2001/03/13 23:43:50 burton Exp $
+ * @version $Id: SimpleQueryEngine.java,v 1.4 2001/03/14 03:25:49 burton Exp $
*/
public boolean supports( Payload payload ) {
@@ -297,7 +315,7 @@
/**
* @see QueryEngine
* @author <a href="mailto:burton@relativity.yi.org">Kevin A. Burton</a>
- * @version $Id: SimpleQueryEngine.java,v 1.3 2001/03/13 23:43:50 burton Exp $
+ * @version $Id: SimpleQueryEngine.java,v 1.4 2001/03/14 03:25:49 burton Exp $
*/
public boolean supports( Query query ) {
//FIXME: for now support all queries.
This archive was generated by hypermail 2b30 : Tue Mar 13 2001 - 19:25:59 PST