@ -12,13 +12,16 @@ namespace MySQLConnector {
internal readonly IDBTraits traits ;
internal readonly IDBTraits traits ;
internal readonly ILogger logger ;
// private DbConnection connection;
// private DbConnection connection;
private string connectionString ;
private string connectionString ;
private HashSet < Transaction > transactions ;
private HashSet < Transaction > transactions ;
public Connection ( string connectionString , IDBTraits traits ) {
public Connection ( string connectionString , IDBTraits traits , ILogger logger ) {
this . traits = traits ;
this . traits = traits ;
this . logger = logger ;
this . connectionString = connectionString ;
this . connectionString = connectionString ;
using ( DbConnection connection = this . createConnection ( ) ) {
using ( DbConnection connection = this . createConnection ( ) ) {
//just testing we can open a connection
//just testing we can open a connection
@ -26,6 +29,10 @@ namespace MySQLConnector {
this . transactions = new HashSet < Transaction > ( ) ;
this . transactions = new HashSet < Transaction > ( ) ;
}
}
private CommandExecutionLogger CreateCommandExecutionLogger ( ) {
return new CommandExecutionLogger ( this . logger ) ;
}
internal DbConnection createConnection ( ) {
internal DbConnection createConnection ( ) {
DbConnection connection = this . traits . createConnection ( this . connectionString ) ;
DbConnection connection = this . traits . createConnection ( this . connectionString ) ;
connection . Open ( ) ;
connection . Open ( ) ;
@ -33,48 +40,51 @@ namespace MySQLConnector {
}
}
private List < Dictionary < string , string > > _L oadByIds ( DbCommand command , ITableSpec table , List < string > ids , bool forUpdate ) {
private List < Dictionary < string , string > > _L oadByIds ( DbCommand command , ITableSpec table , List < string > ids , bool forUpdate ) {
command . CommandType = System . Data . CommandType . Text ;
using ( var logger = this . CreateCommandExecutionLogger ( ) ) {
ParamsHolder paramsHolder = new ParamsHolder ( ) ;
command . CommandType = System . Data . CommandType . Text ;
List < string > placeholder = new List < string > ( ) ;
foreach ( string id in ids ) {
placeholder . Add ( this . traits . markParam ( paramsHolder . Add ( id ) ) ) ;
}
command . CommandText = "SELECT * FROM " + table . compile ( this . traits ) + " WHERE " + table . getIdSpec ( ) . compile ( this . traits ) + " IN (" + string . Join ( ", " , placeholder . ToArray ( ) ) + ")" + ( forUpdate ? " FOR UPDATE" : "" ) ;
ParamsHolder paramsHolder = new ParamsHolder ( ) ;
//command.Prepare() ;
List < string > placeholder = new List < string > ( ) ;
foreach ( KeyValuePair < string , string > kvp in paramsHolder . data ) {
foreach ( string id in ids ) {
command . AddParameter ( kvp . Key , kvp . Value ) ;
placeholder . Add ( this . traits . markParam ( paramsHolder . Add ( id ) ) ) ;
}
}
Dictionary < string , Dictionary < string , string > > rawResult = new Dictionary < string , Dictionary < string , string > > ( ) ;
command . CommandText = logger . commandText = "SELECT * FROM " + table . compile ( this . traits ) + " WHERE " + table . getIdSpec ( ) . compile ( this . traits ) + " IN (" + string . Join ( ", " , placeholder . ToArray ( ) ) + ")" + ( forUpdate ? " FOR UPDATE" : "" ) ;
using ( DbDataReader reader = command . ExecuteReader ( ) ) {
//command.Prepare();
while ( reader . Read ( ) ) {
foreach ( KeyValuePair < string , string > kvp in paramsHolder . data ) {
Dictionary < string , string > row = new Dictionary < string , string > ( ) ;
command . AddParameter ( kvp . Key , kvp . Value ) ;
for ( int i = 0 ; i < reader . FieldCount ; i + + ) {
}
// throw new CriticalException("Name: " + reader.GetName(i));
object value = reader . GetValue ( i ) ;
Dictionary < string , Dictionary < string , string > > rawResult = new Dictionary < string , Dictionary < string , string > > ( ) ;
string sValue ;
using ( DbDataReader reader = command . ExecuteReader ( ) ) {
if ( value is DateTime ) {
while ( reader . Read ( ) ) {
sValue = ( ( DateTime ) value ) . Ticks . ToString ( ) ;
Dictionary < string , string > row = new Dictionary < string , string > ( ) ;
} else if ( value is TimeSpan ) {
for ( int i = 0 ; i < reader . FieldCount ; i + + ) {
sValue = ( ( TimeSpan ) value ) . Ticks . ToString ( ) ;
//throw new CriticalException("Name: " + reader.GetName(i));
} else {
object value = reader . GetValue ( i ) ;
sValue = value . ToString ( ) ;
string sValue ;
if ( value is DateTime ) {
sValue = ( ( DateTime ) value ) . Ticks . ToString ( ) ;
} else if ( value is TimeSpan ) {
sValue = ( ( TimeSpan ) value ) . Ticks . ToString ( ) ;
} else {
sValue = value . ToString ( ) ;
}
row . Add ( reader . GetName ( i ) , sValue ) ;
}
}
row . Add ( reader . GetName ( i ) , sValue ) ;
rawResult . Add ( row [ table . idName ] , row ) ;
}
}
rawResult . Add ( row [ table . idName ] , row ) ;
}
}
}
List < Dictionary < string , string > > result = new List < Dictionary < string , string > > ( ) ;
List < Dictionary < string , string > > result = new List < Dictionary < string , string > > ( ) ;
foreach ( string id in ids ) {
foreach ( string id in ids ) {
if ( rawResult . ContainsKey ( id ) ) {
if ( rawResult . ContainsKey ( id ) ) {
result . Add ( rawResult [ id ] ) ;
result . Add ( rawResult [ id ] ) ;
}
}
}
return result ;
}
}
return result ;
}
}
public List < Dictionary < string , string > > LoadByIds ( ITableSpec table , List < string > ids ) {
public List < Dictionary < string , string > > LoadByIds ( ITableSpec table , List < string > ids ) {
@ -86,75 +96,78 @@ namespace MySQLConnector {
}
}
private List < string > _L oadIdsByConditions ( DbCommand command , ITableSpec table , Web . Core . DB . conditions . AbstractCondition conditions , Diapasone diapasone , JoinSpec [ ] joins , SortSpec [ ] sorts , bool allowHugeLists ) {
private List < string > _L oadIdsByConditions ( DbCommand command , ITableSpec table , Web . Core . DB . conditions . AbstractCondition conditions , Diapasone diapasone , JoinSpec [ ] joins , SortSpec [ ] sorts , bool allowHugeLists ) {
command . CommandType = System . Data . CommandType . Text ;
using ( var logger = this . CreateCommandExecutionLogger ( ) ) {
var conditionsCompiled = ConditionCompiler . Compile ( conditions , this . traits ) ;
command . CommandType = System . Data . CommandType . Text ;
string queryConditions = "" ;
if ( conditionsCompiled . Key ! = "" ) queryConditions = "WHERE " + conditionsCompiled . Key ;
var conditionsCompiled = ConditionCompiler . Compile ( conditions , this . traits ) ;
ParamsHolder paramsHolder = conditionsCompiled . Value ;
string queryConditions = "" ;
if ( conditionsCompiled . Key ! = "" ) queryConditions = "WHERE " + conditionsCompiled . Key ;
StringBuilder queryJoins = new StringBuilder ( ) ;
ParamsHolder paramsHolder = conditionsCompiled . Value ;
{
foreach ( var join in joins ) {
StringBuilder queryJoins = new StringBuilder ( ) ;
queryJoins . Append ( " JOIN " ) ;
{
queryJoins . Append ( join . additionalTableRaw . compile ( this . traits ) ) ;
foreach ( var join in joins ) {
queryJoins . Append ( " " ) ;
queryJoins . Append ( " JOIN " ) ;
queryJoins . Append ( join . additionalTable . compile ( this . traits ) ) ;
queryJoins . Append ( join . additionalTableRaw . compile ( this . traits ) ) ;
queryJoins . Append ( " ON " ) ;
queryJoins . Append ( " " ) ;
queryJoins . Append ( join . mainColumn . compile ( this . traits ) ) ;
queryJoins . Append ( join . additionalTable . compile ( this . traits ) ) ;
queryJoins . Append ( " = " ) ;
queryJoins . Append ( " ON " ) ;
queryJoins . Append ( join . additionalTable . getIdSpec ( ) . compile ( this . traits ) ) ;
queryJoins . Append ( join . mainColumn . compile ( this . traits ) ) ;
queryJoins . Append ( " = " ) ;
queryJoins . Append ( join . additionalTable . getIdSpec ( ) . compile ( this . traits ) ) ;
}
}
}
}
string querySorts = "" ;
string querySorts = "" ;
if ( sorts . Length > 0 ) {
if ( sorts . Length > 0 ) {
List < string > sortParts = new List < string > ( ) ;
List < string > sortParts = new List < string > ( ) ;
foreach ( SortSpec sortSpec in sorts ) {
foreach ( SortSpec sortSpec in sorts ) {
if ( sortSpec . ascending ) {
if ( sortSpec . ascending ) {
sortParts . Add ( sortSpec . column . compile ( this . traits ) + " ASC" ) ;
sortParts . Add ( sortSpec . column . compile ( this . traits ) + " ASC" ) ;
} else {
} else {
sortParts . Add ( sortSpec . column . compile ( this . traits ) + " DESC" ) ;
sortParts . Add ( sortSpec . column . compile ( this . traits ) + " DESC" ) ;
}
}
}
querySorts = "ORDER BY " + string . Join ( ", " , sortParts . ToArray ( ) ) ;
}
}
querySorts = "ORDER BY " + string . Join ( ", " , sortParts . ToArray ( ) ) ;
}
string queryMain = "FROM " + table . compile ( this . traits ) + " " + queryJoins + " " + queryConditions ;
string queryMain = "FROM " + table . compile ( this . traits ) + " " + queryJoins + " " + queryConditions ;
foreach ( KeyValuePair < string , string > kvp in paramsHolder . data ) {
foreach ( KeyValuePair < string , string > kvp in paramsHolder . data ) {
command . AddParameter ( kvp . Key , kvp . Value ) ;
command . AddParameter ( kvp . Key , kvp . Value ) ;
}
}
command . CommandText = "SELECT COUNT(*) " + queryMain ;
command . CommandText = logger . c ommandText = "SELECT COUNT(*) " + queryMain ;
object rawCount ;
object rawCount ;
//try {
//try {
rawCount = command . ExecuteScalar ( ) ;
rawCount = command . ExecuteScalar ( ) ;
//} catch(Npgsql.NpgsqlException e) {
//} catch(Npgsql.NpgsqlException e) {
//throw new FLocalException("Error while trying to execute " + command.CommandText + ": " + e.Message);
//throw new FLocalException("Error while trying to execute " + command.CommandText + ": " + e.Message);
//}
//}
long count = ( long ) rawCount ;
long count = ( long ) rawCount ;
if ( count < 1 ) {
if ( count < 1 ) {
diapasone . total = 0 ;
diapasone . total = 0 ;
return new List < string > ( ) ;
return new List < string > ( ) ;
} else {
} else {
diapasone . total = count ;
diapasone . total = count ;
if ( diapasone . total > 1 0 0 0 & & diapasone . count < 0 & & ! allowHugeLists ) {
if ( diapasone . total > 1 0 0 0 & & diapasone . count < 0 & & ! allowHugeLists ) {
throw new CriticalException ( "huge list" ) ;
throw new CriticalException ( "huge list" ) ;
}
}
string queryLimits = "" ;
string queryLimits = "" ;
if ( diapasone . count > = 0 ) {
if ( diapasone . count > = 0 ) {
queryLimits = "LIMIT " + diapasone . count + " OFFSET " + diapasone . start ;
queryLimits = "LIMIT " + diapasone . count + " OFFSET " + diapasone . start ;
}
}
command . CommandText = "SELECT " + table . getIdSpec ( ) . compile ( this . traits ) + " " + queryMain + " " + querySorts + " " + queryLimits ;
command . CommandText = "SELECT " + table . getIdSpec ( ) . compile ( this . traits ) + " " + queryMain + " " + querySorts + " " + queryLimits ;
List < string > result = new List < string > ( ) ;
List < string > result = new List < string > ( ) ;
using ( DbDataReader reader = command . ExecuteReader ( ) ) {
using ( DbDataReader reader = command . ExecuteReader ( ) ) {
while ( reader . Read ( ) ) {
while ( reader . Read ( ) ) {
result . Add ( reader . GetValue ( 0 ) . ToString ( ) ) ;
result . Add ( reader . GetValue ( 0 ) . ToString ( ) ) ;
}
}
}
return result ;
}
}
return result ;
}
}
}
}
@ -167,31 +180,33 @@ namespace MySQLConnector {
}
}
public long GetCountByConditions ( ITableSpec table , Web . Core . DB . conditions . AbstractCondition conditions , params JoinSpec [ ] joins ) {
public long GetCountByConditions ( ITableSpec table , Web . Core . DB . conditions . AbstractCondition conditions , params JoinSpec [ ] joins ) {
using ( DbConnection connection = this . createConnection ( ) ) {
using ( var logger = this . CreateCommandExecutionLogger ( ) ) {
using ( DbCommand command = connection . CreateCommand ( ) ) {
using ( DbConnection connection = this . createConnection ( ) ) {
using ( DbCommand command = connection . CreateCommand ( ) ) {
command . CommandType = System . Data . CommandType . Text ;
command . CommandType = System . Data . CommandType . Text ;
var conditionsCompiled = ConditionCompiler . Compile ( conditions , this . traits ) ;
string queryConditions = "" ;
var conditionsCompiled = ConditionCompiler . Compile ( conditions , this . traits ) ;
if ( conditionsCompiled . Key ! = "" ) queryConditions = "WHERE " + conditionsCompiled . Key ;
string queryConditions = "" ;
ParamsHolder paramsHolder = conditionsCompiled . Value ;
if ( conditionsCompiled . Key ! = "" ) queryConditions = "WHERE " + conditionsCompiled . Key ;
ParamsHolder paramsHolder = conditionsCompiled . Value ;
string queryJoins = "" ;
{
string queryJoins = "" ;
if ( joins . Length > 0 ) {
{
throw new NotImplementedException ( ) ;
if ( joins . Length > 0 ) {
throw new NotImplementedException ( ) ;
}
}
}
}
command . CommandText = "SELECT COUNT(*) " + "FROM " + table . compile ( this . traits ) + " " + queryJoins + " " + queryConditions ;
command . CommandText = logger . commandText = "SELECT COUNT(*) " + "FROM " + table . compile ( this . traits ) + " " + queryJoins + " " + queryConditions ;
foreach ( KeyValuePair < string , string > kvp in paramsHolder . data ) {
foreach ( KeyValuePair < string , string > kvp in paramsHolder . data ) {
command . AddParameter ( kvp . Key , kvp . Value ) ;
command . AddParameter ( kvp . Key , kvp . Value ) ;
}
object rawCount = command . ExecuteScalar ( ) ;
long count = ( long ) rawCount ;
return count ;
}
}
object rawCount = command . ExecuteScalar ( ) ;
long count = ( long ) rawCount ;
return count ;
}
}
}
}
}
}
@ -210,26 +225,30 @@ namespace MySQLConnector {
}
}
public void lockTable ( Web . Core . DB . Transaction _ transaction , ITableSpec table ) {
public void lockTable ( Web . Core . DB . Transaction _ transaction , ITableSpec table ) {
Transaction transaction = ( Transaction ) _ transaction ;
using ( var logger = this . CreateCommandExecutionLogger ( ) ) {
lock ( transaction ) {
Transaction transaction = ( Transaction ) _ transaction ;
using ( DbCommand command = transaction . sqlconnection . CreateCommand ( ) ) {
lock ( transaction ) {
command . Transaction = transaction . sqltransaction ;
using ( DbCommand command = transaction . sqlconnection . CreateCommand ( ) ) {
command . CommandType = System . Data . CommandType . Text ;
command . Transaction = transaction . sqltransaction ;
command . CommandText = "LOCK TABLE " + table . compile ( this . traits ) ;
command . CommandType = System . Data . CommandType . Text ;
command . ExecuteNonQuery ( ) ;
command . CommandText = logger . commandText = "LOCK TABLE " + table . compile ( this . traits ) ;
command . ExecuteNonQuery ( ) ;
}
}
}
}
}
}
}
public void lockRow ( Web . Core . DB . Transaction _ transaction , ITableSpec table , string id ) {
public void lockRow ( Web . Core . DB . Transaction _ transaction , ITableSpec table , string id ) {
Transaction transaction = ( Transaction ) _ transaction ;
using ( var logger = this . CreateCommandExecutionLogger ( ) ) {
lock ( transaction ) {
Transaction transaction = ( Transaction ) _ transaction ;
using ( DbCommand command = transaction . sqlconnection . CreateCommand ( ) ) {
lock ( transaction ) {
command . Transaction = transaction . sqltransaction ;
using ( DbCommand command = transaction . sqlconnection . CreateCommand ( ) ) {
command . CommandType = System . Data . CommandType . Text ;
command . Transaction = transaction . sqltransaction ;
command . CommandText = "SELECT * FROM " + table . compile ( this . traits ) + " where " + table . getIdSpec ( ) . compile ( this . traits ) + " = " + this . traits . markParam ( "id" ) + " FOR UPDATE" ;
command . CommandType = System . Data . CommandType . Text ;
command . AddParameter ( "id" , id ) ;
command . CommandText = logger . commandText = "SELECT * FROM " + table . compile ( this . traits ) + " where " + table . getIdSpec ( ) . compile ( this . traits ) + " = " + this . traits . markParam ( "id" ) + " FOR UPDATE" ;
command . ExecuteNonQuery ( ) ;
command . AddParameter ( "id" , id ) ;
command . ExecuteNonQuery ( ) ;
}
}
}
}
}
}
}
@ -255,62 +274,68 @@ namespace MySQLConnector {
}
}
public void update ( Web . Core . DB . Transaction _ transaction , ITableSpec table , string id , Dictionary < string , string > data ) {
public void update ( Web . Core . DB . Transaction _ transaction , ITableSpec table , string id , Dictionary < string , string > data ) {
Transaction transaction = ( Transaction ) _ transaction ;
using ( var logger = this . CreateCommandExecutionLogger ( ) ) {
lock ( transaction ) {
Transaction transaction = ( Transaction ) _ transaction ;
using ( DbCommand command = transaction . sqlconnection . CreateCommand ( ) ) {
lock ( transaction ) {
List < string > updates = new List < string > ( ) ;
using ( DbCommand command = transaction . sqlconnection . CreateCommand ( ) ) {
ParamsHolder paramsholder = new ParamsHolder ( ) ;
List < string > updates = new List < string > ( ) ;
foreach ( KeyValuePair < string , string > kvp in data ) {
ParamsHolder paramsholder = new ParamsHolder ( ) ;
updates . Add ( this . traits . escapeIdentifier ( kvp . Key ) + " = " + this . traits . markParam ( paramsholder . Add ( kvp . Value ) ) ) ;
foreach ( KeyValuePair < string , string > kvp in data ) {
}
updates . Add ( this . traits . escapeIdentifier ( kvp . Key ) + " = " + this . traits . markParam ( paramsholder . Add ( kvp . Value ) ) ) ;
}
command . Transaction = transaction . sqltransaction ;
command . Transaction = transaction . sqltransaction ;
command . CommandType = System . Data . CommandType . Text ;
command . CommandType = System . Data . CommandType . Text ;
command . CommandText = "UPDATE " + table . compile ( traits ) + " set " + String . Join ( ", " , updates . ToArray ( ) ) + " where " + table . getIdSpec ( ) . compile ( this . traits ) + " = " + this . traits . markParam ( "id" ) ;
command . CommandText = logger . commandText = "UPDATE " + table . compile ( traits ) + " set " + String . Join ( ", " , updates . ToArray ( ) ) + " where " + table . getIdSpec ( ) . compile ( this . traits ) + " = " + this . traits . markParam ( "id" ) ;
command . AddParameter ( "id" , id ) ;
command . AddParameter ( "id" , id ) ;
foreach ( KeyValuePair < string , string > kvp in paramsholder . data ) {
foreach ( KeyValuePair < string , string > kvp in paramsholder . data ) {
command . AddParameter ( kvp . Key , kvp . Value ) ;
command . AddParameter ( kvp . Key , kvp . Value ) ;
}
// throw new CriticalException(command.CommandText + "; parameters: " + string.Join(", ", (from DbParameter parameter in command.Parameters select parameter.ParameterName + "='" + parameter.Value.ToString() + "'").ToArray()));
command . ExecuteNonQuery ( ) ;
}
}
// throw new CriticalException(command.CommandText + "; parameters: " + string.Join(", ", (from DbParameter parameter in command.Parameters select parameter.ParameterName + "='" + parameter.Value.ToString() + "'").ToArray()));
command . ExecuteNonQuery ( ) ;
}
}
}
}
}
}
public string insert ( Web . Core . DB . Transaction _ transaction , ITableSpec table , Dictionary < string , string > data ) {
public string insert ( Web . Core . DB . Transaction _ transaction , ITableSpec table , Dictionary < string , string > data ) {
Transaction transaction = ( Transaction ) _ transaction ;
using ( var logger = this . CreateCommandExecutionLogger ( ) ) {
lock ( transaction ) {
Transaction transaction = ( Transaction ) _ transaction ;
using ( DbCommand command = transaction . sqlconnection . CreateCommand ( ) ) {
lock ( transaction ) {
List < string > updates = new List < string > ( ) ;
using ( DbCommand command = transaction . sqlconnection . CreateCommand ( ) ) {
List < string > updatesPlaceholders = new List < string > ( ) ;
List < string > updates = new List < string > ( ) ;
ParamsHolder paramsholder = new ParamsHolder ( ) ;
List < string > updatesPlaceholders = new List < string > ( ) ;
foreach ( KeyValuePair < string , string > kvp in data ) {
ParamsHolder paramsholder = new ParamsHolder ( ) ;
updates . Add ( this . traits . escapeIdentifier ( kvp . Key ) ) ;
foreach ( KeyValuePair < string , string > kvp in data ) {
updatesPlaceholders . Add ( this . traits . markParam ( paramsholder . Add ( kvp . Value ) ) ) ;
updates . Add ( this . traits . escapeIdentifier ( kvp . Key ) ) ;
}
updatesPlaceholders . Add ( this . traits . markParam ( paramsholder . Add ( kvp . Value ) ) ) ;
}
command . Transaction = transaction . sqltransaction ;
command . Transaction = transaction . sqltransaction ;
command . CommandType = System . Data . CommandType . Text ;
command . CommandType = System . Data . CommandType . Text ;
command . CommandText = "INSERT INTO " + table . compile ( this . traits ) + " (" + String . Join ( ", " , updates . ToArray ( ) ) + ") VALUES (" + String . Join ( ", " , updatesPlaceholders . ToArray ( ) ) + ")" ;
command . CommandText = logger . commandText = "INSERT INTO " + table . compile ( this . traits ) + " (" + String . Join ( ", " , updates . ToArray ( ) ) + ") VALUES (" + String . Join ( ", " , updatesPlaceholders . ToArray ( ) ) + ")" ;
foreach ( KeyValuePair < string , string > kvp in paramsholder . data ) {
foreach ( KeyValuePair < string , string > kvp in paramsholder . data ) {
command . AddParameter ( kvp . Key , kvp . Value ) ;
command . AddParameter ( kvp . Key , kvp . Value ) ;
}
command . ExecuteNonQuery ( ) ;
if ( data . ContainsKey ( table . idName ) ) return data [ table . idName ] ;
return this . traits . LastInsertId ( command , table ) . ToString ( ) ;
}
}
command . ExecuteNonQuery ( ) ;
if ( data . ContainsKey ( table . idName ) ) return data [ table . idName ] ;
return this . traits . LastInsertId ( command , table ) . ToString ( ) ;
}
}
}
}
}
}
public void delete ( Web . Core . DB . Transaction _ transaction , ITableSpec table , string id ) {
public void delete ( Web . Core . DB . Transaction _ transaction , ITableSpec table , string id ) {
Transaction transaction = ( Transaction ) _ transaction ;
using ( var logger = this . CreateCommandExecutionLogger ( ) ) {
lock ( transaction ) {
Transaction transaction = ( Transaction ) _ transaction ;
using ( DbCommand command = transaction . sqlconnection . CreateCommand ( ) ) {
lock ( transaction ) {
command . Transaction = transaction . sqltransaction ;
using ( DbCommand command = transaction . sqlconnection . CreateCommand ( ) ) {
command . CommandType = System . Data . CommandType . Text ;
command . Transaction = transaction . sqltransaction ;
command . CommandText = "DELETE FROM " + table . compile ( traits ) + " where " + table . getIdSpec ( ) . compile ( this . traits ) + " = " + this . traits . markParam ( "id" ) ;
command . CommandType = System . Data . CommandType . Text ;
command . AddParameter ( "id" , id ) ;
command . CommandText = logger . commandText = "DELETE FROM " + table . compile ( traits ) + " where " + table . getIdSpec ( ) . compile ( this . traits ) + " = " + this . traits . markParam ( "id" ) ;
command . ExecuteNonQuery ( ) ;
command . AddParameter ( "id" , id ) ;
command . ExecuteNonQuery ( ) ;
}
}
}
}
}
}
}