using System; using System.Collections.Generic; using System.Text; namespace Zhaizj.Framework.ORM.Utils { internal class SqlUtil { public static List getEntityProperties( String condition ) { List result = new List(); String[] arrItem = condition.Split( ' ' ); foreach (String str in arrItem) { if (str.IndexOf( '.' ) < 0) continue; String[] arr = getPropertyItems( str ); result.Add( arr ); } return result; } public static String[] getPropertyItems( String str ) { String[] arr = new string[2]; String key = ""; String val = ""; Boolean valBegin = false; char[] arrChar = str.ToCharArray(); foreach (char ch in arrChar) { if( ch == ' ' ) continue; if (ch == '.') { valBegin = true; continue; } if (valBegin == false) { if (isAbcAndNumber( ch ) == false) { key = ""; continue; } key += ch; } else { if (isAbcAndNumber( ch ) == false) { break; } val += ch; } } arr[0] = key; arr[1] = val; return arr; } private static Boolean isAbcAndNumber( char ch ) { return "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890".IndexOf( ch ) >= 0; } } }