public virtual Net.Vpc.Upa.Impl.Persistence.TypeMarshaller CreateTypeMarshaller(Net.Vpc.Upa.Types.DataType type) { Net.Vpc.Upa.Types.NumberType n = (Net.Vpc.Upa.Types.NumberType)type; System.Type c = n.GetPlatformType(); Net.Vpc.Upa.Impl.Persistence.TypeMarshaller m = pm.GetTypeMarshaller(c); if (m == null) { m = pm.GetTypeMarshaller(typeof(object)); } return(m); }
public override string ToSQLLiteral(object @object) { if (@object == null) { return(base.ToSQLLiteral(@object)); } Net.Vpc.Upa.Impl.Persistence.TypeMarshaller wrapper = pm.GetTypeMarshaller(@object.GetType()); if (wrapper != null && wrapper.GetType() != GetType()) { return(wrapper.ToSQLLiteral(@object)); } throw new System.Exception("litteral not supported for Objects (" + @object + " as " + @object.GetType() + ")"); }
public virtual Net.Vpc.Upa.Persistence.QueryResult ExecuteQuery(string query, Net.Vpc.Upa.Types.DataTypeTransform[] types, System.Collections.Generic.IList <Net.Vpc.Upa.Persistence.Parameter> queryParameters, bool updatable) /* throws Net.Vpc.Upa.Exceptions.UPAException */ { if (closed) { throw new System.ArgumentException("Connection closed"); } long startTime = System.DateTime.Now.Ticks; System.Exception error = null; try { try { System.Data.IDbCommand s = null; s = connection.CreateCommand(); s.CommandText = query; s.CommandType = System.Data.CommandType.Text; int mi = 0; int index = 1; if (queryParameters != null) { foreach (Net.Vpc.Upa.Persistence.Parameter @value in queryParameters) { Net.Vpc.Upa.Types.DataTypeTransform transform = @value.GetTypeTransform(); Net.Vpc.Upa.Impl.Persistence.TypeMarshaller marshaller = marshallManager.GetTypeMarshaller(transform); marshaller.Write(@value.GetValue(), index, s); index += marshaller.GetSize(); mi++; } } System.Data.IDataReader resultSet = s.ExecuteReader(); if (types == null) { int columnCount; System.Type[] colTypes; columnCount = resultSet.FieldCount; colTypes = new System.Type[columnCount]; for (int i = 0; i < columnCount; i++) { colTypes[i] = resultSet.GetFieldType(i); } types = new Net.Vpc.Upa.Types.DataTypeTransform[columnCount]; for (int i = 0; i < types.Length; i++) { types[i] = new Net.Vpc.Upa.Impl.Transform.IdentityDataTypeTransform(Net.Vpc.Upa.Types.TypesFactory.ForPlatformType(colTypes[i])); } } Net.Vpc.Upa.Impl.Persistence.TypeMarshaller[] marshallers = new Net.Vpc.Upa.Impl.Persistence.TypeMarshaller[types.Length]; for (int i = 0; i < marshallers.Length; i++) { marshallers[i] = marshallManager.GetTypeMarshaller(types[i]); } // Log.log(PersistenceUnitManager.DB_PRE_NATIVE_QUERY_LOG,"[BEFORE] "+currentQueryInfo+" :=" + currentQuery); return(new Net.Vpc.Upa.Impl.Persistence.DefaultQueryResult(resultSet, s, marshallers, types)); } catch (System.Exception ee) { error = ee; throw ee; } finally { if (/*IsLoggable=*/ true) { if (error != null) { log.TraceEvent(System.Diagnostics.TraceEventType.Error, 100, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter(nameDebugString + " [Error] executeQuery " + query + " :: parameters = " + queryParameters, error)); } else { log.TraceEvent(System.Diagnostics.TraceEventType.Verbose, 60, Net.Vpc.Upa.Impl.FwkConvertUtils.LogMessageExceptionFormatter("{0} executeQuery {1} ;; parameters = {2} ;; time = {3}", null, new object[] { nameDebugString, query, queryParameters, (System.DateTime.Now.Ticks - startTime) })); } } } } catch (System.Exception ex) { throw CreateUPAException(ex, "ExecuteQueryFailedException", query); } }
public virtual Net.Vpc.Upa.Impl.Persistence.TypeMarshaller CreateTypeMarshaller(Net.Vpc.Upa.Types.DataType type) { Net.Vpc.Upa.Types.TemporalType n = (Net.Vpc.Upa.Types.TemporalType)type; System.Type primitiveType = type.GetPlatformType(); return(pm.GetTypeMarshaller(primitiveType)); }
public virtual Net.Vpc.Upa.Impl.Persistence.TypeMarshaller CreateTypeMarshaller(Net.Vpc.Upa.Types.DataType type) { Net.Vpc.Upa.Types.ListType n = (Net.Vpc.Upa.Types.ListType)type; return(pm.GetTypeMarshaller(n.GetElementType())); }