You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
(248) |
May
(82) |
Jun
(90) |
Jul
(177) |
Aug
(253) |
Sep
(157) |
Oct
(151) |
Nov
(143) |
Dec
(278) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(152) |
Feb
(107) |
Mar
(177) |
Apr
(133) |
May
(259) |
Jun
(81) |
Jul
(119) |
Aug
(306) |
Sep
(416) |
Oct
(240) |
Nov
(329) |
Dec
(206) |
2006 |
Jan
(466) |
Feb
(382) |
Mar
(153) |
Apr
(162) |
May
(133) |
Jun
(21) |
Jul
(18) |
Aug
(37) |
Sep
(97) |
Oct
(114) |
Nov
(110) |
Dec
(28) |
2007 |
Jan
(74) |
Feb
(65) |
Mar
(49) |
Apr
(76) |
May
(43) |
Jun
(15) |
Jul
(68) |
Aug
(55) |
Sep
(63) |
Oct
(59) |
Nov
(70) |
Dec
(66) |
2008 |
Jan
(71) |
Feb
(60) |
Mar
(120) |
Apr
(31) |
May
(48) |
Jun
(81) |
Jul
(107) |
Aug
(51) |
Sep
(80) |
Oct
(83) |
Nov
(83) |
Dec
(79) |
2009 |
Jan
(83) |
Feb
(110) |
Mar
(97) |
Apr
(91) |
May
(291) |
Jun
(250) |
Jul
(197) |
Aug
(58) |
Sep
(54) |
Oct
(122) |
Nov
(68) |
Dec
(34) |
2010 |
Jan
(50) |
Feb
(17) |
Mar
(63) |
Apr
(61) |
May
(84) |
Jun
(81) |
Jul
(138) |
Aug
(144) |
Sep
(78) |
Oct
(26) |
Nov
(30) |
Dec
(61) |
2011 |
Jan
(33) |
Feb
(35) |
Mar
(166) |
Apr
(221) |
May
(109) |
Jun
(76) |
Jul
(27) |
Aug
(37) |
Sep
(1) |
Oct
(4) |
Nov
(2) |
Dec
(1) |
2012 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(1) |
Sep
(3) |
Oct
(2) |
Nov
|
Dec
(1) |
2014 |
Jan
(1) |
Feb
(1) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Peter S. <sz...@us...> - 2004-04-30 15:03:19
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29760/NHibernate.Test Modified Files: FooBarTest.cs Log Message: Sortables is running :) Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** FooBarTest.cs 29 Apr 2004 15:22:28 -0000 1.17 --- FooBarTest.cs 30 Apr 2004 15:03:06 -0000 1.18 *************** *** 111,119 **** s = sessions.OpenSession(); ! result = s.CreateQuery("from Baz baz left join fetch baz.sortablez order by baz.name asc") .List(); b = (Baz) result[0]; Assert.IsTrue( b.sortablez.Count==3 ); ! Assert.AreEqual( ( (Sortable) b.sortablez[0] ).name, "bar" ); s.Flush(); t.Commit(); --- 111,124 ---- s = sessions.OpenSession(); ! t = s.BeginTransaction(); ! result = s.CreateQuery("from Baz baz left join fetch sortablez order by baz.name asc") .List(); b = (Baz) result[0]; Assert.IsTrue( b.sortablez.Count==3 ); ! foreach(DictionaryEntry de in b.sortablez) ! { ! Assert.AreEqual( ((Sortable)de.Key).name, "bar"); ! break; ! } s.Flush(); t.Commit(); *************** *** 121,129 **** s = sessions.OpenSession(); result = s.CreateQuery("from Baz baz order by baz.name asc") .List(); b = (Baz) result[0]; Assert.IsTrue( b.sortablez.Count==3 ); ! Assert.AreEqual( ( (Sortable) b.sortablez[0] ).name, "bar" ); s.Delete(b); s.Flush(); --- 126,139 ---- s = sessions.OpenSession(); + t = s.BeginTransaction(); result = s.CreateQuery("from Baz baz order by baz.name asc") .List(); b = (Baz) result[0]; Assert.IsTrue( b.sortablez.Count==3 ); ! foreach(DictionaryEntry de in b.sortablez) ! { ! Assert.AreEqual( ((Sortable)de.Key).name, "bar"); ! break; ! } s.Delete(b); s.Flush(); |
From: Michael D. <mik...@us...> - 2004-04-30 14:14:55
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19977 Modified Files: CollectionPersister.cs Log Message: Changed the fields to readonly to be just like H2.0.3 final fields. Index: CollectionPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/CollectionPersister.cs,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** CollectionPersister.cs 30 Apr 2004 04:43:39 -0000 1.21 --- CollectionPersister.cs 30 Apr 2004 14:14:39 -0000 1.22 *************** *** 29,85 **** private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(CollectionPersister)); ! private SqlString sqlDeleteString; ! private SqlString sqlInsertRowString; ! private SqlString sqlUpdateRowString; ! private SqlString sqlDeleteRowString; ! private string sqlOrderByString; ! private string sqlOrderByStringTemplate; ! private string sqlWhereString; ! private string sqlWhereStringTemplate; ! private bool hasOrder; ! private bool hasWhere; ! private bool hasOrphanDelete; ! private IType keyType; ! private IType indexType; ! private IType elementType; ! private string[] keyColumnNames; ! private string[] indexColumnNames; ! private string[] elementColumnNames; ! private string[] rowSelectColumnNames; ! //TODO: populate this field ! private string[] indexColumnAliases; ! private string[] elementColumnAliases; ! private string[] keyColumnAliases; ! private IType rowSelectType; ! private bool primitiveArray; ! private bool array; ! private bool isOneToMany; ! private string qualifiedTableName; ! private bool hasIndex; ! private bool isLazy; ! private bool isInverse; ! private System.Type elementClass; ! private ICacheConcurrencyStrategy cache; ! private PersistentCollectionType collectionType; ! private OuterJoinLoaderType enableJoinedFetch; ! private System.Type ownerClass; ! private IIdentifierGenerator identifierGenerator; ! private string unquotedIdentifierColumnName; ! private IType identifierType; ! private bool hasIdentifier; ! private string identifierColumnName; ! private string identifierColumnAlias; ! private ICollectionInitializer loader; ! private string role; ! private Dialect.Dialect dialect; ! private ISessionFactoryImplementor factory; public CollectionPersister(Mapping.Collection collection, Configuration datastore, ISessionFactoryImplementor factory) --- 29,84 ---- private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(CollectionPersister)); ! private readonly SqlString sqlDeleteString; ! private readonly SqlString sqlInsertRowString; ! private readonly SqlString sqlUpdateRowString; ! private readonly SqlString sqlDeleteRowString; ! private readonly string sqlOrderByString; ! private readonly string sqlOrderByStringTemplate; ! private readonly string sqlWhereString; ! private readonly string sqlWhereStringTemplate; ! private readonly bool hasOrder; ! private readonly bool hasWhere; ! private readonly bool hasOrphanDelete; ! private readonly IType keyType; ! private readonly IType indexType; ! private readonly IType elementType; ! private readonly string[] keyColumnNames; ! private readonly string[] indexColumnNames; ! private readonly string[] elementColumnNames; ! private readonly string[] rowSelectColumnNames; ! private readonly string[] indexColumnAliases; ! private readonly string[] elementColumnAliases; ! private readonly string[] keyColumnAliases; ! private readonly IType rowSelectType; ! private readonly bool primitiveArray; ! private readonly bool array; ! private readonly bool isOneToMany; ! private readonly string qualifiedTableName; ! private readonly bool hasIndex; ! private readonly bool isLazy; ! private readonly bool isInverse; ! private readonly System.Type elementClass; ! private readonly ICacheConcurrencyStrategy cache; ! private readonly PersistentCollectionType collectionType; ! private readonly OuterJoinLoaderType enableJoinedFetch; ! private readonly System.Type ownerClass; ! private readonly IIdentifierGenerator identifierGenerator; ! private readonly string unquotedIdentifierColumnName; ! private readonly IType identifierType; ! private readonly bool hasIdentifier; ! private readonly string identifierColumnName; ! private readonly string identifierColumnAlias; ! private readonly ICollectionInitializer loader; ! private readonly string role; ! private readonly Dialect.Dialect dialect; ! private readonly ISessionFactoryImplementor factory; public CollectionPersister(Mapping.Collection collection, Configuration datastore, ISessionFactoryImplementor factory) |
From: Peter S. <sz...@us...> - 2004-04-30 14:06:59
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18403/NHibernate/Loader Modified Files: Loader.cs OuterJoinLoader.cs SimpleEntityLoader.cs Log Message: HQL looks like finished. Changed string.Empty to String.Empty. Index: OuterJoinLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/OuterJoinLoader.cs,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** OuterJoinLoader.cs 15 Apr 2004 11:36:36 -0000 1.10 --- OuterJoinLoader.cs 30 Apr 2004 14:06:47 -0000 1.11 *************** *** 432,436 **** { get { return suffixes; } - set { suffixes = value; } } --- 432,435 ---- Index: Loader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/Loader.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Loader.cs 21 Apr 2004 14:32:03 -0000 1.18 --- Loader.cs 30 Apr 2004 14:06:47 -0000 1.19 *************** *** 59,63 **** /// implemented by all subclasses /// </summary> ! protected abstract string[] Suffixes { get; set; } /// <summary> --- 59,63 ---- /// implemented by all subclasses /// </summary> ! protected abstract string[] Suffixes { get; } /// <summary> Index: SimpleEntityLoader.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Loader/SimpleEntityLoader.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SimpleEntityLoader.cs 15 Apr 2004 11:36:36 -0000 1.6 --- SimpleEntityLoader.cs 30 Apr 2004 14:06:47 -0000 1.7 *************** *** 50,54 **** { get { return NoSuffix; } - set { throw new NotImplementedException(); } } --- 50,53 ---- |
From: Peter S. <sz...@us...> - 2004-04-30 14:06:56
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18403/NHibernate/SqlCommand Modified Files: ForUpdateFragment.cs Template.cs Log Message: HQL looks like finished. Changed string.Empty to String.Empty. Index: Template.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand/Template.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Template.cs 29 Apr 2004 14:00:53 -0000 1.6 --- Template.cs 30 Apr 2004 14:06:47 -0000 1.7 *************** *** 23,41 **** static Template() { ! Keywords["and"] = string.Empty; ! Keywords["or"] = string.Empty; ! Keywords["not"] = string.Empty; ! Keywords["like"] = string.Empty; ! Keywords["is"] = string.Empty; ! Keywords["in"] = string.Empty; ! Keywords["between"] = string.Empty; ! Keywords["null"] = string.Empty; ! Keywords["select"] = string.Empty; ! Keywords["from"] = string.Empty; ! Keywords["where"] = string.Empty; ! Keywords["having"] = string.Empty; ! Keywords["group"] = string.Empty; ! Keywords["order"] = string.Empty; ! Keywords["by"] = string.Empty; delimiterList.Add(" "); --- 23,41 ---- static Template() { ! Keywords["and"] = String.Empty; ! Keywords["or"] = String.Empty; ! Keywords["not"] = String.Empty; ! Keywords["like"] = String.Empty; ! Keywords["is"] = String.Empty; ! Keywords["in"] = String.Empty; ! Keywords["between"] = String.Empty; ! Keywords["null"] = String.Empty; ! Keywords["select"] = String.Empty; ! Keywords["from"] = String.Empty; ! Keywords["where"] = String.Empty; ! Keywords["having"] = String.Empty; ! Keywords["group"] = String.Empty; ! Keywords["order"] = String.Empty; ! Keywords["by"] = String.Empty; delimiterList.Add(" "); *************** *** 70,74 **** public static void AddKeyword(string keyword) { ! Keywords[keyword] = string.Empty; } --- 70,74 ---- public static void AddKeyword(string keyword) { ! Keywords[keyword] = String.Empty; } Index: ForUpdateFragment.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand/ForUpdateFragment.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ForUpdateFragment.cs 29 Apr 2004 14:00:53 -0000 1.3 --- ForUpdateFragment.cs 30 Apr 2004 14:06:47 -0000 1.4 *************** *** 38,43 **** { return aliases.Length==0 ? ! new SqlString(string.Empty) : ! new SqlString(" for update of " + aliases + ( nowait ? " nowait" : string.Empty)); } --- 38,43 ---- { return aliases.Length==0 ? ! new SqlString(String.Empty) : ! new SqlString(" for update of " + aliases + ( nowait ? " nowait" : String.Empty)); } |
From: Peter S. <sz...@us...> - 2004-04-30 14:06:55
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Id In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18403/NHibernate/Id Modified Files: IdentifierGeneratorFactory.cs Log Message: HQL looks like finished. Changed string.Empty to String.Empty. Index: IdentifierGeneratorFactory.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Id/IdentifierGeneratorFactory.cs,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** IdentifierGeneratorFactory.cs 7 Apr 2004 17:13:38 -0000 1.9 --- IdentifierGeneratorFactory.cs 30 Apr 2004 14:06:46 -0000 1.10 *************** *** 42,46 **** private static readonly Hashtable idgenerators = new Hashtable(); ! public static readonly string ShortCircuitIndicator = string.Empty; static IdentifierGeneratorFactory() --- 42,46 ---- private static readonly Hashtable idgenerators = new Hashtable(); ! public static readonly string ShortCircuitIndicator = String.Empty; static IdentifierGeneratorFactory() |
From: Peter S. <sz...@us...> - 2004-04-30 14:06:55
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18403/NHibernate/Hql Modified Files: QueryTranslator.cs Log Message: HQL looks like finished. Changed string.Empty to String.Empty. Index: QueryTranslator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/QueryTranslator.cs,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** QueryTranslator.cs 29 Apr 2004 14:00:52 -0000 1.26 --- QueryTranslator.cs 30 Apr 2004 14:06:46 -0000 1.27 *************** *** 119,122 **** --- 119,123 ---- this.replacements = replacements; this.shallowQuery = scalar; + Compile(queryString); } *************** *** 268,284 **** } - private string Prefix(string s) - { - //TODO: H2.0.3: Using Prefix or using alias? - if ( s.Length > 3 ) - { - return s.Substring(0, 3).ToLower(); - } - else - { - return s.ToLower(); - } - } - private int NextCount() { --- 269,272 ---- *************** *** 298,302 **** { return CreateName(type.Name); - //return Prefix(type.Name) + NextCount() + StringHelper.Underscore; } --- 286,289 ---- *************** *** 304,308 **** { return CreateName(role); - //return Prefix( StringHelper.Unqualify(role) ) + NextCount() + StringHelper.Underscore; } --- 291,294 ---- *************** *** 556,559 **** --- 542,546 ---- { string name = (string) returnTypes[i]; + //if ( !IsName(name) ) throw new QueryException("unknown type: " + name); persisters[i] = GetPersisterForName(name); suffixes[i] = (size==1) ? String.Empty : i.ToString() + StringHelper.Underscore; *************** *** 564,568 **** } ! string scalarSelect = RenderScalarSelect(); int scalarSize = scalarTypes.Count; --- 551,555 ---- } ! string scalarSelect = RenderScalarSelect(); //Must be done here because of side-effect! yuck... int scalarSize = scalarTypes.Count; *************** *** 586,591 **** if ( CollectionPersister!=null ) { ! //TODO: H2.0.3: When collection is updated ! //sql.AddSelectFragmentString( CollectionPersister.MultiselectClauseFragment(fetchName) ); } if ( hasScalars || shallowQuery ) sql.AddSelectFragmentString(scalarSelect); --- 573,577 ---- if ( CollectionPersister!=null ) { ! sql.AddSelectFragmentString( collectionPersister.MultiselectClauseFragment(fetchName) ); } if ( hasScalars || shallowQuery ) sql.AddSelectFragmentString(scalarSelect); *************** *** 602,607 **** if ( CollectionPersister!=null && CollectionPersister.HasOrdering ) { ! //TODO: H2.0.3: When Sql/QuerySelect is updated ! //sql.addOrderBy( CollectionPersister.GetSQLOrderByString(fetchName) ); } --- 588,592 ---- if ( CollectionPersister!=null && CollectionPersister.HasOrdering ) { ! sql.AddOrderBy( CollectionPersister.GetSQLOrderByString(fetchName) ); } *************** *** 652,655 **** --- 637,657 ---- } + private string RenderOrderByPropertiesSelect() + { + StringBuilder buf = new StringBuilder(10); + + //add the columns we are ordering by to the select ID select clause + foreach(string token in orderByTokens) + { + if ( token.LastIndexOf(".") > 0 ) + { + //ie. it is of form "foo.bar", not of form "asc" or "desc" + buf.Append(StringHelper.CommaSpace).Append(token); + } + } + + return buf.ToString(); + } + private void RenderPropertiesSelect(QuerySelect sql) { *************** *** 687,691 **** if (i != names.Length - 1 || k != size - 1) buf.Append(StringHelper.CommaSpace); } - } } --- 689,692 ---- *************** *** 740,743 **** --- 741,745 ---- private JoinFragment MergeJoins(JoinFragment ojf) { + //classes foreach(string name in typeMap.Keys) { *************** *** 777,780 **** --- 779,783 ---- /// Is this query called by Scroll() or Iterate()? /// </summary> + /// <value>true if it is, false if it is called by find() or list()</value> public bool IsShallowQuery { *************** *** 793,800 **** internal bool Distinct { - // get - // { - // return distinct; - // } set { --- 796,799 ---- *************** *** 832,843 **** return suffixes; } - set - { - suffixes = value; - } } protected void AddFromCollection(string elementName, string collectionRole) { IType collectionElementType = GetCollectionPersister(collectionRole).ElementType; if ( !collectionElementType.IsEntityType ) throw new QueryException( --- 831,839 ---- return suffixes; } } protected void AddFromCollection(string elementName, string collectionRole) { + //q.addCollection(collectionName, collectionRole); IType collectionElementType = GetCollectionPersister(collectionRole).ElementType; if ( !collectionElementType.IsEntityType ) throw new QueryException( *************** *** 896,899 **** --- 892,896 ---- if (namedParams != null) { + // assumes that types are all of span 1 int result = 0; foreach (DictionaryEntry e in namedParams) *************** *** 939,944 **** } - - public static string[] ConcreteQueries(string query, ISessionFactoryImplementor factory) { --- 936,939 ---- *************** *** 961,965 **** for (int i=1; i<tokens.Length; i++) { - //update last non-whitespace token, if necessary if ( !ParserHelper.IsWhitespace( tokens[i-1] ) ) last = tokens[i-1].ToLower(); --- 956,959 ---- *************** *** 968,972 **** if ( ParserHelper.IsWhitespace(token) || last==null ) { - // scan for the next non-whitespace token if (nextIndex<=i) --- 962,965 ---- *************** *** 979,982 **** --- 972,976 ---- } + //if ( Character.isUpperCase( token.charAt( token.lastIndexOf(".") + 1 ) ) ) { if ( ( beforeClassTokens.Contains(last) && !notAfterClassTokens.Contains(next) ) || *************** *** 1014,1020 **** { beforeClassTokens.Add("from"); beforeClassTokens.Add(","); notAfterClassTokens.Add("in"); ! notAfterClassTokens.Add(","); notAfterClassTokens.Add("from"); notAfterClassTokens.Add(")"); --- 1008,1015 ---- { beforeClassTokens.Add("from"); + //beforeClassTokens.Add("new"); DEFINITELY DON'T HAVE THIS!! beforeClassTokens.Add(","); notAfterClassTokens.Add("in"); ! //notAfterClassTokens.Add(","); notAfterClassTokens.Add("from"); notAfterClassTokens.Add(")"); *************** *** 1070,1073 **** --- 1065,1069 ---- { IType[] returnTypes = ReturnTypes; + row = ToResultRow(row); if (hasScalars) { *************** *** 1123,1134 **** internal QueryJoinFragment CreateJoinFragment(bool useThetaStyleInnerJoins) { ! return new QueryJoinFragment( factory.Dialect ); ! //TODO: H2.0.3 when QueryJoinFragment is updated ! //return new QueryJoinFragment( factory.Dialect, useThetaStyleInnerJoins ); } internal System.Type HolderClass { - get { return holderClass; } set { holderClass = value; } } --- 1119,1127 ---- internal QueryJoinFragment CreateJoinFragment(bool useThetaStyleInnerJoins) { ! return new QueryJoinFragment( factory.Dialect, useThetaStyleInnerJoins ); } internal System.Type HolderClass { set { holderClass = value; } } |
From: Peter S. <sz...@us...> - 2004-04-30 14:06:54
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18403/NHibernate/Driver Modified Files: OdbcDriver.cs OleDbDriver.cs Log Message: HQL looks like finished. Changed string.Empty to String.Empty. Index: OleDbDriver.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver/OleDbDriver.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OleDbDriver.cs 29 Apr 2004 14:00:52 -0000 1.2 --- OleDbDriver.cs 30 Apr 2004 14:06:46 -0000 1.3 *************** *** 38,42 **** public override string NamedPrefix { ! get {return string.Empty;} } --- 38,42 ---- public override string NamedPrefix { ! get {return String.Empty;} } Index: OdbcDriver.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Driver/OdbcDriver.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** OdbcDriver.cs 29 Apr 2004 14:00:52 -0000 1.2 --- OdbcDriver.cs 30 Apr 2004 14:06:46 -0000 1.3 *************** *** 38,42 **** public override string NamedPrefix { ! get {return string.Empty;} } } --- 38,42 ---- public override string NamedPrefix { ! get {return String.Empty;} } } |
From: Peter S. <sz...@us...> - 2004-04-30 14:06:54
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18403/NHibernate Modified Files: HibernateException.cs Log Message: HQL looks like finished. Changed string.Empty to String.Empty. Index: HibernateException.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/HibernateException.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** HibernateException.cs 29 Apr 2004 14:00:51 -0000 1.2 --- HibernateException.cs 30 Apr 2004 14:06:45 -0000 1.3 *************** *** 9,13 **** public class HibernateException : ApplicationException { ! public HibernateException(Exception e) : base(string.Empty, e) { } public HibernateException(string str, Exception e) : base(str, e) { } --- 9,13 ---- public class HibernateException : ApplicationException { ! public HibernateException(Exception e) : base(String.Empty, e) { } public HibernateException(string str, Exception e) : base(str, e) { } |
From: Peter S. <sz...@us...> - 2004-04-30 14:06:54
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18403/NHibernate/Cfg Modified Files: Binder.cs Log Message: HQL looks like finished. Changed string.Empty to String.Empty. Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Binder.cs 29 Apr 2004 16:04:56 -0000 1.19 --- Binder.cs 30 Apr 2004 14:06:45 -0000 1.20 *************** *** 283,287 **** Column col = new Column( model.Type, count++ ); BindColumn(subnode, col, isNullable); ! col.Name = (subnode.Attributes["name"]==null) ? string.Empty : subnode.Attributes["name"].Value; if (table!=null) table.AddColumn(col); //table=null -> an association, fill it in later model.AddColumn(col); --- 283,287 ---- Column col = new Column( model.Type, count++ ); BindColumn(subnode, col, isNullable); ! col.Name = (subnode.Attributes["name"]==null) ? String.Empty : subnode.Attributes["name"].Value; if (table!=null) table.AddColumn(col); //table=null -> an association, fill it in later model.AddColumn(col); |
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5665/NHibernate/Sql Modified Files: ANSIJoinFragment.cs InFragment.cs JoinFragment.cs OracleJoinFragment.cs OracleOuterJoinFragment.cs QueryJoinFragment.cs QuerySelect.cs Log Message: synched the Sql parts used by Hql. Removed OuterJoin files because they were not in H2.0.3 and could not find them used anywhere by NH Index: QueryJoinFragment.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql/QueryJoinFragment.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** QueryJoinFragment.cs 19 Apr 2004 04:32:30 -0000 1.3 --- QueryJoinFragment.cs 30 Apr 2004 13:10:18 -0000 1.4 *************** *** 10,51 **** /// Summary description for QueryJoinFragment. /// </summary> ! public class QueryJoinFragment : JoinFragment { ! private StringBuilder afterFrom = new StringBuilder(); private StringBuilder afterWhere = new StringBuilder(); private Dialect.Dialect dialect; ! public QueryJoinFragment(Dialect.Dialect dialect) { this.dialect = dialect; } ! public override void AddJoin(string tableName, string alias, string[] fkColumns, string[] pkColumns, JoinType joinType) { ! if (joinType!=JoinType.InnerJoin) { ! //TODO: get right impl for dialect JoinFragment jf = dialect.CreateOuterJoinFragment(); jf.AddJoin(tableName, alias, fkColumns, pkColumns, joinType); AddFragment(jf); } ! else { AddCrossJoin(tableName, alias); ! AddCondition(alias, fkColumns, pkColumns); } } ! public override string ToFromFragmentString { get { return afterFrom.ToString(); } } ! public override string ToWhereFragmentString { get { return afterWhere.ToString(); } } ! public override void AddJoins(string fromFragment, string whereFragment) { afterFrom.Append(fromFragment); afterWhere.Append(whereFragment); } ! public override JoinFragment Copy() { ! QueryJoinFragment copy = new QueryJoinFragment(dialect); copy.afterFrom = new StringBuilder( afterFrom.ToString() ); copy.afterWhere = new StringBuilder( afterWhere.ToString() ); --- 10,71 ---- /// Summary description for QueryJoinFragment. /// </summary> ! public class QueryJoinFragment : JoinFragment ! { private StringBuilder afterFrom = new StringBuilder(); private StringBuilder afterWhere = new StringBuilder(); private Dialect.Dialect dialect; + private bool useThetaStyleInnerJoins; ! [Obsolete("Use the ctor with Dialect and bool as the parameters. This will be removed.")] ! public QueryJoinFragment(Dialect.Dialect dialect) : this (dialect, false) ! { ! } ! ! public QueryJoinFragment(Dialect.Dialect dialect, bool useThetaStyleInnerJoins) ! { this.dialect = dialect; + this.useThetaStyleInnerJoins = useThetaStyleInnerJoins; } ! ! public override void AddJoin(string tableName, string alias, string[] fkColumns, string[] pkColumns, JoinType joinType) ! { ! AddJoin(tableName, alias, alias, fkColumns, pkColumns, joinType); ! } ! ! public void AddJoin(string tableName, string alias, string concreteAlias, string[] fkColumns, string[] pkColumns, JoinType joinType) ! { ! if (!useThetaStyleInnerJoins || joinType!=JoinType.InnerJoin) ! { JoinFragment jf = dialect.CreateOuterJoinFragment(); jf.AddJoin(tableName, alias, fkColumns, pkColumns, joinType); AddFragment(jf); } ! else ! { AddCrossJoin(tableName, alias); ! AddCondition(concreteAlias, fkColumns, pkColumns); } } ! public override string ToFromFragmentString ! { get { return afterFrom.ToString(); } } ! public override string ToWhereFragmentString ! { get { return afterWhere.ToString(); } } ! public override void AddJoins(string fromFragment, string whereFragment) ! { afterFrom.Append(fromFragment); afterWhere.Append(whereFragment); } ! public override JoinFragment Copy() ! { ! QueryJoinFragment copy = new QueryJoinFragment(dialect, useThetaStyleInnerJoins); copy.afterFrom = new StringBuilder( afterFrom.ToString() ); copy.afterWhere = new StringBuilder( afterWhere.ToString() ); *************** *** 53,58 **** } ! public override void AddCondition(string alias, string[] columns, string condition) { ! for ( int i=0; i<columns.Length; i++ ) { afterWhere.Append(" and ") .Append(alias) --- 73,80 ---- } ! public override void AddCondition(string alias, string[] columns, string condition) ! { ! for ( int i=0; i<columns.Length; i++ ) ! { afterWhere.Append(" and ") .Append(alias) *************** *** 64,68 **** ! public override void AddCrossJoin(string tableName, string alias) { afterFrom.Append(StringHelper.CommaSpace) .Append(tableName) --- 86,91 ---- ! public override void AddCrossJoin(string tableName, string alias) ! { afterFrom.Append(StringHelper.CommaSpace) .Append(tableName) *************** *** 71,75 **** } ! public override void AddCondition(string alias, string[] fkColumns, string[] pkColumns) { for ( int j=0; j<fkColumns.Length; j++) { afterWhere.Append(" and ") --- 94,99 ---- } ! public override void AddCondition(string alias, string[] fkColumns, string[] pkColumns) ! { for ( int j=0; j<fkColumns.Length; j++) { afterWhere.Append(" and ") *************** *** 82,86 **** } ! public override void AddCondition(string condition) { if ( afterFrom.ToString().IndexOf( condition.Trim() ) < 0 && --- 106,111 ---- } ! public override void AddCondition(string condition) ! { if ( afterFrom.ToString().IndexOf( condition.Trim() ) < 0 && Index: ANSIJoinFragment.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql/ANSIJoinFragment.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ANSIJoinFragment.cs 27 Feb 2003 23:33:28 -0000 1.1 --- ANSIJoinFragment.cs 30 Apr 2004 13:10:17 -0000 1.2 *************** *** 3,15 **** using NHibernate.Util; ! namespace NHibernate.Sql { ! ! public class ANSIJoinFragment : JoinFragment { private StringBuilder buffer = new StringBuilder(); private StringBuilder conditions = new StringBuilder(); ! public override void AddJoin(string tableName, string alias, string[] fkColumns, string[] pkColumns, JoinType joinType) { string joinString = null; ! switch (joinType) { case JoinType.InnerJoin: joinString = " inner join "; --- 3,21 ---- using NHibernate.Util; ! namespace NHibernate.Sql ! { ! /// <summary> ! /// An ANSI-style Join. ! /// </summary> ! public class ANSIJoinFragment : JoinFragment ! { private StringBuilder buffer = new StringBuilder(); private StringBuilder conditions = new StringBuilder(); ! public override void AddJoin(string tableName, string alias, string[] fkColumns, string[] pkColumns, JoinType joinType) ! { string joinString = null; ! switch (joinType) ! { case JoinType.InnerJoin: joinString = " inner join "; *************** *** 24,27 **** --- 30,35 ---- joinString = " full outer join "; break; + default: + throw new AssertionFailure("undefind join type"); } *************** *** 32,36 **** .Append(" on "); ! for (int j=0; j<fkColumns.Length; j++) { if (fkColumns[j].IndexOf('.')<1) throw new AssertionFailure("missing alias"); buffer.Append( fkColumns[j] ) --- 40,45 ---- .Append(" on "); ! for (int j=0; j<fkColumns.Length; j++) ! { if (fkColumns[j].IndexOf('.')<1) throw new AssertionFailure("missing alias"); buffer.Append( fkColumns[j] ) *************** *** 43,60 **** } ! public override string ToFromFragmentString { get { return buffer.ToString(); } } ! public override string ToWhereFragmentString { get { return conditions.ToString(); } } ! public override void AddJoins(string fromFragment, string whereFragment) { buffer.Append(fromFragment); //where fragment must be empty! } ! public override JoinFragment Copy() { ANSIJoinFragment copy = new ANSIJoinFragment(); copy.buffer = new StringBuilder( buffer.ToString() ); --- 52,73 ---- } ! public override string ToFromFragmentString ! { get { return buffer.ToString(); } } ! public override string ToWhereFragmentString ! { get { return conditions.ToString(); } } ! public override void AddJoins(string fromFragment, string whereFragment) ! { buffer.Append(fromFragment); //where fragment must be empty! } ! public override JoinFragment Copy() ! { ANSIJoinFragment copy = new ANSIJoinFragment(); copy.buffer = new StringBuilder( buffer.ToString() ); *************** *** 62,67 **** } ! public override void AddCondition(string alias, string[] columns, string condition) { ! for (int i=0; i<columns.Length; i++) { conditions.Append(" and ") .Append(alias) --- 75,82 ---- } ! public override void AddCondition(string alias, string[] columns, string condition) ! { ! for (int i=0; i<columns.Length; i++) ! { conditions.Append(" and ") .Append(alias) *************** *** 72,76 **** } ! public override void AddCrossJoin(string tableName, string alias) { buffer.Append(StringHelper.CommaSpace) .Append(tableName) --- 87,92 ---- } ! public override void AddCrossJoin(string tableName, string alias) ! { buffer.Append(StringHelper.CommaSpace) .Append(tableName) *************** *** 79,87 **** } ! public override void AddCondition(string alias, string[] fkColumns, string[] pkColumns) { throw new NotSupportedException(); } ! public override void AddCondition(string condition) { throw new NotSupportedException(); } --- 95,105 ---- } ! public override void AddCondition(string alias, string[] fkColumns, string[] pkColumns) ! { throw new NotSupportedException(); } ! public override void AddCondition(string condition) ! { throw new NotSupportedException(); } Index: QuerySelect.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql/QuerySelect.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** QuerySelect.cs 19 Apr 2004 04:31:04 -0000 1.4 --- QuerySelect.cs 30 Apr 2004 13:10:18 -0000 1.5 *************** *** 6,15 **** using NHibernate.Util; ! namespace NHibernate.Sql { /// <summary> /// Summary description for QuerySelect. /// </summary> ! public class QuerySelect { ! private JoinFragment joins; private StringBuilder select = new StringBuilder(); --- 6,16 ---- using NHibernate.Util; ! namespace NHibernate.Sql ! { /// <summary> /// Summary description for QuerySelect. /// </summary> ! public class QuerySelect ! { private JoinFragment joins; private StringBuilder select = new StringBuilder(); *************** *** 22,27 **** private static readonly IList dontSpace = new ArrayList(); ! static QuerySelect() { ! //dontSpace.add("'"); dontSpace.Add("."); --- 23,28 ---- private static readonly IList dontSpace = new ArrayList(); ! static QuerySelect() ! { //dontSpace.add("'"); dontSpace.Add("."); *************** *** 51,66 **** } ! public QuerySelect(Dialect.Dialect dialect) { ! joins = new QueryJoinFragment(dialect); } ! public JoinFragment JoinFragment { get { return joins; } } ! public void AddSelectFragmentString(string fragment) { if ( fragment.Length>0 && fragment[0]==',' ) fragment = fragment.Substring(1); fragment = fragment.Trim(); ! if ( fragment.Length>0 ) { if ( select.Length>0 ) select.Append(StringHelper.CommaSpace); select.Append(fragment); --- 52,71 ---- } ! public QuerySelect(Dialect.Dialect dialect) ! { ! joins = new QueryJoinFragment(dialect, false); } ! public JoinFragment JoinFragment ! { get { return joins; } } ! public void AddSelectFragmentString(string fragment) ! { if ( fragment.Length>0 && fragment[0]==',' ) fragment = fragment.Substring(1); fragment = fragment.Trim(); ! if ( fragment.Length>0 ) ! { if ( select.Length>0 ) select.Append(StringHelper.CommaSpace); select.Append(fragment); *************** *** 68,102 **** } ! public void AddSelectColumn(string columnName, string alias) { AddSelectFragmentString(columnName + ' ' + alias); } ! public bool Distinct { set { this.distinct = value; } } ! public ICollection WhereTokens { //if ( conjunctiveWhere.length()>0 ) conjunctiveWhere.append(" and "); set { AppendTokens(where, value); } } ! public ICollection GroupByTokens { //if ( groupBy.length()>0 ) groupBy.append(" and "); set { AppendTokens(groupBy, value); } } ! public ICollection OrderByTokens { //if ( orderBy.length()>0 ) orderBy.append(" and "); set { AppendTokens(orderBy, value); } } ! public ICollection HavingTokens { //if ( having.length()>0 ) having.append(" and "); set { AppendTokens(having, value); } } ! public string ToQueryString() { StringBuilder buf = new StringBuilder(50) .Append("select "); if (distinct) buf.Append("distinct "); --- 73,121 ---- } ! public void AddSelectColumn(string columnName, string alias) ! { AddSelectFragmentString(columnName + ' ' + alias); } ! public bool Distinct ! { set { this.distinct = value; } } ! public ICollection WhereTokens ! { //if ( conjunctiveWhere.length()>0 ) conjunctiveWhere.append(" and "); set { AppendTokens(where, value); } } ! public ICollection GroupByTokens ! { //if ( groupBy.length()>0 ) groupBy.append(" and "); set { AppendTokens(groupBy, value); } } ! public ICollection OrderByTokens ! { //if ( orderBy.length()>0 ) orderBy.append(" and "); set { AppendTokens(orderBy, value); } } ! public ICollection HavingTokens ! { //if ( having.length()>0 ) having.append(" and "); set { AppendTokens(having, value); } } ! public void AddOrderBy(string orderByString) ! { ! if( orderBy.Length > 0 ) orderBy.Append(StringHelper.CommaSpace); ! orderBy.Append(orderByString); ! } ! ! public string ToQueryString() ! { StringBuilder buf = new StringBuilder(50) .Append("select "); + if (distinct) buf.Append("distinct "); *************** *** 114,141 **** .Append(" from") .Append( from ); string part1 = joins.ToWhereFragmentString.Trim(); string part2 = where.ToString().Trim(); bool hasPart1 = part1.Length > 0; bool hasPart2 = part2.Length > 0; if (hasPart1 || hasPart2) buf.Append(" where "); if (hasPart1) buf.Append( part1.Substring(4) ); ! if (hasPart2) { if (hasPart1) buf.Append(" and ("); buf.Append(part2); if (hasPart1) buf.Append(")"); } ! if ( groupBy.Length > 0 ) buf.Append(" group by ").Append(groupBy); ! if ( having.Length > 0 ) buf.Append(" having ").Append(having); ! if ( orderBy.Length > 0 ) buf.Append(" order by ").Append(orderBy); return buf.ToString(); } ! private void AppendTokens(StringBuilder buf, ICollection iter) { ! bool lastSpaceable=true; ! foreach(string token in iter) { bool spaceable = !dontSpace.Contains(token); ! if (spaceable && lastSpaceable) buf.Append(' '); lastSpaceable = spaceable; buf.Append(token); } } --- 133,174 ---- .Append(" from") .Append( from ); + string part1 = joins.ToWhereFragmentString.Trim(); string part2 = where.ToString().Trim(); bool hasPart1 = part1.Length > 0; bool hasPart2 = part2.Length > 0; + if (hasPart1 || hasPart2) buf.Append(" where "); if (hasPart1) buf.Append( part1.Substring(4) ); ! if (hasPart2) ! { if (hasPart1) buf.Append(" and ("); buf.Append(part2); if (hasPart1) buf.Append(")"); } ! if ( groupBy.Length > 0 ) buf.Append(" group by ").Append( groupBy.ToString() ); ! if ( having.Length > 0 ) buf.Append(" having ").Append( having.ToString() ); ! if ( orderBy.Length > 0 ) buf.Append(" order by ").Append( orderBy.ToString() ); return buf.ToString(); } ! private void AppendTokens(StringBuilder buf, ICollection iter) ! { ! bool lastSpaceable = true; ! bool lastQuoted = false; ! ! foreach(string token in iter) ! { bool spaceable = !dontSpace.Contains(token); ! bool quoted = token.StartsWith("'"); ! ! if (spaceable && lastSpaceable) ! { ! if (!quoted || !lastQuoted) buf.Append(' '); ! } ! lastSpaceable = spaceable; buf.Append(token); + lastQuoted = token.EndsWith("'"); } } Index: JoinFragment.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql/JoinFragment.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** JoinFragment.cs 13 Mar 2003 21:58:49 -0000 1.2 --- JoinFragment.cs 30 Apr 2004 13:10:18 -0000 1.3 *************** *** 1,7 **** using System; ! namespace NHibernate.Sql { ! ! public enum JoinType { None = -666, InnerJoin = 0, --- 1,8 ---- using System; ! namespace NHibernate.Sql ! { ! public enum JoinType ! { None = -666, InnerJoin = 0, *************** *** 11,15 **** } ! public abstract class JoinFragment { public abstract void AddJoin(string tableName, string alias, string[] fkColumns, string[] pkColumns, JoinType joinType); --- 12,20 ---- } ! /// <summary> ! /// Represents a SQL <c>JOIN</c> ! /// </summary> ! public abstract class JoinFragment ! { public abstract void AddJoin(string tableName, string alias, string[] fkColumns, string[] pkColumns, JoinType joinType); *************** *** 24,28 **** public abstract JoinFragment Copy(); ! public void AddFragment(JoinFragment ojf) { AddJoins( ojf.ToFromFragmentString, ojf.ToWhereFragmentString ); } --- 29,34 ---- public abstract JoinFragment Copy(); ! public void AddFragment(JoinFragment ojf) ! { AddJoins( ojf.ToFromFragmentString, ojf.ToWhereFragmentString ); } Index: OracleJoinFragment.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql/OracleJoinFragment.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OracleJoinFragment.cs 27 Feb 2003 23:33:28 -0000 1.1 --- OracleJoinFragment.cs 30 Apr 2004 13:10:18 -0000 1.2 *************** *** 3,41 **** using NHibernate.Util; ! namespace NHibernate.Sql { ! ! public class OracleJoinFragment : JoinFragment { private StringBuilder afterFrom = new StringBuilder(); private StringBuilder afterWhere = new StringBuilder(); ! public override void AddJoin(string tableName, string alias, string[] fkColumns, string[] pkColumns, JoinType joinType) { AddCrossJoin(tableName, alias); ! for (int j=0; j<fkColumns.Length; j++) { afterWhere.Append(" and ") .Append( fkColumns[j] ); if (joinType == JoinType.RightOuterJoin || joinType == JoinType.FullJoin) afterWhere.Append("(+)"); afterWhere.Append('=') .Append(alias) .Append(StringHelper.Dot) .Append( pkColumns[j] ); if (joinType == JoinType.LeftOuterJoin || joinType == JoinType.FullJoin) afterWhere.Append("(+)"); } } ! public override string ToFromFragmentString { get { return afterFrom.ToString(); } } ! public override string ToWhereFragmentString { get { return afterWhere.ToString(); } } ! public override void AddJoins(string fromFragment, string whereFragment) { afterFrom.Append(fromFragment); afterWhere.Append(whereFragment); } ! public override JoinFragment Copy() { OracleJoinFragment copy = new OracleJoinFragment(); copy.afterFrom = new StringBuilder( afterFrom.ToString() ); --- 3,53 ---- using NHibernate.Util; ! namespace NHibernate.Sql ! { ! /// <summary> ! /// An Oracle-style (theta) Join ! /// </summary> ! public class OracleJoinFragment : JoinFragment ! { private StringBuilder afterFrom = new StringBuilder(); private StringBuilder afterWhere = new StringBuilder(); ! public override void AddJoin(string tableName, string alias, string[] fkColumns, string[] pkColumns, JoinType joinType) ! { AddCrossJoin(tableName, alias); ! for (int j=0; j<fkColumns.Length; j++) ! { afterWhere.Append(" and ") .Append( fkColumns[j] ); if (joinType == JoinType.RightOuterJoin || joinType == JoinType.FullJoin) afterWhere.Append("(+)"); + afterWhere.Append('=') .Append(alias) .Append(StringHelper.Dot) .Append( pkColumns[j] ); + if (joinType == JoinType.LeftOuterJoin || joinType == JoinType.FullJoin) afterWhere.Append("(+)"); } } ! public override string ToFromFragmentString ! { get { return afterFrom.ToString(); } } ! public override string ToWhereFragmentString ! { get { return afterWhere.ToString(); } } ! public override void AddJoins(string fromFragment, string whereFragment) ! { afterFrom.Append(fromFragment); afterWhere.Append(whereFragment); } ! public override JoinFragment Copy() ! { OracleJoinFragment copy = new OracleJoinFragment(); copy.afterFrom = new StringBuilder( afterFrom.ToString() ); *************** *** 44,49 **** } ! public override void AddCondition(string alias, string[] columns, string condition) { ! for (int i=0; i<columns.Length; i++) { afterWhere.Append(" and ") .Append(alias) --- 56,63 ---- } ! public override void AddCondition(string alias, string[] columns, string condition) ! { ! for (int i=0; i<columns.Length; i++) ! { afterWhere.Append(" and ") .Append(alias) *************** *** 54,58 **** } ! public override void AddCrossJoin(string tableName, string alias) { afterFrom.Append(StringHelper.CommaSpace) .Append(tableName) --- 68,73 ---- } ! public override void AddCrossJoin(string tableName, string alias) ! { afterFrom.Append(StringHelper.CommaSpace) .Append(tableName) *************** *** 61,69 **** } ! public override void AddCondition(string alias, string[] fkColumns, string[] pkColumns) { throw new NotSupportedException(); } ! public override void AddCondition(string condition) { throw new NotSupportedException(); } --- 76,86 ---- } ! public override void AddCondition(string alias, string[] fkColumns, string[] pkColumns) ! { throw new NotSupportedException(); } ! public override void AddCondition(string condition) ! { throw new NotSupportedException(); } Index: InFragment.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql/InFragment.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** InFragment.cs 6 Apr 2004 12:16:41 -0000 1.3 --- InFragment.cs 30 Apr 2004 13:10:18 -0000 1.4 *************** *** 4,55 **** using NHibernate.Util; ! namespace NHibernate.Sql { ! /// <summary> /// Represents an <c>... in (...)</c> expression /// </summary> ! public class InFragment { private string columnName; private ArrayList values = new ArrayList(); ! public InFragment AddValue(string value) { values.Add(value); return this; } ! public InFragment SetColumn(string columnName) { this.columnName = columnName; return this; } ! public InFragment SetColumn(string alias, string columnName) { ! return SetColumn( this.columnName = alias + StringHelper.Dot + columnName ); } ! public string ToFragmentString() { StringBuilder buf = new StringBuilder(values.Count * 5); buf.Append(columnName); ! if (values.Count > 1) { bool allowNull = false; buf.Append(" in ("); ! for(int i=0; i<values.Count; i++) { ! if("null".Equals(values[i])) allowNull = true; ! else { buf.Append( values[i] ); if ( i<values.Count-1) buf.Append(StringHelper.CommaSpace); } } buf.Append(StringHelper.ClosedParen); ! if(allowNull) buf.Insert(0, " is null or ") .Insert(0, columnName) .Insert(0, StringHelper.OpenParen) .Append(StringHelper.ClosedParen); ! } else { string value = values[0] as string; ! if ( "null".Equals(value) ) { buf.Append(" is null"); ! } else { buf.Append("=").Append(values[0]); } --- 4,75 ---- using NHibernate.Util; ! namespace NHibernate.Sql ! { /// <summary> /// Represents an <c>... in (...)</c> expression /// </summary> ! public class InFragment ! { private string columnName; private ArrayList values = new ArrayList(); ! public InFragment AddValue(string value) ! { values.Add(value); return this; } ! public InFragment SetColumn(string columnName) ! { this.columnName = columnName; return this; } ! public InFragment SetColumn(string alias, string columnName) ! { ! this.columnName = alias + StringHelper.Dot + columnName; ! return SetColumn( this.columnName ); } ! public string ToFragmentString() ! { StringBuilder buf = new StringBuilder(values.Count * 5); buf.Append(columnName); ! if (values.Count > 1) ! { bool allowNull = false; buf.Append(" in ("); ! for(int i=0; i<values.Count; i++) ! { ! if("null".Equals(values[i])) ! { allowNull = true; ! } ! ! else ! { buf.Append( values[i] ); if ( i<values.Count-1) buf.Append(StringHelper.CommaSpace); } } + buf.Append(StringHelper.ClosedParen); ! if(allowNull) ! { buf.Insert(0, " is null or ") .Insert(0, columnName) .Insert(0, StringHelper.OpenParen) .Append(StringHelper.ClosedParen); ! } ! } ! else ! { string value = values[0] as string; ! if ( "null".Equals(value) ) ! { buf.Append(" is null"); ! } ! else ! { buf.Append("=").Append(values[0]); } Index: OracleOuterJoinFragment.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Sql/OracleOuterJoinFragment.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** OracleOuterJoinFragment.cs 18 Feb 2003 19:11:48 -0000 1.1 --- OracleOuterJoinFragment.cs 30 Apr 2004 13:10:18 -0000 1.2 *************** *** 5,8 **** --- 5,9 ---- namespace NHibernate.Sql { + //TODO: not in H2.0.3 - is this used anywhere???? public class OracleOuterJoinFragment : OuterJoinFragment { private StringBuilder afterFrom = new StringBuilder(); |
From: Michael D. <mik...@us...> - 2004-04-30 13:10:26
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5665/NHibernate Modified Files: NHibernate-1.1.csproj Log Message: synched the Sql parts used by Hql. Removed OuterJoin files because they were not in H2.0.3 and could not find them used anywhere by NH Index: NHibernate-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/NHibernate-1.1.csproj,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** NHibernate-1.1.csproj 21 Apr 2004 14:31:12 -0000 1.21 --- NHibernate-1.1.csproj 30 Apr 2004 13:10:17 -0000 1.22 *************** *** 1309,1322 **** /> <File - RelPath = "Sql\OracleOuterJoinFragment.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File - RelPath = "Sql\OuterJoinFragment.cs" - SubType = "Code" - BuildAction = "Compile" - /> - <File RelPath = "Sql\QueryJoinFragment.cs" SubType = "Code" --- 1309,1312 ---- |
From: Peter S. <sz...@us...> - 2004-04-30 09:35:52
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28388/NHibernate/Hql Modified Files: WhereParser.cs Log Message: HQL... Index: WhereParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/WhereParser.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** WhereParser.cs 15 Apr 2004 11:36:35 -0000 1.11 --- WhereParser.cs 30 Apr 2004 09:35:40 -0000 1.12 *************** *** 150,156 **** private ArrayList joins = new ArrayList(); //the join string built up by compound paths inside this expression private ArrayList booleanTests = new ArrayList();//a flag indicating if the subexpression is known to be boolean ! ! ! private string GetElementName(PathExpressionParser.CollectionElement element, QueryTranslator q) { --- 150,154 ---- private ArrayList joins = new ArrayList(); //the join string built up by compound paths inside this expression private ArrayList booleanTests = new ArrayList();//a flag indicating if the subexpression is known to be boolean ! private string GetElementName(PathExpressionParser.CollectionElement element, QueryTranslator q) { *************** *** 202,206 **** if (expectingPathContinuation) { - expectingPathContinuation = false; --- 200,203 ---- *************** *** 232,236 **** } - //Cope with a subselect --- 229,232 ---- *************** *** 392,396 **** private void DoPathExpression(string token, QueryTranslator q) { - Preprocess( token, q ); --- 388,391 ---- *************** *** 433,444 **** private void DoToken(string token, QueryTranslator q) { ! if (q.IsName(StringHelper.Root(token))) ! { //path expression DoPathExpression(q.Unalias(token), q); } ! else if (token.StartsWith(ParserHelper.HqlVariablePrefix)) { - //named query parameter q.AddNamedParameter(token.Substring(1)); AppendToken(q, "[<" + token.Substring(1) + ">]"); // THEO } --- 428,439 ---- private void DoToken(string token, QueryTranslator q) { ! if (q.IsName(StringHelper.Root(token))) //path expression ! { DoPathExpression(q.Unalias(token), q); } ! else if (token.StartsWith(ParserHelper.HqlVariablePrefix)) //named query parameter { q.AddNamedParameter(token.Substring(1)); + //TODO: H2.0.3 why token is not '?' ?? AppendToken(q, "[<" + token.Substring(1) + ">]"); // THEO } *************** *** 446,451 **** { IQueryable p = q.GetPersisterUsingImports(token); ! if (p != null) ! { // the name of a class AppendToken(q, p.DiscriminatorSQLString); } --- 441,446 ---- { IQueryable p = q.GetPersisterUsingImports(token); ! if (p != null) // the name of a class ! { AppendToken(q, p.DiscriminatorSQLString); } *************** *** 454,458 **** object constant; ! if ( token.IndexOf((System.Char) StringHelper.Dot) > - 1 && (constant = ReflectHelper.GetConstantValue(token)) != null) { --- 449,453 ---- object constant; ! if ( token.IndexOf((System.Char) StringHelper.Dot) > - 1 && (constant = ReflectHelper.GetConstantValue(token)) != null) { |
From: Peter S. <sz...@us...> - 2004-04-30 09:22:37
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26350/NHibernate/Hql Modified Files: SelectParser.cs Log Message: HQL... Index: SelectParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/SelectParser.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SelectParser.cs 14 Apr 2004 12:34:00 -0000 1.7 --- SelectParser.cs 30 Apr 2004 09:22:28 -0000 1.8 *************** *** 30,33 **** --- 30,34 ---- { //TODO: would be nice to use false, but issues with MS SQL + //TODO: H2.0.3 why not getting info from Dialect? pathExpressionParser.UseThetaStyleJoin = true; aggregatePathExpressionParser.UseThetaStyleJoin = true; *************** *** 174,178 **** if (!ready) throw new QueryException(", expected in SELECT"); ! ParserHelper.Parse(pathExpressionParser, token, ParserHelper.PathSeparators, q); if (pathExpressionParser.IsCollectionValued) { --- 175,179 ---- if (!ready) throw new QueryException(", expected in SELECT"); ! ParserHelper.Parse(pathExpressionParser, q.Unalias( token ), ParserHelper.PathSeparators, q); if (pathExpressionParser.IsCollectionValued) { *************** *** 192,195 **** --- 193,197 ---- } } + public bool AggregateHasArgs(String funcToken, QueryTranslator q) { |
From: Peter S. <sz...@us...> - 2004-04-30 08:58:08
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21335/NHibernate/Hql Modified Files: FromParser.cs HavingParser.cs OrderByParser.cs PathExpressionParser.cs Log Message: Working on HQL Index: FromParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/FromParser.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** FromParser.cs 30 Apr 2004 08:34:25 -0000 1.7 --- FromParser.cs 30 Apr 2004 08:57:59 -0000 1.8 *************** *** 143,147 **** { // treat it as a classname ! ILoadable p = q.GetPersisterUsingImports(token); if (p==null) throw new QueryException("persister not found: " + token); q.AddFromClass(alias, p); --- 143,147 ---- { // treat it as a classname ! IQueryable p = q.GetPersisterUsingImports(token); if (p==null) throw new QueryException("persister not found: " + token); q.AddFromClass(alias, p); *************** *** 168,172 **** // at the start, in the "new" HQL style or an alias that // appears at the start in the "old HQL stype ! ILoadable p = q.GetPersisterUsingImports(token); if (p!=null) { --- 168,172 ---- // at the start, in the "new" HQL style or an alias that // appears at the start in the "old HQL stype ! IQueryable p = q.GetPersisterUsingImports(token); if (p!=null) { Index: PathExpressionParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/PathExpressionParser.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** PathExpressionParser.cs 29 Apr 2004 14:00:52 -0000 1.12 --- PathExpressionParser.cs 30 Apr 2004 08:57:59 -0000 1.13 *************** *** 22,25 **** --- 22,30 ---- //ways in which path expressions can occur + //We should actually rework this class to not implement Parser + //and just process path expressions in the most convenient way. + + //The class is now way to complex! + public const string EntityID = "id"; public const string EntityClass = "class"; *************** *** 39,45 **** protected string[] collectionElementColumns; protected string collectionName; private string collectionRole; private string collectionTable; - private string collectionOwnerName; protected IType collectionElementType; private string componentPath; --- 44,50 ---- protected string[] collectionElementColumns; protected string collectionName; + private string collectionOwnerName; private string collectionRole; private string collectionTable; protected IType collectionElementType; private string componentPath; *************** *** 195,199 **** else { - string name = q.CreateNameFor(memberClass); q.AddType(name, memberClass); --- 200,203 ---- *************** *** 208,223 **** else if (propertyType.IsPersistentCollectionType) { - collectionRole = ((PersistentCollectionType) propertyType).Role; ! CollectionPersister p = q.GetCollectionPersister(collectionRole); ! string[] colNames = p.KeyColumnNames; string name = q.CreateNameForCollection(collectionRole); ! AddJoin( p.QualifiedTableName, name, colNames, q); ! if ( p.HasWhere ) join.AddCondition( p.GetSQLWhereString(name) ); ! DoCollectionProperty(token, p, name); collectionName = name; collectionOwnerName = currentName; ! collectionTable = p.QualifiedTableName; currentName = null; currentProperty = null; --- 212,227 ---- else if (propertyType.IsPersistentCollectionType) { collectionRole = ((PersistentCollectionType) propertyType).Role; ! CollectionPersister collPersister = q.GetCollectionPersister(collectionRole); ! string[] colNames = collPersister.KeyColumnNames; string name = q.CreateNameForCollection(collectionRole); ! string tableName = collPersister.QualifiedTableName; ! AddJoin( tableName, name, colNames, q); ! if ( collPersister.HasWhere ) join.AddCondition( collPersister.GetSQLWhereString(name) ); ! DoCollectionProperty(token, collPersister, name); collectionName = name; collectionOwnerName = currentName; ! collectionTable = collPersister.QualifiedTableName; currentName = null; currentProperty = null; *************** *** 228,234 **** if (token != null) throw new QueryException("dereferenced: " + currentProperty); } - } - } } --- 232,236 ---- *************** *** 321,325 **** else { - if (!continuation) { --- 323,326 ---- *************** *** 333,337 **** if (collectionRole != null) { - //special case; expecting: [index] CollectionPersister memberPersister = q.GetCollectionPersister(collectionRole); --- 334,337 ---- *************** *** 346,350 **** if ( memberPersister.IsOneToMany ) { ! ILoadable persister = q.GetPersister( ( (EntityType) memberPersister.ElementType ).PersistentClass ); ojf.AddJoins( persister.FromJoinFragment(collectionName, true, false), --- 346,350 ---- if ( memberPersister.IsOneToMany ) { ! IQueryable persister = q.GetPersister( ( (EntityType) memberPersister.ElementType ).PersistentClass ); ojf.AddJoins( persister.FromJoinFragment(collectionName, true, false), *************** *** 360,364 **** string[] eltCols = memberPersister.ElementColumnNames; ! //if ( eltCols.length!=1 ) throw new QueryException("composite-id collection element []"); CollectionElement elem = new CollectionElement(); --- 360,364 ---- string[] eltCols = memberPersister.ElementColumnNames; ! //if ( eltCols.Length!=1 ) throw new QueryException("composite-id collection element []"); CollectionElement elem = new CollectionElement(); *************** *** 472,476 **** public string GetCollectionSubquery() { ! return new StringBuilder("SELECT ") .Append(String.Join(", ", collectionElementColumns)) --- 472,476 ---- public string GetCollectionSubquery() { ! //TODO: refactor to .sql package return new StringBuilder("SELECT ") .Append(String.Join(", ", collectionElementColumns)) *************** *** 487,491 **** public bool IsCollectionValued { ! get { return collectionElementColumns!=null; } } --- 487,494 ---- public bool IsCollectionValued { ! get ! { ! return collectionElementColumns!=null; ! } } *************** *** 521,525 **** { q.AddCollection(collectionName, collectionRole); ! ILoadable p = q.GetPersister(clazz); elementName = q.CreateNameFor(clazz); string[] keyColumnNames = p.IdentifierColumnNames; --- 524,528 ---- { q.AddCollection(collectionName, collectionRole); ! IQueryable p = q.GetPersister(clazz); elementName = q.CreateNameFor(clazz); string[] keyColumnNames = p.IdentifierColumnNames; Index: OrderByParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/OrderByParser.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** OrderByParser.cs 14 Apr 2004 11:35:53 -0000 1.4 --- OrderByParser.cs 30 Apr 2004 08:57:59 -0000 1.5 *************** *** 22,26 **** public void Token(string token, QueryTranslator q) { - if (q.IsName(StringHelper.Root(token))) { --- 22,25 ---- Index: HavingParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/HavingParser.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** HavingParser.cs 15 Apr 2004 11:36:35 -0000 1.5 --- HavingParser.cs 30 Apr 2004 08:57:59 -0000 1.6 *************** *** 1,15 **** using System; ! namespace NHibernate.Hql { /// <summary> /// Parses the having clause of a hibernate query and translates it to an /// SQL having clause. /// </summary> ! public class HavingParser : WhereParser { public HavingParser(Dialect.Dialect d) : base(d) { } ! protected override void AppendToken(QueryTranslator q, string token) { q.AppendHavingToken(token); } --- 1,18 ---- using System; ! namespace NHibernate.Hql ! { /// <summary> /// Parses the having clause of a hibernate query and translates it to an /// SQL having clause. /// </summary> ! public class HavingParser : WhereParser ! { public HavingParser(Dialect.Dialect d) : base(d) { } ! protected override void AppendToken(QueryTranslator q, string token) ! { q.AppendHavingToken(token); } |
From: Peter S. <sz...@us...> - 2004-04-30 08:34:33
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16725/NHibernate/Hql Modified Files: ClauseParser.cs FilterTranslator.cs FromParser.cs Log Message: Rereading HQL Index: ClauseParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/ClauseParser.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ClauseParser.cs 15 Apr 2004 11:36:35 -0000 1.5 --- ClauseParser.cs 30 Apr 2004 08:34:25 -0000 1.6 *************** *** 17,21 **** private int parenCount = 0; ! public virtual void Token(string token, QueryTranslator q) { string lcToken = token.ToLower(); --- 17,22 ---- private int parenCount = 0; ! public virtual void Token(string token, QueryTranslator q) ! { string lcToken = token.ToLower(); *************** *** 29,33 **** } ! if (byExpected && !lcToken.Equals("by")) { throw new QueryException("BY expected after GROUP or ORDER: " + token); } --- 30,35 ---- } ! if (byExpected && !lcToken.Equals("by")) ! { throw new QueryException("BY expected after GROUP or ORDER: " + token); } *************** *** 39,43 **** if (lcToken.Equals("select")) { ! selectTokens = new ArrayList(); cacheSelectTokens = true; } --- 41,45 ---- if (lcToken.Equals("select")) { ! selectTokens = new ArrayList(); cacheSelectTokens = true; } Index: FromParser.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/FromParser.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FromParser.cs 19 Apr 2004 04:32:30 -0000 1.6 --- FromParser.cs 30 Apr 2004 08:34:25 -0000 1.7 *************** *** 24,29 **** private bool afterJoinType; private bool afterFetch; - //TODO: H2.0.3 does not have classPersister as a field... - private ILoadable classPersister; private JoinType joinType = JoinType.None; --- 24,27 ---- *************** *** 120,128 **** // AS construction - // if (classPersister!=null) - // { - // q.AddFromClass(token, classPersister); - // } - //else if (entityName!=null) if (entityName!=null) { --- 118,121 ---- *************** *** 137,142 **** expectingAs = false; entityName = null; - classPersister = null; - } else if (afterIn) --- 130,133 ---- *************** *** 146,149 **** --- 137,141 ---- if (alias==null) throw new QueryException("alias not specified for: " + token); + if (joinType!=JoinType.None) throw new QueryException("outer or full join must be followed by path expressions"); *************** *** 181,185 **** // starts with the name of a mapped class (new style) if (joinType!=JoinType.None) throw new QueryException("outer or full join must be followed by path expression"); - classPersister = p; entityName = q.CreateNameFor( p.MappedClass ); q.AddFromClass( entityName, p ); --- 173,176 ---- *************** *** 198,201 **** --- 189,193 ---- // force HQL style: from Person p inner join p.cars c + //if (joinType==JoinType.None) throw new QueryException("path expression must be preceded by full, left, right or inner join"); //allow ODMG OQL style: from Person p, p.cars c *************** *** 240,246 **** } ! public virtual void Start(QueryTranslator q) { entityName = null; - classPersister = null; alias = null; afterIn = false; --- 232,238 ---- } ! public virtual void Start(QueryTranslator q) ! { entityName = null; alias = null; afterIn = false; *************** *** 253,257 **** } ! public virtual void End(QueryTranslator q) { } } --- 245,250 ---- } ! public virtual void End(QueryTranslator q) ! { } } Index: FilterTranslator.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Hql/FilterTranslator.cs,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** FilterTranslator.cs 15 Apr 2004 11:36:35 -0000 1.6 --- FilterTranslator.cs 30 Apr 2004 08:34:25 -0000 1.7 *************** *** 5,25 **** using System.Runtime.CompilerServices; ! namespace NHibernate.Hql { ! public class FilterTranslator : QueryTranslator { ! public FilterTranslator(Dialect.Dialect d) : base(d) { } ! /// <summary> Compile a filter. This method may be called multiple /// times. Subsequent invocations are no-ops. /// </summary> [MethodImpl(MethodImplOptions.Synchronized)] ! public void Compile(string collectionRole, ISessionFactoryImplementor factory, string queryString, IDictionary replacements, bool scalar) { ! if (!compiled) { ! this.factory = factory; // yick! ! AddFromCollection("this", collectionRole); ! base.Compile(factory, queryString, replacements, scalar); } } --- 5,29 ---- using System.Runtime.CompilerServices; ! namespace NHibernate.Hql ! { ! public class FilterTranslator : QueryTranslator ! { public FilterTranslator(Dialect.Dialect d) : base(d) { } ! /// <summary> ! /// Compile a filter. This method may be called multiple /// times. Subsequent invocations are no-ops. /// </summary> [MethodImpl(MethodImplOptions.Synchronized)] ! public void Compile(string collectionRole, ISessionFactoryImplementor factory, string queryString, IDictionary replacements, bool scalar) ! { ! if (!compiled) ! { ! this.factory = factory; // yick! ! AddFromCollection("this", collectionRole); ! base.Compile(factory, queryString, replacements, scalar); } } |
From: Peter S. <sz...@us...> - 2004-04-30 08:20:58
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14298/NHibernate/Cfg Modified Files: Environment.cs Mappings.cs Log Message: Mapping.cs Index: Mappings.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Mappings.cs,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Mappings.cs 12 Apr 2004 05:43:26 -0000 1.5 --- Mappings.cs 30 Apr 2004 08:20:50 -0000 1.6 *************** *** 3,11 **** using NHibernate.Mapping; ! namespace NHibernate.Cfg { /// <summary> /// A collection of mappings from classes and collections to relational database tables. /// </summary> ! public class Mappings { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Mappings)); --- 3,13 ---- using NHibernate.Mapping; ! namespace NHibernate.Cfg ! { /// <summary> /// A collection of mappings from classes and collections to relational database tables. /// </summary> ! public class Mappings ! { private static readonly log4net.ILog log = log4net.LogManager.GetLogger(typeof(Mappings)); *************** *** 20,24 **** private bool autoImport; ! internal Mappings(IDictionary classes, IDictionary collections, IDictionary tables, IDictionary queries, IDictionary imports, IList secondPasses) { this.classes = classes; this.collections = collections; --- 22,27 ---- private bool autoImport; ! internal Mappings(IDictionary classes, IDictionary collections, IDictionary tables, IDictionary queries, IDictionary imports, IList secondPasses) ! { this.classes = classes; this.collections = collections; *************** *** 29,33 **** } ! public void AddClass(PersistentClass persistentClass) { object old = classes[persistentClass.PersistentClazz]; if (old!=null) log.Warn ( "duplicate class mapping: " + persistentClass.PersistentClazz.Name ); --- 32,37 ---- } ! public void AddClass(PersistentClass persistentClass) ! { object old = classes[persistentClass.PersistentClazz]; if (old!=null) log.Warn ( "duplicate class mapping: " + persistentClass.PersistentClazz.Name ); *************** *** 35,39 **** } ! public void AddCollection(Mapping.Collection collection) { object old = collections[collection.Role]; if (old!=null) log.Warn ( "duplicate collection role: " + collection.Role ); --- 39,44 ---- } ! public void AddCollection(Mapping.Collection collection) ! { object old = collections[collection.Role]; if (old!=null) log.Warn ( "duplicate collection role: " + collection.Role ); *************** *** 41,53 **** } ! public PersistentClass GetClass(System.Type type) { return (PersistentClass) classes[type]; } ! public Mapping.Collection GetCollection(string role) { return (Mapping.Collection) collections[role]; } ! public void AddImport(string className, string rename) { if ( imports.Contains(rename) && (string)imports[rename] != className) throw new MappingException("duplicate import: " + rename); --- 46,61 ---- } ! public PersistentClass GetClass(System.Type type) ! { return (PersistentClass) classes[type]; } ! public Mapping.Collection GetCollection(string role) ! { return (Mapping.Collection) collections[role]; } ! public void AddImport(string className, string rename) ! { if ( imports.Contains(rename) && (string)imports[rename] != className) throw new MappingException("duplicate import: " + rename); *************** *** 55,63 **** } ! public Table AddTable(string schema, string name) { string key = schema != null ? schema + "." + name : name; Table table = (Table) tables[key]; ! if (table==null) { table = new Table(); table.Name = name; --- 63,73 ---- } ! public Table AddTable(string schema, string name) ! { string key = schema != null ? schema + "." + name : name; Table table = (Table) tables[key]; ! if (table==null) ! { table = new Table(); table.Name = name; *************** *** 68,99 **** } ! public Table GetTable(string schema, string name) { string key = schema != null ? schema + "." + name : name; return (Table) tables[key]; } ! public string SchemaName { ! get { return schemaName; } ! set { schemaName = value; } } ! public string DefaultCascade { ! get { return defaultCascade; } ! set { defaultCascade = value; } } ! public void AddQuery(string name, string query) { object old = queries[name]; if (old!=null) log.Warn("duplicate query name: " + name); queries[name] = query; } ! public string GetQuery(string name) { return (string) queries[name]; } ! internal void AddSecondPass(Binder.SecondPass sp) { secondPasses.Add(sp); } ! public bool IsAutoImport { ! get { return autoImport; } ! set { autoImport = value; } } } --- 78,138 ---- } ! public Table GetTable(string schema, string name) ! { string key = schema != null ? schema + "." + name : name; return (Table) tables[key]; } ! ! public string SchemaName ! { ! get ! { ! return schemaName; ! } ! set ! { ! schemaName = value; ! } } ! ! public string DefaultCascade ! { ! get ! { ! return defaultCascade; ! } ! set ! { ! defaultCascade = value; ! } } ! public void AddQuery(string name, string query) ! { object old = queries[name]; if (old!=null) log.Warn("duplicate query name: " + name); queries[name] = query; } ! ! public string GetQuery(string name) ! { return (string) queries[name]; } ! ! internal void AddSecondPass(Binder.SecondPass sp) ! { secondPasses.Add(sp); } ! public bool IsAutoImport ! { ! get ! { ! return autoImport; ! } ! set ! { ! autoImport = value; ! } } } Index: Environment.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Environment.cs,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Environment.cs 29 Mar 2004 04:04:57 -0000 1.11 --- Environment.cs 30 Apr 2004 08:20:50 -0000 1.12 *************** *** 31,35 **** private static IDictionary isolationLevels = new Hashtable(); ! private const string Version = "0.1 beta 1"; public const string ConnectionProvider = "hibernate.connection.provider"; --- 31,35 ---- private static IDictionary isolationLevels = new Hashtable(); ! private const string Version = "prealpha3"; public const string ConnectionProvider = "hibernate.connection.provider"; |
From: Michael D. <mik...@us...> - 2004-04-30 04:43:47
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10794/NHibernate/Collection Modified Files: CollectionPersister.cs Log Message: Synched with H2.0.3 Index: CollectionPersister.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Collection/CollectionPersister.cs,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** CollectionPersister.cs 29 Apr 2004 11:24:08 -0000 1.20 --- CollectionPersister.cs 30 Apr 2004 04:43:39 -0000 1.21 *************** *** 7,10 **** --- 7,11 ---- using NHibernate.Cfg; using NHibernate.Engine; + using NHibernate.Id; using NHibernate.Loader; using NHibernate.Mapping; *************** *** 15,20 **** using NHibernate.Util; [...1510 lines suppressed...] + foreach(Column col in columns) + { + if( distinctColumns.Contains(col.Name) ) + { + throw new MappingException( + "Repeated column in mapping for collection: " + + role + + " column: " + + col.Name + ); + } + else + { + distinctColumns.Add(col.Name); + } + } + } + } } |
From: Michael D. <mik...@us...> - 2004-04-30 04:43:17
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10724/NHibernate/SqlCommand Modified Files: SqlDeleteBuilder.cs SqlUpdateBuilder.cs Log Message: Added a new method to support where strings on collection mappings. Index: SqlDeleteBuilder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand/SqlDeleteBuilder.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SqlDeleteBuilder.cs 10 Feb 2004 18:38:55 -0000 1.1 --- SqlDeleteBuilder.cs 30 Apr 2004 04:43:08 -0000 1.2 *************** *** 74,77 **** --- 74,87 ---- } + /// <summary> + /// Adds a string to the WhereFragement + /// </summary> + /// <param name="whereString">A well formed sql string with no parameters.</param> + /// <returns>The SqlDeleteBuilder</returns> + public SqlDeleteBuilder AddWhereFragment(string whereString) + { + whereStrings.Add( new SqlString(whereString) ); + return this; + } #region ISqlStringBuilder Members Index: SqlUpdateBuilder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand/SqlUpdateBuilder.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SqlUpdateBuilder.cs 10 Feb 2004 18:38:55 -0000 1.1 --- SqlUpdateBuilder.cs 30 Apr 2004 04:43:08 -0000 1.2 *************** *** 138,141 **** --- 138,152 ---- return this; } + + /// <summary> + /// Adds a string to the WhereFragement + /// </summary> + /// <param name="whereString">A well formed sql string with no parameters.</param> + /// <returns>The SqlUpdateBuilder</returns> + public SqlUpdateBuilder AddWhereFragment(string whereString) + { + whereStrings.Add( new SqlString(whereString) ); + return this; + } |
From: Michael D. <mik...@us...> - 2004-04-30 04:43:17
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SqlCommandTest In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10724/NHibernate.Test/SqlCommandTest Modified Files: SqlDeleteBuilderFixture.cs SqlUpdateBuilderFixture.cs Log Message: Added a new method to support where strings on collection mappings. Index: SqlUpdateBuilderFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SqlCommandTest/SqlUpdateBuilderFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SqlUpdateBuilderFixture.cs 20 Mar 2004 23:08:55 -0000 1.1 --- SqlUpdateBuilderFixture.cs 30 Apr 2004 04:43:08 -0000 1.2 *************** *** 38,46 **** update.SetVersionColumn(new string[] {"versionColumn"}, (IVersionType)NHibernate.Int32); SqlString sqlString = update.ToSqlString(); Parameter[] actualParams = new Parameter[4]; int numOfParameters = 0; ! string expectedSql = "UPDATE test_update_builder SET intColumn = :intColumn, longColumn = :longColumn, literalColumn = 0, stringColumn = 5 WHERE decimalColumn = :decimalColumn AND versionColumn = :versionColumn"; Assertion.AssertEquals("SQL String", expectedSql , sqlString.ToString()); --- 38,47 ---- update.SetVersionColumn(new string[] {"versionColumn"}, (IVersionType)NHibernate.Int32); + update.AddWhereFragment("a=b"); SqlString sqlString = update.ToSqlString(); Parameter[] actualParams = new Parameter[4]; int numOfParameters = 0; ! string expectedSql = "UPDATE test_update_builder SET intColumn = :intColumn, longColumn = :longColumn, literalColumn = 0, stringColumn = 5 WHERE decimalColumn = :decimalColumn AND versionColumn = :versionColumn AND a=b"; Assertion.AssertEquals("SQL String", expectedSql , sqlString.ToString()); Index: SqlDeleteBuilderFixture.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/SqlCommandTest/SqlDeleteBuilderFixture.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SqlDeleteBuilderFixture.cs 20 Mar 2004 23:08:55 -0000 1.1 --- SqlDeleteBuilderFixture.cs 30 Apr 2004 04:43:08 -0000 1.2 *************** *** 33,36 **** --- 33,37 ---- delete.SetVersionColumn(new string[] {"versionColumn"}, (IVersionType)NHibernate.Int32); + delete.AddWhereFragment("a=b"); SqlString sqlString = delete.ToSqlString(); Parameter[] actualParams = new Parameter[2]; *************** *** 38,42 **** ! string expectedSql = "DELETE FROM test_delete_builder WHERE decimalColumn = :decimalColumn AND versionColumn = :versionColumn"; Assertion.AssertEquals("SQL String", expectedSql , sqlString.ToString()); --- 39,43 ---- ! string expectedSql = "DELETE FROM test_delete_builder WHERE decimalColumn = :decimalColumn AND versionColumn = :versionColumn AND a=b"; Assertion.AssertEquals("SQL String", expectedSql , sqlString.ToString()); |
From: Peter S. <sz...@us...> - 2004-04-29 17:46:50
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11993/NHibernate/Cfg Modified Files: Configuration.cs Log Message: Cfg/Configuration Index: Configuration.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Configuration.cs,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Configuration.cs 15 Apr 2004 21:07:17 -0000 1.12 --- Configuration.cs 29 Apr 2004 17:46:37 -0000 1.13 *************** *** 100,103 **** --- 100,105 ---- /// Get the mapping for a particular collection role /// </summary> + /// <param name="role">role a collection role</param> + /// <returns>collection</returns> public Mapping.Collection GetCollectionMapping(string role) { return (Mapping.Collection) collections[role]; *************** *** 109,115 **** /// <param name="xmlFile">The name of the file (url or file system) that contains the Xml.</param> /// <returns>This Configuration object.</returns> ! public Configuration AddXmlFile(string xmlFile) { log.Debug("Mapping file: " + xmlFile); ! try { AddXmlReader(new XmlTextReader(xmlFile)); // XmlDocument doc = new XmlDocument(); --- 111,119 ---- /// <param name="xmlFile">The name of the file (url or file system) that contains the Xml.</param> /// <returns>This Configuration object.</returns> ! public Configuration AddXmlFile(string xmlFile) ! { log.Debug("Mapping file: " + xmlFile); ! try ! { AddXmlReader(new XmlTextReader(xmlFile)); // XmlDocument doc = new XmlDocument(); *************** *** 117,121 **** // Add ( doc ); } ! catch (Exception e) { log.Error("Could not configure datastore from file: " + xmlFile, e); throw new MappingException(e); --- 121,126 ---- // Add ( doc ); } ! catch (Exception e) ! { log.Error("Could not configure datastore from file: " + xmlFile, e); throw new MappingException(e); *************** *** 129,135 **** /// <param name="xml">A string that contains the Mappings for the Xml</param> /// <returns>This Configuration object.</returns> ! public Configuration AddXmlString(string xml) { if ( log.IsDebugEnabled ) log.Debug("Mapping XML:\n" + xml); ! try { // make a StringReader for the string passed in - the StringReader --- 134,142 ---- /// <param name="xml">A string that contains the Mappings for the Xml</param> /// <returns>This Configuration object.</returns> ! public Configuration AddXmlString(string xml) ! { if ( log.IsDebugEnabled ) log.Debug("Mapping XML:\n" + xml); ! try ! { // make a StringReader for the string passed in - the StringReader *************** *** 142,146 **** // Add ( doc ); } ! catch (Exception e) { log.Error("Could not configure datastore from XML", e); } --- 149,154 ---- // Add ( doc ); } ! catch (Exception e) ! { log.Error("Could not configure datastore from XML", e); } *************** *** 153,163 **** /// <param name="doc">A loaded XmlDocument that contains the Mappings.</param> /// <returns>This Configuration object.</returns> ! public Configuration AddDocument(XmlDocument doc) { if ( log.IsDebugEnabled ) log.Debug("Mapping XML:\n" + doc.OuterXml); ! try { AddXmlReader(new XmlNodeReader(doc)); // Add ( doc ); } ! catch (Exception e) { log.Error("Could not configure datastore from XML document", e); throw new MappingException(e); --- 161,174 ---- /// <param name="doc">A loaded XmlDocument that contains the Mappings.</param> /// <returns>This Configuration object.</returns> ! public Configuration AddDocument(XmlDocument doc) ! { if ( log.IsDebugEnabled ) log.Debug("Mapping XML:\n" + doc.OuterXml); ! try ! { AddXmlReader(new XmlNodeReader(doc)); // Add ( doc ); } ! catch (Exception e) ! { log.Error("Could not configure datastore from XML document", e); throw new MappingException(e); *************** *** 173,179 **** private void Add(XmlDocument doc) { ! try { Binder.dialect = Dialect.Dialect.GetDialect(properties); - //StringHelper.Dialect = Dialect.Dialect.GetDialect(properties); Binder.BindRoot( doc, CreateMappings()); } --- 184,190 ---- private void Add(XmlDocument doc) { ! try ! { Binder.dialect = Dialect.Dialect.GetDialect(properties); Binder.BindRoot( doc, CreateMappings()); } *************** *** 189,193 **** /// </summary> /// <returns></returns> ! public Mappings CreateMappings() { return new Mappings(classes, collections, tables, namedQueries, imports, secondPasses); } --- 200,205 ---- /// </summary> /// <returns></returns> ! public Mappings CreateMappings() ! { return new Mappings(classes, collections, tables, namedQueries, imports, secondPasses); } *************** *** 198,203 **** /// <param name="xmlInputStream">The Stream to read Xml from.</param> /// <returns>This Configuration object.</returns> ! public Configuration AddInputStream(Stream xmlInputStream) { ! try { AddXmlReader(new XmlTextReader(xmlInputStream)); --- 210,217 ---- /// <param name="xmlInputStream">The Stream to read Xml from.</param> /// <returns>This Configuration object.</returns> ! public Configuration AddInputStream(Stream xmlInputStream) ! { ! try ! { AddXmlReader(new XmlTextReader(xmlInputStream)); *************** *** 207,214 **** return this; } ! catch (MappingException me) { throw me; } ! catch (Exception e) { log.Error("Could not configure datastore from input stream", e); throw new MappingException(e); --- 221,230 ---- return this; } ! catch (MappingException me) ! { throw me; } ! catch (Exception e) ! { log.Error("Could not configure datastore from input stream", e); throw new MappingException(e); *************** *** 222,226 **** /// <param name="hbmReader">The XmlReader that contains the mapping.</param> /// <returns>This Configuration object.</returns> ! public Configuration AddXmlReader(XmlReader hbmReader) { XmlValidatingReader validatingReader = new XmlValidatingReader(hbmReader); --- 238,243 ---- /// <param name="hbmReader">The XmlReader that contains the mapping.</param> /// <returns>This Configuration object.</returns> ! public Configuration AddXmlReader(XmlReader hbmReader) ! { XmlValidatingReader validatingReader = new XmlValidatingReader(hbmReader); *************** *** 241,245 **** /// <param name="assembly">The Assembly that contains the Resource file.</param> /// <returns>This Configuration object.</returns> ! public Configuration AddResource(string path, Assembly assembly) { log.Info("mapping resource: " + path); Stream rsrc = assembly.GetManifestResourceStream(path); --- 258,263 ---- /// <param name="assembly">The Assembly that contains the Resource file.</param> /// <returns>This Configuration object.</returns> ! public Configuration AddResource(string path, Assembly assembly) ! { log.Info("mapping resource: " + path); Stream rsrc = assembly.GetManifestResourceStream(path); *************** *** 258,262 **** /// the same naming convention then this can not be used. /// </remarks> ! public Configuration AddClass(System.Type persistentClass) { string fileName = persistentClass.FullName + ".hbm.xml"; log.Info("Mapping resource: " + fileName); --- 276,281 ---- /// the same naming convention then this can not be used. /// </remarks> ! public Configuration AddClass(System.Type persistentClass) ! { string fileName = persistentClass.FullName + ".hbm.xml"; log.Info("Mapping resource: " + fileName); *************** *** 275,299 **** /// Assembly can be loaded by name. /// </remarks> ! public Configuration AddAssembly(string assemblyName) { log.Info("searching for mapped documents in assembly: " + assemblyName); Assembly assembly = null; ! try { assembly = Assembly.Load(assemblyName); } ! catch (Exception e) { log.Error("Could not configure datastore from assembly", e); throw new MappingException(e); } ! foreach(string fileName in assembly.GetManifestResourceNames() ) { ! if ( fileName.EndsWith(".hbm.xml") ) { log.Info( "Found mapping documents in assembly: " + fileName ); ! try { AddInputStream( assembly.GetManifestResourceStream(fileName) ); } ! catch (MappingException me) { throw me; } ! catch (Exception e) { log.Error("Could not configure datastore from assembly", e); throw new MappingException(e); --- 294,326 ---- /// Assembly can be loaded by name. /// </remarks> ! public Configuration AddAssembly(string assemblyName) ! { log.Info("searching for mapped documents in assembly: " + assemblyName); Assembly assembly = null; ! try ! { assembly = Assembly.Load(assemblyName); } ! catch (Exception e) ! { log.Error("Could not configure datastore from assembly", e); throw new MappingException(e); } ! foreach(string fileName in assembly.GetManifestResourceNames() ) ! { ! if ( fileName.EndsWith(".hbm.xml") ) ! { log.Info( "Found mapping documents in assembly: " + fileName ); ! try ! { AddInputStream( assembly.GetManifestResourceStream(fileName) ); } ! catch (MappingException me) ! { throw me; } ! catch (Exception e) ! { log.Error("Could not configure datastore from assembly", e); throw new MappingException(e); *************** *** 326,332 **** ArrayList script = new ArrayList(50); ! if ( dialect.DropConstraints ) { ! foreach(Table table in TableMappings) { ! foreach(ForeignKey fk in table.ForeignKeyCollection) { script.Add(fk.SqlDropString(dialect)); } --- 353,362 ---- ArrayList script = new ArrayList(50); ! if ( dialect.DropConstraints ) ! { ! foreach(Table table in TableMappings) ! { ! foreach(ForeignKey fk in table.ForeignKeyCollection) ! { script.Add(fk.SqlDropString(dialect)); } *************** *** 334,342 **** } ! foreach(Table table in TableMappings) { script.Add( table.SqlDropString(dialect) ); } ! foreach(IPersistentIdentifierGenerator idGen in CollectionGenerators(dialect) ) { string dropString = idGen.SqlDropString(dialect); if (dropString!=null) script.Add( dropString ); --- 364,374 ---- } ! foreach(Table table in TableMappings) ! { script.Add( table.SqlDropString(dialect) ); } ! foreach(IPersistentIdentifierGenerator idGen in CollectionGenerators(dialect) ) ! { string dropString = idGen.SqlDropString(dialect); if (dropString!=null) script.Add( dropString ); *************** *** 349,371 **** /// Generate DDL for creating tables /// </summary> ! public string[] GenerateSchemaCreationScript(Dialect.Dialect dialect) { SecondPassCompile(); ArrayList script = new ArrayList(50); ! foreach(Table table in TableMappings) { script.Add( table.SqlCreateString(dialect, this) ); } ! foreach(Table table in TableMappings) { ! foreach(ForeignKey fk in table.ForeignKeyCollection) { ! script.Add( fk.SqlCreateString(dialect, this) ); ! } ! foreach(Index index in table.IndexCollection) { script.Add( index.SqlCreateString(dialect, this) ); } } ! foreach(IPersistentIdentifierGenerator idGen in CollectionGenerators(dialect)) { string[] lines = idGen.SqlCreateStrings(dialect); for (int i=0; i<lines.Length; i++ ) script.Add( lines[i] ); --- 381,410 ---- /// Generate DDL for creating tables /// </summary> ! public string[] GenerateSchemaCreationScript(Dialect.Dialect dialect) ! { SecondPassCompile(); ArrayList script = new ArrayList(50); ! foreach(Table table in TableMappings) ! { script.Add( table.SqlCreateString(dialect, this) ); } ! foreach(Table table in TableMappings) ! { ! if (dialect.HasAlterTable) ! foreach(ForeignKey fk in table.ForeignKeyCollection) ! { ! script.Add( fk.SqlCreateString(dialect, this) ); ! } ! foreach(Index index in table.IndexCollection) ! { script.Add( index.SqlCreateString(dialect, this) ); } } ! foreach(IPersistentIdentifierGenerator idGen in CollectionGenerators(dialect)) ! { string[] lines = idGen.SqlCreateStrings(dialect); for (int i=0; i<lines.Length; i++ ) script.Add( lines[i] ); *************** *** 375,384 **** } ! ! ! private void SecondPassCompile() { ! foreach(Binder.SecondPass sp in secondPasses) { sp.DoSecondPass(classes); } --- 414,485 ---- } ! // ///<summary> ! // /// Generate DDL for altering tables ! // ///</summary> ! // public string[] GenerateSchemaUpdateScript(Dialect.Dialect dialect, DatabaseMetadata databaseMetadata) ! // { ! // secondPassCompile(); ! // ! // ArrayList script = new ArrayList(50); ! // ! // foreach(Table table in TableMappings) ! // { ! // TableMetadata tableInfo = databaseMetadata.getTableMetadata( table.Name ); ! // if (tableInfo==null) ! // { ! // script.Add( table.SqlCreateString(dialect, this) ); ! // } ! // else ! // { ! // foreach(string alterString in table.SqlAlterStrings(dialect, this, tableInfo)) ! // script.Add(alterString); ! // } ! // } ! // ! // foreach(Table table in TableMappings) ! // { ! // TableMetadata tableInfo = databaseMetadata.getTableMetadata( table.Name ); ! // ! // if ( dialect.HasAlterTable) ! // { ! // foreach(ForeignKey fk in table.ForeignKeyCollection) ! // if ( tableInfo==null || tableInfo.getForeignKeyMetadata( fk.Name ) == null ) ! // { ! // script.Add( fk.SqlCreateString(dialect, mapping) ); ! // } ! // } ! // foreach(Index index in table.IndexCollection) ! // { ! // if ( tableInfo==null || tableInfo.getIndexMetadata( index.Name ) == null ) ! // { ! // script.Add( index.SqlCreateString(dialect, mapping) ); ! // } ! // } ! // } ! // ! // foreach(IPersistentIdentifierGenerator generator in CollectionGenerators(dialect)) ! // { ! // object key = generator.GeneratorKey(); ! // if ( !databaseMetadata.IsSequence(key) && !databaseMetadata.IsTable(key) ) ! // { ! // string[] lines = generator.SqlCreateStrings(dialect); ! // for (int i = 0; i < lines.Length; i++) script.Add( lines[i] ); ! // } ! // } ! // ! // return ArrayHelper.ToStringArray(script); ! // } ! //TODO: H2.0.3 After DatabaseMetadata is completed ! /// <remarks> ! /// This method may be called many times!! ! /// </remarks> ! private void SecondPassCompile() ! { ! log.Info("processing one-to-many association mappings"); ! ! foreach(Binder.SecondPass sp in secondPasses) ! { sp.DoSecondPass(classes); } *************** *** 386,395 **** secondPasses.Clear(); ! foreach(Table table in TableMappings) { ! foreach(ForeignKey fk in table.ForeignKeyCollection) { ! if ( fk.ReferencedTable == null ) { PersistentClass referencedClass = (PersistentClass) classes[ fk.ReferencedClass ]; if ( referencedClass==null ) throw new MappingException( ! "An association refers to an unmapped class: " + fk.ReferencedClass.Name ); --- 487,506 ---- secondPasses.Clear(); ! //TODO: Somehow add the newly created foreign keys to the internal collection ! ! log.Info("processing foreign key constraints"); ! ! foreach(Table table in TableMappings) ! { ! foreach(ForeignKey fk in table.ForeignKeyCollection) ! { ! if ( fk.ReferencedTable == null ) ! { ! if ( log.IsDebugEnabled ) log.Debug("resolving reference to class: " + fk.ReferencedClass.Name); PersistentClass referencedClass = (PersistentClass) classes[ fk.ReferencedClass ]; if ( referencedClass==null ) throw new MappingException( ! "An association from the table " + ! fk.Table.Name + ! " refers to an unmapped class: " + fk.ReferencedClass.Name ); *************** *** 403,407 **** /// The named queries /// </summary> ! public IDictionary NamedQueries { get { return namedQueries; } } --- 514,519 ---- /// The named queries /// </summary> ! public IDictionary NamedQueries ! { get { return namedQueries; } } *************** *** 410,448 **** [Serializable] ! private class EmptyInterceptorClass : IInterceptor { ! public void OnDelete(object entity, object id, object[] state, string[] propertyNames, IType[] types) { } ! public bool OnFlushDirty(object entity, object id, object[] currentState, object[] previousState, string[] propertyNames, IType[] types) { return false; } ! public bool OnLoad(object entity, object id, object[] state, string[] propertyNames, IType[] types) { return false; } ! public bool OnSave(object entity, object id, object[] state, string[] propertyNames, IType[] types) { return false; } ! public void OnPostFlush(object entity, object id, object[] currentState, string[] propertyNames, IType[] types) { } ! public void PostFlush(ICollection entities) { } ! public void PreFlush(ICollection entitites) { } ! public object IsUnsaved(object entity) { return null; } ! public object Instantiate(System.Type clazz, object id) { return null; } ! public int[] FindDirty(object entity, object id, object[] currentState, object[] previousState, string[] propertyNames, IType[] types) { return null; } --- 522,571 ---- [Serializable] ! private class EmptyInterceptorClass : IInterceptor ! { ! public void OnDelete(object entity, object id, object[] state, string[] propertyNames, IType[] types) ! { } ! public bool OnFlushDirty(object entity, object id, object[] currentState, object[] previousState, string[] propertyNames, IType[] types) ! { return false; } ! public bool OnLoad(object entity, object id, object[] state, string[] propertyNames, IType[] types) ! { return false; } ! public bool OnSave(object entity, object id, object[] state, string[] propertyNames, IType[] types) ! { return false; } ! public void OnPostFlush(object entity, object id, object[] currentState, string[] propertyNames, IType[] types) ! { } ! public void PostFlush(ICollection entities) ! { } ! public void PreFlush(ICollection entitites) ! { } ! public object IsUnsaved(object entity) ! { return null; } ! public object Instantiate(System.Type clazz, object id) ! { return null; } ! public int[] FindDirty(object entity, object id, object[] currentState, object[] previousState, string[] propertyNames, IType[] types) ! { return null; } *************** *** 455,462 **** /// </summary> /// <returns></returns> ! public ISessionFactory BuildSessionFactory() { SecondPassCompile(); Hashtable copy = new Hashtable(); ! foreach(DictionaryEntry de in properties) { copy.Add(de.Key, de.Value); } --- 578,587 ---- /// </summary> /// <returns></returns> ! public ISessionFactory BuildSessionFactory() ! { SecondPassCompile(); Hashtable copy = new Hashtable(); ! foreach(DictionaryEntry de in properties) ! { copy.Add(de.Key, de.Value); } *************** *** 464,479 **** } ! public IInterceptor Interceptor { ! get { return interceptor; } ! set { this.interceptor = value; } } ! public IDictionary Properties { ! get { return properties; } ! set { this.properties = value; } } ! public Configuration AddProperties(IDictionary properties) { ! foreach(DictionaryEntry de in properties) { this.properties.Add(de.Key, de.Value); } --- 589,620 ---- } ! public IInterceptor Interceptor ! { ! get ! { ! return interceptor; ! } ! set ! { ! this.interceptor = value; ! } } ! public IDictionary Properties ! { ! get ! { ! return properties; ! } ! set ! { ! this.properties = value; ! } } ! public Configuration AddProperties(IDictionary properties) ! { ! foreach(DictionaryEntry de in properties) ! { this.properties.Add(de.Key, de.Value); } *************** *** 481,494 **** } ! public void SetProperty(string name, string value) { properties[name] = value; } ! public string GetProperty(string name) { return properties[name] as string; } ! private void AddProperties(XmlNode parent) { ! foreach(XmlNode node in parent.SelectNodes("property")) { string name = node.Attributes["name"].Value; string value = node.FirstChild.Value; --- 622,640 ---- } ! public Configuration SetProperty(string name, string value) ! { properties[name] = value; + return this; } ! public string GetProperty(string name) ! { return properties[name] as string; } ! private void AddProperties(XmlNode parent) ! { ! foreach(XmlNode node in parent.SelectNodes("property")) ! { string name = node.Attributes["name"].Value; string value = node.FirstChild.Value; *************** *** 499,514 **** } ! ! public Configuration Configure() { Configure("hibernate.cfg.xml"); return this; } ! public Configuration Configure(string resource) { XmlDocument doc = new XmlDocument(); ! try { doc.Load(resource); ! } catch (Exception e) { log.Error("Problem parsing configuraiton " + resource, e); throw new HibernateException("problem parsing configuration " + resource + ": " + e); --- 645,664 ---- } ! public Configuration Configure() ! { Configure("hibernate.cfg.xml"); return this; } ! public Configuration Configure(string resource) ! { XmlDocument doc = new XmlDocument(); ! try ! { doc.Load(resource); ! } ! catch (Exception e) ! { log.Error("Problem parsing configuraiton " + resource, e); throw new HibernateException("problem parsing configuration " + resource + ": " + e); *************** *** 520,536 **** AddProperties(sfNode); ! foreach(XmlNode mapElement in sfNode.ChildNodes) { string elemname = mapElement.Name; ! if ( "mapping".Equals(elemname) ) { XmlAttribute rsrc = mapElement.Attributes["resource"]; XmlAttribute file = mapElement.Attributes["file"]; XmlAttribute assembly = mapElement.Attributes["assembly"]; ! if (rsrc!=null) { log.Debug(name + "<-" + rsrc); AddResource( rsrc.Value, Assembly.GetExecutingAssembly() ); ! } else if ( assembly!=null) { log.Debug(name + "<-" + assembly); AddAssembly(assembly.Value); ! } else { if (file==null) throw new MappingException("<mapping> element in configuration specifies no attributes"); log.Debug(name + "<-" + file); --- 670,693 ---- AddProperties(sfNode); ! foreach(XmlNode mapElement in sfNode.ChildNodes) ! { string elemname = mapElement.Name; ! if ( "mapping".Equals(elemname) ) ! { XmlAttribute rsrc = mapElement.Attributes["resource"]; XmlAttribute file = mapElement.Attributes["file"]; XmlAttribute assembly = mapElement.Attributes["assembly"]; ! if (rsrc!=null) ! { log.Debug(name + "<-" + rsrc); AddResource( rsrc.Value, Assembly.GetExecutingAssembly() ); ! } ! else if ( assembly!=null) ! { log.Debug(name + "<-" + assembly); AddAssembly(assembly.Value); ! } ! else ! { if (file==null) throw new MappingException("<mapping> element in configuration specifies no attributes"); log.Debug(name + "<-" + file); *************** *** 550,555 **** /// </summary> /// <returns></returns> ! public IDictionary Imports { ! get { return imports; } } } --- 707,716 ---- /// </summary> /// <returns></returns> ! public IDictionary Imports ! { ! get ! { ! return imports; ! } } } |
From: Peter S. <sz...@us...> - 2004-04-29 16:37:04
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30516/NHibernate/Mapping Modified Files: RootClass.cs Log Message: Fixed polymorphic thing. Index: RootClass.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Mapping/RootClass.cs,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** RootClass.cs 29 Apr 2004 14:43:21 -0000 1.8 --- RootClass.cs 29 Apr 2004 16:36:55 -0000 1.9 *************** *** 25,29 **** private string where; ! public bool Polymorphic; public override Property IdentifierProperty --- 25,35 ---- private string where; ! public bool Polymorphic ! { ! set ! { ! polymorphic = value; ! } ! } public override Property IdentifierProperty |
From: Peter S. <sz...@us...> - 2004-04-29 16:05:06
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24767/NHibernate/Cfg Modified Files: Binder.cs Log Message: Binder.cs is ok, some minor todo left after finishing IDBAG Index: Binder.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/Cfg/Binder.cs,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Binder.cs 29 Apr 2004 14:43:14 -0000 1.18 --- Binder.cs 29 Apr 2004 16:04:56 -0000 1.19 *************** *** 8,11 **** --- 8,12 ---- using NHibernate.Type; using NHibernate.Util; + using System.Text; namespace NHibernate.Cfg { *************** *** 349,353 **** } [...1409 lines suppressed...] private static Hashtable Instances = new Hashtable(); ! static CollectionType() ! { Instances.Add(MAP.ToString(), MAP); Instances.Add(BAG.ToString(), BAG); *************** *** 1095,1099 **** } ! public static CollectionType CollectionTypeFromString(string xmlTagName) { return (CollectionType) Instances[xmlTagName]; } --- 1338,1343 ---- } ! public static CollectionType CollectionTypeFromString(string xmlTagName) ! { return (CollectionType) Instances[xmlTagName]; } |
From: Peter S. <sz...@us...> - 2004-04-29 16:05:06
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24767/NHibernate.DomainModel Modified Files: FooBar.hbm.xml Log Message: Binder.cs is ok, some minor todo left after finishing IDBAG Index: FooBar.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/FooBar.hbm.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** FooBar.hbm.xml 8 Apr 2004 16:37:39 -0000 1.4 --- FooBar.hbm.xml 29 Apr 2004 16:04:57 -0000 1.5 *************** *** 131,135 **** </array> </component> ! <any name="object" id-type="long" cascade="all"> <column name="clazz" length="100"/> <column name="gen_id"/> --- 131,135 ---- </array> </component> ! <any name="object" id-type="Int64" cascade="all"> <column name="clazz" length="100"/> <column name="gen_id"/> |
From: Michael D. <mik...@us...> - 2004-04-29 15:22:49
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.Test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16595/NHibernate.Test Modified Files: FooBarTest.cs Log Message: Added a TearDown attribute so it gets rid of the tables after a test is run. Index: FooBarTest.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.Test/FooBarTest.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** FooBarTest.cs 29 Apr 2004 14:00:55 -0000 1.16 --- FooBarTest.cs 29 Apr 2004 15:22:28 -0000 1.17 *************** *** 34,37 **** --- 34,43 ---- } + [TearDown] + public void TearDown() + { + DropSchema(); + } + [Test] [Ignore("don't know how to get aliased name for baz")] |
From: Michael D. <mik...@us...> - 2004-04-29 15:16:09
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15158/NHibernate.DomainModel Modified Files: Fum.cs Fumm.hbm.xml NHibernate.DomainModel-1.1.csproj Added Files: Fumm.cs Log Message: Added test FumTest to NHibernate.Test and required classes to NHibernate.DomainModel --- NEW FILE: Fumm.cs --- using System; using System.Globalization; namespace NHibernate.DomainModel { /// <summary> /// Summary description for Fumm. /// </summary> public class Fumm { private CultureInfo locale; private Fum fum; public Fumm() { } public FumCompositeID Id { get { return fum.id; } set { } } public Fum Fum { get { return fum;} set { fum = value; } } public CultureInfo Locale { get { return locale; } set { locale = value; } } } } Index: NHibernate.DomainModel-1.1.csproj =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/NHibernate.DomainModel-1.1.csproj,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NHibernate.DomainModel-1.1.csproj 9 Apr 2004 13:14:53 -0000 1.9 --- NHibernate.DomainModel-1.1.csproj 29 Apr 2004 15:16:00 -0000 1.10 *************** *** 264,267 **** --- 264,272 ---- /> <File + RelPath = "Fumm.cs" + SubType = "Code" + BuildAction = "Compile" + /> + <File RelPath = "Fumm.hbm.xml" BuildAction = "EmbeddedResource" Index: Fumm.hbm.xml =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/Fumm.hbm.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Fumm.hbm.xml 9 Apr 2004 13:14:53 -0000 1.3 --- Fumm.hbm.xml 29 Apr 2004 15:16:00 -0000 1.4 *************** *** 1,6 **** <?xml version="1.0" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> ! <class name="net.sf.hibernate.test.Fumm"> ! <composite-id name="id"> <key-property name="string"> <column name="string_" length="10" /> --- 1,6 ---- <?xml version="1.0" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.0"> ! <class name="NHibernate.DomainModel.Fumm, NHibernate.DomainModel"> ! <composite-id name="Id"> <key-property name="string"> <column name="string_" length="10" /> *************** *** 9,14 **** <key-property name="date" column="date_" type="DateTime" /> </composite-id> ! <property name="locale" /> ! <one-to-one name="fum" cascade="all" constrained="true" /> </class> </hibernate-mapping> \ No newline at end of file --- 9,15 ---- <key-property name="date" column="date_" type="DateTime" /> </composite-id> ! ! <property name="Locale" /> ! <one-to-one name="Fum" cascade="all" constrained="true" /> </class> </hibernate-mapping> \ No newline at end of file Index: Fum.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate.DomainModel/Fum.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Fum.cs 9 Apr 2004 13:14:53 -0000 1.1 --- Fum.cs 29 Apr 2004 15:15:59 -0000 1.2 *************** *** 10,14 **** private Fum _fo; private Qux[] _quxArray; ! private IList _friends; private DateTime _lastUpdated; --- 10,14 ---- private Fum _fo; private Qux[] _quxArray; ! private IDictionary _friends; private DateTime _lastUpdated; *************** *** 17,29 **** { this.id = id; ! friends = new ArrayList(); FumCompositeID fid = new FumCompositeID(); ! fid.date= new DateTime(); fid.@short= (short) ( id.@short + 33 ); fid.@string= id.@string + "dd"; Fum f = new Fum(); f.id = fid; f.fum="FRIEND"; ! friends.Add(f); } public string fum --- 17,40 ---- { this.id = id; ! friends = new Hashtable(); ! //TODO: H2.0.3 - this is diff from H2.0.3 because I am getting a null exception ! // when executing the Sql. H203 uses the CalendarType which we don't have so ! // I am using DateTime instead... ! _lastUpdated = DateTime.Now; ! FumCompositeID fid = new FumCompositeID(); ! fid.date= new DateTime(2004, 4, 29, 9, 50, 0, 0); fid.@short= (short) ( id.@short + 33 ); fid.@string= id.@string + "dd"; + Fum f = new Fum(); f.id = fid; f.fum="FRIEND"; ! //TODO: H2.0.3 - this is diff from H2.0.3 because I am getting a null exception ! // when executing the Sql. H203 uses the CalendarType which we don't have so ! // I am using DateTime instead... ! f.lastUpdated = DateTime.Now; ! ! friends.Add(f, new object()); } public string fum *************** *** 74,78 **** } ! public IList friends { get --- 85,89 ---- } ! public IDictionary friends { get *************** *** 92,100 **** try { ! IEnumerator iter = friends.GetEnumerator(); ! while ( iter.MoveNext() ) { ! s.Delete( iter.Current ); } } catch (Exception e) --- 103,116 ---- try { ! foreach(DictionaryEntry de in friends) { ! s.Delete(de.Key); } + + // IEnumerator iter = friends.GetEnumerator(); + // while ( iter.MoveNext() ) + // { + // s.Delete( iter.Current ); + // } } catch (Exception e) *************** *** 116,124 **** try { ! IEnumerator iter = friends.GetEnumerator(); ! while ( iter.MoveNext() ) { ! s.Save( iter.Current ); } } catch (Exception e) --- 132,145 ---- try { ! foreach(DictionaryEntry de in friends) { ! s.Save(de.Key); } + + // IEnumerator iter = friends.GetEnumerator(); + // while ( iter.MoveNext() ) + // { + // s.Save( iter.Current ); + // } } catch (Exception e) |