init lserp cs 5.0
This commit is contained in:
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Zhaizj.Framework.ORM.Utils {
|
||||
|
||||
internal class SqlUtil {
|
||||
|
||||
|
||||
public static List<String[]> getEntityProperties( String condition ) {
|
||||
|
||||
List<String[]> result = new List<String[]>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user