From: Michael D. <mik...@us...> - 2004-09-13 07:11:14
|
Update of /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13720/NHibernate/SqlCommand Modified Files: SqlString.cs Log Message: Added a Count property on SqlString to help with creating SqlStringBuilders with the correct initial capacity Index: SqlString.cs =================================================================== RCS file: /cvsroot/nhibernate/nhibernate/src/NHibernate/SqlCommand/SqlString.cs,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** SqlString.cs 26 Aug 2004 14:27:43 -0000 1.13 --- SqlString.cs 13 Sep 2004 07:11:05 -0000 1.14 *************** *** 147,150 **** --- 147,180 ---- /// <summary> + /// Gets the number of SqlParts contained in this SqlString. + /// </summary> + /// <value>The number of SqlParts contained in this SqlString.</value> + /// <remarks> + /// If a SqlPart contains a SqlString then this recursively looks at each SqlPart + /// for the Count. + /// </remarks> + public int Count + { + get + { + int count = 0; + for( int i=0; i<sqlParts.Length; i++ ) + { + SqlString sqlString = sqlParts[i] as SqlString; + if( sqlString!=null ) + { + count += sqlString.Count; + } + else + { + count++; + } + } + + return count; + } + } + + /// <summary> /// Determines whether the end of this instance matches the specified String. /// </summary> |