From bf3a412830cd7d1ccbd62375b628f7ade2ed390d Mon Sep 17 00:00:00 2001 From: Pablo Cornejo Date: Tue, 14 May 2019 09:05:11 -0400 Subject: [PATCH 1/4] add type DATE --- src/earlgrey/core/ModelCore.java | 20 +++++++++++++- src/earlgrey/database/OracleConnector.java | 32 ++++++++++++++++++---- 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/src/earlgrey/core/ModelCore.java b/src/earlgrey/core/ModelCore.java index 8c6bf3e..52c2622 100644 --- a/src/earlgrey/core/ModelCore.java +++ b/src/earlgrey/core/ModelCore.java @@ -31,6 +31,7 @@ import earlgrey.error.Error70; import earlgrey.error.Error800; import earlgrey.types.IType; +import oracle.sql.DATE; public class ModelCore { protected ResultSet set; @@ -217,6 +218,9 @@ else if(campo.getType().equals(String.class)){ else if(campo.getType().equals(Timestamp.class)){ campo.set(m, set.getString(llave)); } + else if(campo.getType().equals(DATE.class)){ + campo.set(m, set.getDate(llave)); + } else if(IType.class.isAssignableFrom(campo.getType())){ try { Method inv = campo.getType().getMethod("GetSQLResult", Object.class); @@ -255,6 +259,9 @@ else if(campo.getType().equals(String.class)){ else if(campo.getType().equals(Timestamp.class)){ campo.set(m, set.getString(llave)); } + else if(campo.getType().equals(DATE.class)){ + campo.set(m, set.getDate(llave)); + } else if(IType.class.isAssignableFrom(campo.getType())){ try { Method inv = campo.getType().getMethod("GetSQLResult", Object.class); @@ -324,6 +331,9 @@ else if(campo.getType().equals(String.class)){ else if(campo.getType().equals(Timestamp.class)){ objeto.put(llave, set.getString(llave)); } + else if(campo.getType().equals(DATE.class)){ + objeto.put(llave, set.getDate(llave)); + } else if(IType.class.isAssignableFrom(campo.getType())){ try { Method inv = campo.getType().getMethod("GetSQLResult", Object.class); @@ -368,6 +378,9 @@ else if(campo.getType().equals(String.class)){ else if(campo.getType().equals(Timestamp.class)){ objeto.put(llave, set.getString(llave)); } + else if(campo.getType().equals(DATE.class)){ + objeto.put(llave, set.getDate(llave)); + } else if(IType.class.isAssignableFrom(campo.getType())){ try { Method inv = campo.getType().getMethod("GetSQLResult", Object.class); @@ -454,6 +467,9 @@ else if(campo.getType().equals(String.class)){ else if(campo.getType().equals(Timestamp.class)){ campo.set(this, query.getString(llave)); } + else if(campo.getType().equals(DATE.class)){ + campo.set(this, query.getString(llave)); + } } } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException | JSONException e) { // TODO Auto-generated catch block @@ -588,7 +604,9 @@ private Hashtable getparams(JSONObject params) { campo.set(mc, params.getString(key)); } else if(campo.getType().equals(Timestamp.class)){ campo.set(mc, params.getString(key)); - } + } else if(campo.getType().equals(DATE.class)){ + campo.set(mc, params.getString(key)); + } else { continue; } diff --git a/src/earlgrey/database/OracleConnector.java b/src/earlgrey/database/OracleConnector.java index 9433fb8..9469ec2 100644 --- a/src/earlgrey/database/OracleConnector.java +++ b/src/earlgrey/database/OracleConnector.java @@ -1,19 +1,16 @@ package earlgrey.database; -import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.sql.Connection; import java.sql.Driver; import java.sql.DriverManager; -import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.Timestamp; import java.util.ArrayList; -import java.util.Enumeration; import java.util.Hashtable; import javax.naming.Context; @@ -21,12 +18,10 @@ import javax.sql.DataSource; import org.json.JSONException; -import org.json.JSONObject; import earlgrey.annotations.DatabaseDriver; import earlgrey.core.ConnectionPool; import earlgrey.core.Logging; -import earlgrey.core.ModelCore; import earlgrey.core.Properties; import earlgrey.core.ResourceMaping; import earlgrey.def.Database; @@ -34,6 +29,7 @@ import earlgrey.types.IType; import earlgrey.types.ObraType; import oracle.jdbc.OraclePreparedStatement; +import oracle.sql.DATE; @DatabaseDriver(type="SQL", name="Oracle", id = Database.ORACLE) public class OracleConnector implements Connector{ @@ -385,6 +381,14 @@ else if(campo.getType().equals(Timestamp.class)){ e.printStackTrace(); } } + else if(campo.getType().equals(DATE.class)){ + try { + this.pstm.setDATE(this.prepared_fields++, (DATE)prepare_fields.get(campo)); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else if(campo.getType().equals(String.class)){ try { this.pstm.setString(this.prepared_fields++, (String)prepare_fields.get(campo)); @@ -451,7 +455,15 @@ else if(campo.getType().equals(Timestamp.class)){ // TODO Auto-generated catch block e.printStackTrace(); } - } + } + else if(campo.getType().equals(DATE.class)){ + try { + this.pstm.setDATE(this.prepared_fields++, (DATE)prepare_fields.get(campo)); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } else if(campo.getType().equals(String.class)){ try { this.pstm.setString(this.prepared_fields++, "%"+(String)prepare_match_fields.get(campo)+"%"); @@ -577,6 +589,14 @@ else if(campo.getType().equals(Timestamp.class)){ // TODO Auto-generated catch block e.printStackTrace(); } + } + else if(campo.getType().equals(DATE.class)){ + try { + this.pstm.setDATE(this.prepared_fields++, (DATE)prepare_fields.get(campo)); + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } } else if(campo.getType().equals(String.class)){ try { From ae8c54c8891a2a515d7738f129c71b544bc39b65 Mon Sep 17 00:00:00 2001 From: Pablo Cornejo Date: Thu, 16 May 2019 15:34:59 -0400 Subject: [PATCH 2/4] Fixes --- .project | 6 + src/earlgrey/core/ModelCore.java | 168 +++++---------------- src/earlgrey/database/OracleConnector.java | 116 +++----------- 3 files changed, 68 insertions(+), 222 deletions(-) diff --git a/.project b/.project index 5f39e45..a15aa49 100644 --- a/.project +++ b/.project @@ -10,6 +10,11 @@ + + org.fusesource.ide.project.RiderProjectBuilder + + + org.eclipse.m2e.core.maven2Builder @@ -17,6 +22,7 @@ + org.fusesource.ide.project.RiderProjectNature org.eclipse.jdt.core.javanature org.eclipse.m2e.core.maven2Nature diff --git a/src/earlgrey/core/ModelCore.java b/src/earlgrey/core/ModelCore.java index 52c2622..117cb07 100644 --- a/src/earlgrey/core/ModelCore.java +++ b/src/earlgrey/core/ModelCore.java @@ -205,39 +205,22 @@ public ArrayList get(int init,int limit){ Field campo = fields.get(llave).field; if(campo.getType().equals(int.class) || campo.getType().equals(Integer.class)){ campo.set(m, set.getInt(llave)); - } - else if(campo.getType().equals(float.class) || campo.getType().equals(Float.class)){ + } else if (campo.getType().equals(float.class) || campo.getType().equals(Float.class)){ campo.set(m, set.getFloat(llave)); - } - else if(campo.getType().equals(double.class) || campo.getType().equals(Double.class)){ + } else if (campo.getType().equals(double.class) || campo.getType().equals(Double.class)){ campo.set(m, set.getDouble(llave)); - } - else if(campo.getType().equals(String.class)){ + } else if (campo.getType().equals(String.class)){ campo.set(m, set.getString(llave)); - } - else if(campo.getType().equals(Timestamp.class)){ + } else if (campo.getType().equals(Timestamp.class)){ campo.set(m, set.getString(llave)); - } - else if(campo.getType().equals(DATE.class)){ + } else if (campo.getType().equals(DATE.class)){ campo.set(m, set.getDate(llave)); - } - else if(IType.class.isAssignableFrom(campo.getType())){ + } else if (IType.class.isAssignableFrom(campo.getType())){ try { Method inv = campo.getType().getMethod("GetSQLResult", Object.class); campo.set(m, inv.invoke(null, set.getObject(llave))); - } catch (NoSuchMethodException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + } catch (NoSuchMethodException | IllegalArgumentException | InvocationTargetException e) { + log.Info(e.toString());} } } Enumeration r_keys = relation.keys(); @@ -246,44 +229,22 @@ else if(IType.class.isAssignableFrom(campo.getType())){ Field campo = relation.get(llave).field; if(campo.getType().equals(int.class) || campo.getType().equals(Integer.class)){ campo.set(m, set.getInt(llave)); - } - else if(campo.getType().equals(float.class) || campo.getType().equals(Float.class)){ + } else if (campo.getType().equals(float.class) || campo.getType().equals(Float.class)){ campo.set(m, set.getFloat(llave)); - } - else if(campo.getType().equals(double.class) || campo.getType().equals(Double.class)){ + } else if (campo.getType().equals(double.class) || campo.getType().equals(Double.class)){ campo.set(m, set.getDouble(llave)); - } - else if(campo.getType().equals(String.class)){ + } else if (campo.getType().equals(String.class)){ campo.set(m, set.getString(llave)); - } - else if(campo.getType().equals(Timestamp.class)){ + } else if (campo.getType().equals(Timestamp.class)){ campo.set(m, set.getString(llave)); - } - else if(campo.getType().equals(DATE.class)){ + } else if (campo.getType().equals(DATE.class)){ campo.set(m, set.getDate(llave)); - } - else if(IType.class.isAssignableFrom(campo.getType())){ + } else if (IType.class.isAssignableFrom(campo.getType())){ try { Method inv = campo.getType().getMethod("GetSQLResult", Object.class); campo.set(m, inv.invoke(null, set.getObject(llave))); - } catch (NoSuchMethodException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (JSONException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + } catch (NoSuchMethodException | IllegalArgumentException | InvocationTargetException e) { + log.Info(e.toString()); } } } @@ -308,7 +269,6 @@ public JSONArray getJSON(Integer offset, Integer limit){ int limite = 0; JSONArray retorno = new JSONArray(); try { - int k=0; while(this.set.next() && (limite++ < (offset+limit) || (limit == -1 || limit == null))){ if(limite <= offset) continue; Enumeration keys = fields.keys(); @@ -318,45 +278,22 @@ public JSONArray getJSON(Integer offset, Integer limit){ Field campo = fields.get(llave).field; if(campo.getType().equals(int.class) || campo.getType().equals(Integer.class)){ objeto.put(llave, set.getInt(llave)); - } - else if(campo.getType().equals(float.class) || campo.getType().equals(Float.class)){ + } else if (campo.getType().equals(float.class) || campo.getType().equals(Float.class)){ objeto.put(llave, set.getFloat(llave)); - } - else if(campo.getType().equals(double.class) || campo.getType().equals(Double.class)){ + } else if (campo.getType().equals(double.class) || campo.getType().equals(Double.class)){ objeto.put(llave, set.getDouble(llave)); - } - else if(campo.getType().equals(String.class)){ + } else if (campo.getType().equals(String.class)){ objeto.put(llave, set.getString(llave)); - } - else if(campo.getType().equals(Timestamp.class)){ + } else if (campo.getType().equals(Timestamp.class)){ objeto.put(llave, set.getString(llave)); - } - else if(campo.getType().equals(DATE.class)){ + } else if (campo.getType().equals(DATE.class)){ objeto.put(llave, set.getDate(llave)); - } - else if(IType.class.isAssignableFrom(campo.getType())){ + } else if (IType.class.isAssignableFrom(campo.getType())){ try { Method inv = campo.getType().getMethod("GetSQLResult", Object.class); objeto.put(llave, inv.invoke(null, set.getObject(llave))); - } catch (NoSuchMethodException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (JSONException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + } catch (NoSuchMethodException | JSONException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + log.Info(e.toString());} } } Enumeration r_keys = relation.keys(); @@ -365,45 +302,22 @@ else if(IType.class.isAssignableFrom(campo.getType())){ Field campo = relation.get(llave).field; if(campo.getType().equals(int.class) || campo.getType().equals(Integer.class)){ objeto.put(llave, set.getInt(llave)); - } - else if(campo.getType().equals(float.class) || campo.getType().equals(Float.class)){ + } else if (campo.getType().equals(float.class) || campo.getType().equals(Float.class)){ objeto.put(llave, set.getFloat(llave)); - } - else if(campo.getType().equals(double.class) || campo.getType().equals(Double.class)){ + } else if (campo.getType().equals(double.class) || campo.getType().equals(Double.class)){ objeto.put(llave, set.getDouble(llave)); - } - else if(campo.getType().equals(String.class)){ + } else if (campo.getType().equals(String.class)){ objeto.put(llave, set.getString(llave)); - } - else if(campo.getType().equals(Timestamp.class)){ + } else if (campo.getType().equals(Timestamp.class)){ objeto.put(llave, set.getString(llave)); - } - else if(campo.getType().equals(DATE.class)){ + } else if (campo.getType().equals(DATE.class)){ objeto.put(llave, set.getDate(llave)); - } - else if(IType.class.isAssignableFrom(campo.getType())){ + } else if (IType.class.isAssignableFrom(campo.getType())){ try { Method inv = campo.getType().getMethod("GetSQLResult", Object.class); objeto.put(llave, inv.invoke(null, set.getObject(llave))); - } catch (NoSuchMethodException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (JSONException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + } catch (NoSuchMethodException | JSONException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + log.Info(e.toString());} } } retorno.put(objeto); @@ -454,26 +368,20 @@ private void transformParams(JSONObject query) { Field campo = this.getClass().getField(llave); if(campo.getType().equals(int.class) || campo.getType().equals(Integer.class)){ campo.set(this, query.getInt(llave)); - } - else if(campo.getType().equals(float.class) || campo.getType().equals(Float.class)){ + } else if (campo.getType().equals(float.class) || campo.getType().equals(Float.class)){ campo.set(this, query.getDouble(llave)); - } - else if(campo.getType().equals(double.class) || campo.getType().equals(Double.class)){ + } else if (campo.getType().equals(double.class) || campo.getType().equals(Double.class)){ campo.set(this, query.getDouble(llave)); - } - else if(campo.getType().equals(String.class)){ + } else if (campo.getType().equals(String.class)){ campo.set(this, query.getString(llave)); - } - else if(campo.getType().equals(Timestamp.class)){ + } else if (campo.getType().equals(Timestamp.class)){ campo.set(this, query.getString(llave)); - } - else if(campo.getType().equals(DATE.class)){ + } else if (campo.getType().equals(DATE.class)){ campo.set(this, query.getString(llave)); } } } catch (NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException | JSONException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString());; } } } diff --git a/src/earlgrey/database/OracleConnector.java b/src/earlgrey/database/OracleConnector.java index 9469ec2..6275277 100644 --- a/src/earlgrey/database/OracleConnector.java +++ b/src/earlgrey/database/OracleConnector.java @@ -353,72 +353,50 @@ public void complete(Hashtable prepare_fields, ArrayList a try { this.pstm.setInt(this.prepared_fields++, (Integer)prepare_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(campo.getType().equals(float.class) || campo.getType().equals(Float.class)){ try { this.pstm.setFloat(this.prepared_fields++, (Float)prepare_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(campo.getType().equals(double.class) || campo.getType().equals(Double.class)){ try { this.pstm.setDouble(this.prepared_fields++, (Double)prepare_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(campo.getType().equals(Timestamp.class)){ try { this.pstm.setTimestamp(this.prepared_fields++, (Timestamp)prepare_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(campo.getType().equals(DATE.class)){ try { this.pstm.setDATE(this.prepared_fields++, (DATE)prepare_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(campo.getType().equals(String.class)){ try { this.pstm.setString(this.prepared_fields++, (String)prepare_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(IType.class.isAssignableFrom(campo.getType())){ try { Method inv = campo.getType().getMethod("SQLPrepareField", OraclePreparedStatement.class, Integer.class); inv.invoke(null, this.pstm, this.prepared_fields++); - } catch (NoSuchMethodException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (JSONException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + } catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + log.Info(e.toString()); } } } @@ -428,73 +406,50 @@ else if(IType.class.isAssignableFrom(campo.getType())){ try { this.pstm.setInt(this.prepared_fields++, (Integer)prepare_match_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(campo.getType().equals(float.class) || campo.getType().equals(Float.class)){ try { this.pstm.setFloat(this.prepared_fields++, (Float)prepare_match_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(campo.getType().equals(double.class) || campo.getType().equals(Double.class)){ try { this.pstm.setDouble(this.prepared_fields++, (Double)prepare_match_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(campo.getType().equals(Timestamp.class)){ try { this.pstm.setTimestamp(this.prepared_fields++, (Timestamp)prepare_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(campo.getType().equals(DATE.class)){ try { this.pstm.setDATE(this.prepared_fields++, (DATE)prepare_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(campo.getType().equals(String.class)){ try { this.pstm.setString(this.prepared_fields++, "%"+(String)prepare_match_fields.get(campo)+"%"); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(IType.class.isAssignableFrom(campo.getType())){ try { Method inv = campo.getType().getMethod("SQLPrepareField", OraclePreparedStatement.class, Integer.class); inv.invoke(null, this.pstm, this.prepared_fields++); - } catch (NoSuchMethodException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (JSONException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + } catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + log.Info(e.toString());} } } } @@ -562,73 +517,50 @@ public void complete(Hashtable prepare_fields, ArrayList a try { this.pstm.setInt(this.prepared_fields++, (Integer)prepare_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(campo.getType().equals(float.class) || campo.getType().equals(Float.class)){ try { this.pstm.setFloat(this.prepared_fields++, (Float)prepare_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(campo.getType().equals(double.class) || campo.getType().equals(Double.class)){ try { this.pstm.setDouble(this.prepared_fields++, (Double)prepare_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(campo.getType().equals(Timestamp.class)){ try { this.pstm.setTimestamp(this.prepared_fields++, (Timestamp)prepare_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(campo.getType().equals(DATE.class)){ try { this.pstm.setDATE(this.prepared_fields++, (DATE)prepare_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(campo.getType().equals(String.class)){ try { this.pstm.setString(this.prepared_fields++, (String)prepare_fields.get(campo)); } catch (SQLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); + log.Info(e.toString()); } } else if(IType.class.isAssignableFrom(campo.getType())){ try { Method inv = campo.getType().getMethod("SQLPrepareField", OraclePreparedStatement.class, Integer.class, ObraType.class, Connection.class); inv.invoke(null, this.pstm, this.prepared_fields++, prepare_fields.get(campo), this.con); - } catch (NoSuchMethodException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (SecurityException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalArgumentException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InvocationTargetException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (JSONException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + } catch (NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { + log.Info(e.toString());} } } } From 685750a86f68286a4f421a2d866cb73b269dbd4a Mon Sep 17 00:00:00 2001 From: Pablo Cornejo Date: Wed, 29 May 2019 14:07:36 -0400 Subject: [PATCH 3/4] Modificacion date --- src/earlgrey/core/ModelCore.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/earlgrey/core/ModelCore.java b/src/earlgrey/core/ModelCore.java index 117cb07..9586742 100644 --- a/src/earlgrey/core/ModelCore.java +++ b/src/earlgrey/core/ModelCore.java @@ -214,7 +214,7 @@ public ArrayList get(int init,int limit){ } else if (campo.getType().equals(Timestamp.class)){ campo.set(m, set.getString(llave)); } else if (campo.getType().equals(DATE.class)){ - campo.set(m, set.getDate(llave)); + campo.set(m, set.getString(llave)); } else if (IType.class.isAssignableFrom(campo.getType())){ try { Method inv = campo.getType().getMethod("GetSQLResult", Object.class); @@ -238,7 +238,7 @@ public ArrayList get(int init,int limit){ } else if (campo.getType().equals(Timestamp.class)){ campo.set(m, set.getString(llave)); } else if (campo.getType().equals(DATE.class)){ - campo.set(m, set.getDate(llave)); + campo.set(m, set.getString(llave)); } else if (IType.class.isAssignableFrom(campo.getType())){ try { Method inv = campo.getType().getMethod("GetSQLResult", Object.class); @@ -287,7 +287,7 @@ public JSONArray getJSON(Integer offset, Integer limit){ } else if (campo.getType().equals(Timestamp.class)){ objeto.put(llave, set.getString(llave)); } else if (campo.getType().equals(DATE.class)){ - objeto.put(llave, set.getDate(llave)); + objeto.put(llave, set.getString(llave)); } else if (IType.class.isAssignableFrom(campo.getType())){ try { Method inv = campo.getType().getMethod("GetSQLResult", Object.class); @@ -311,7 +311,7 @@ public JSONArray getJSON(Integer offset, Integer limit){ } else if (campo.getType().equals(Timestamp.class)){ objeto.put(llave, set.getString(llave)); } else if (campo.getType().equals(DATE.class)){ - objeto.put(llave, set.getDate(llave)); + objeto.put(llave, set.getString(llave)); } else if (IType.class.isAssignableFrom(campo.getType())){ try { Method inv = campo.getType().getMethod("GetSQLResult", Object.class); @@ -436,6 +436,7 @@ public boolean update(JSONObject criteria){ } } public boolean update(int id){ + log.Info("pase por aqui"); if(conector_transaction.contains(this.datasource)){ this.conector = conector_transaction.get(this.datasource); this.transaction = true; From 037694ff548673a4662cb45981aa86ff999b718e Mon Sep 17 00:00:00 2001 From: Pablo Cornejo Date: Wed, 29 May 2019 14:35:34 -0400 Subject: [PATCH 4/4] delete log comment --- src/earlgrey/core/ModelCore.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/earlgrey/core/ModelCore.java b/src/earlgrey/core/ModelCore.java index 9586742..ef18723 100644 --- a/src/earlgrey/core/ModelCore.java +++ b/src/earlgrey/core/ModelCore.java @@ -436,7 +436,6 @@ public boolean update(JSONObject criteria){ } } public boolean update(int id){ - log.Info("pase por aqui"); if(conector_transaction.contains(this.datasource)){ this.conector = conector_transaction.get(this.datasource); this.transaction = true;