Пример #1
0
            public Worker(SqliteObject store, SqliteWordList list)
                : base(store)
            {
                this.list = list;

                existsCommand             = Connection.CreateCommand();
                existsCommand.CommandText = @"SELECT Count(*) FROM Sets WHERE Sets.id = ?";
                existsCommandID           = existsCommand.CreateParameter();
                existsCommand.Parameters.Add(existsCommandID);
                existsCommandID.Value = list.ID;

                insertCommand             = Connection.CreateCommand();
                insertCommand.CommandText = @"
					UPDATE VocabItems 
						SET ListPosition = ListPosition + 1	
						WHERE SetID = $SetID AND ListPosition >= $ListPosition;

					INSERT INTO VocabItems 
						(Phrase, Translation, SetID, ListPosition)
						VALUES ($Phrase, $Translation, $SetID, $ListPosition);"                        ;

                insertCommandSetID = insertCommand.CreateParameter();
                insertCommandSetID.ParameterName = "SetID";
                insertCommandSetID.Value         = list.ID;
                insertCommand.Parameters.Add(insertCommandSetID);

                insertCommandListPosition = insertCommand.CreateParameter();
                insertCommandListPosition.ParameterName = "ListPosition";
                insertCommand.Parameters.Add(insertCommandListPosition);

                insertCommandPhrase = insertCommand.CreateParameter();
                insertCommandPhrase.ParameterName = "Phrase";
                insertCommand.Parameters.Add(insertCommandPhrase);

                insertCommandTranslation = insertCommand.CreateParameter();
                insertCommandTranslation.ParameterName = "Translation";
                insertCommand.Parameters.Add(insertCommandTranslation);

                deleteCommand             = Connection.CreateCommand();
                deleteCommand.CommandText = @"
					DELETE From VocabItems 
						WHERE SetID = $SetID AND ListPosition = $ListPosition; 
					UPDATE VocabItems SET ListPosition = ListPosition - 1 
						WHERE SetId = $SetID AND ListPosition > $ListPosition"                        ;

                deleteCommandSetID = deleteCommand.CreateParameter();
                deleteCommandSetID.ParameterName = "SetID";
                deleteCommand.Parameters.Add(deleteCommandSetID);

                deleteCommandListPosition = deleteCommand.CreateParameter();
                deleteCommandListPosition.ParameterName = "ListPosition";
                deleteCommand.Parameters.Add(deleteCommandListPosition);
            }
Пример #2
0
 protected SqliteObject(SqliteObject other)
 {
     conn           = other.conn;
     ownsConnection = false;
 }
Пример #3
0
	    protected SqliteObject(SqliteObject other) {
			conn = other.conn;
			ownsConnection = false;
		}