示例#1
0
        public void GetSchemaParameterMarkerFormats()
        {
            var dt = TheConnection.GetSchema("DataSourceInformation");
            var parameterMarkerFormat = (string)dt.Rows[0]["ParameterMarkerFormat"];

            using (var connection = new NpgsqlConnection(TheConnectionString))
            {
                connection.Open();
                using (var command = connection.CreateCommand())
                {
                    const String parameterName = "p_field_int4";
                    command.CommandText = "SELECT * FROM tablea WHERE field_int4=" + String.Format(parameterMarkerFormat, parameterName);
                    command.Parameters.Add(new NpgsqlParameter(parameterName, 4));
                    using (var reader = command.ExecuteReader())
                    {
                        Assert.IsTrue(reader.Read());
                        // This is OK, when no exceptions are occurred.
                    }
                }
            }
        }
示例#2
0
        public void GetSchemaForeignKeys()
        {
            var dt = TheConnection.GetSchema("ForeignKeys");

            Assert.IsNotNull(dt);
        }