public void Add()
        {
            HsqlParameterCollection testSubject = NewTestSubject();

            object ovalue = new HsqlParameter();


            int parameterIndex = testSubject.Add(ovalue);

            HsqlParameter pvalue = new HsqlParameter();
            HsqlParameter rvalue = testSubject.Add(pvalue);

            Assert.Fail("TODO");
        }
        public void RemoveAt()
        {
            HsqlParameterCollection testSubject = NewTestSubject();

            testSubject.Add(new HsqlParameter("foo", "bar"));
            testSubject.Add(new HsqlParameter("foo2", "bar"));

            Assert.That(testSubject.Contains("foo"));
            Assert.That(testSubject.Contains("foo2"));

            testSubject.RemoveAt(0);
            testSubject.RemoveAt("foo2");

            Assert.That(!testSubject.Contains("foo"));
            Assert.That(!testSubject.Contains("foo2"));

            Assert.Fail("TODO");
        }
        public void IndexOf()
        {
            HsqlParameterCollection testSubject = NewTestSubject();
            HsqlParameter           value       = new HsqlParameter("foo", "bar");

            int expectedValueIndex = testSubject.Add((object)value);
            int actualValueIndex   = testSubject.IndexOf(value);

            Assert.AreEqual(expectedValueIndex, actualValueIndex);
            Assert.AreEqual(testSubject.IndexOf(value.ParameterName), testSubject.IndexOf(value));

            Assert.Fail("TODO");
        }
        public void Contains()
        {
            HsqlParameterCollection testSubject = NewTestSubject();
            object value = new HsqlParameter("foo", "bar");

            testSubject.Add(value);

            bool containsValue = testSubject.Contains(value);

            string parameterName = "foo";

            bool containsNamedParameter = testSubject.Contains(parameterName);

            Assert.Fail("TODO");
        }
        public void Remove()
        {
            HsqlParameterCollection testSubject = NewTestSubject();

            HsqlParameter parameter = new HsqlParameter("foo", "bar");

            testSubject.Add(parameter);

            Assert.AreEqual(1, testSubject.Count);

            testSubject.Remove(parameter);

            Assert.AreEqual(0, testSubject.Count);

            Assert.Fail("TODO");
        }
        internal void Append(HsqlCommand command)
        {
            HsqlParameterCollection parameters;

            if (command == null)
            {
                throw new ArgumentNullException(
                    "command");
            }

            string commandText = command.CommandText;

            if (string.IsNullOrEmpty(commandText))
            {
                throw new ArgumentException("Command Text Required",
                    "command.CommandText");
            }

            CommandType commandType = command.CommandType;

            switch (commandType)
            {
                case CommandType.Text:
                case CommandType.StoredProcedure:
                    {
                        parameters = null;
                        HsqlParameterCollection commandParameters = command.Parameters;
                        int parameterCount = commandParameters.Count;

                        if (parameterCount > 0)
                        {
                            parameters = new HsqlParameterCollection();

                            for (int i = 0; i < parameterCount; i++)
                            {
                                HsqlParameter destination = commandParameters[i].Clone();

                                parameters.Add(destination);

                                if (!IdentifierParser.IsMatch(destination
                                    .ParameterName))
                                {
                                    throw new HsqlDataSourceException(
                                        "Bad Parameter Name",
                                        org.hsqldb.Trace.GENERAL_ERROR,"S1000");
                                }
                            }
                        }
                        break;
                    }
                case CommandType.TableDirect:
                    {
                        throw new ArgumentOutOfRangeException(
                            "command.CommandType", commandType,
                            "Enumeration Value Not Supported.");
                    }
                default:
                    {
                        throw new ArgumentOutOfRangeException(
                            "command.CommandType", commandType,
                            "Invalid Enumeration Value");
                    }
            }

            int returnParameterIndex = -1;

            for (int j = 0; j < parameters.Count; j++)
            {
                if (ParameterDirection.ReturnValue == parameters[j].Direction)
                {
                    returnParameterIndex = j;
                    break;
                }
            }

            LocalCommand item = new LocalCommand(
                commandText,
                parameters,
                returnParameterIndex,
                commandType);

            m_commandList.Add(item);
        }
Example #7
0
        internal void Append(HsqlCommand command)
        {
            HsqlParameterCollection parameters;

            if (command == null)
            {
                throw new ArgumentNullException(
                          "command");
            }

            string commandText = command.CommandText;

            if (string.IsNullOrEmpty(commandText))
            {
                throw new ArgumentException("Command Text Required",
                                            "command.CommandText");
            }

            CommandType commandType = command.CommandType;

            switch (commandType)
            {
            case CommandType.Text:
            case CommandType.StoredProcedure:
            {
                parameters = null;
                HsqlParameterCollection commandParameters = command.Parameters;
                int parameterCount = commandParameters.Count;

                if (parameterCount > 0)
                {
                    parameters = new HsqlParameterCollection();

                    for (int i = 0; i < parameterCount; i++)
                    {
                        HsqlParameter destination = commandParameters[i].Clone();

                        parameters.Add(destination);

                        if (!IdentifierParser.IsMatch(destination
                                                      .ParameterName))
                        {
                            throw new HsqlDataSourceException(
                                      "Bad Parameter Name",
                                      org.hsqldb.Trace.GENERAL_ERROR, "S1000");
                        }
                    }
                }
                break;
            }

            case CommandType.TableDirect:
            {
                throw new ArgumentOutOfRangeException(
                          "command.CommandType", commandType,
                          "Enumeration Value Not Supported.");
            }

            default:
            {
                throw new ArgumentOutOfRangeException(
                          "command.CommandType", commandType,
                          "Invalid Enumeration Value");
            }
            }

            int returnParameterIndex = -1;

            for (int j = 0; j < parameters.Count; j++)
            {
                if (ParameterDirection.ReturnValue == parameters[j].Direction)
                {
                    returnParameterIndex = j;
                    break;
                }
            }

            LocalCommand item = new LocalCommand(
                commandText,
                parameters,
                returnParameterIndex,
                commandType);

            m_commandList.Add(item);
        }