public static string AddSelectClause <T>(Database database, string sql) { if (sql.StartsWith(";")) { return(sql.Substring(1)); } if (!rxSelect.IsMatch(sql)) { var pd = PocoData.ForType(typeof(T), database.PocoDataFactory); var tableName = database.DatabaseType.EscapeTableName(pd.TableInfo.TableName); string cols = String.Join(", ", (from c in pd.QueryColumns select database.DatabaseType.EscapeSqlIdentifier(c)).ToArray()); if (!rxFrom.IsMatch(sql)) { sql = String.Format("SELECT {0} FROM {1} {2}", cols, tableName, sql); } else { sql = String.Format("SELECT {0} {1}", cols, sql); } } return(sql); }
public Snapshot(IDatabase d, T original) { memberWiseClone = Clone(original); trackedObject = original; pocoData = PocoData.ForType(typeof(T), d.PocoDataFactory); }