当前位置: 首页>>代码示例>>C#>>正文


C# NpgsqlTypes.FastpathArg类代码示例

本文整理汇总了C#中NpgsqlTypes.FastpathArg的典型用法代码示例。如果您正苦于以下问题:C# FastpathArg类的具体用法?C# FastpathArg怎么用?C# FastpathArg使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


FastpathArg类属于NpgsqlTypes命名空间,在下文中一共展示了FastpathArg类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LargeObject

		private Boolean closed = false; // true when we are closed

		/*
         * This opens a large object.
         *
         * <p>If the object does not exist, then an NpgsqlException is thrown.
         *
         * @param fp FastPath API for the connection to use
         * @param oid of the Large Object to open
         * @param mode Mode of opening the large object
         * (defined in LargeObjectManager)
         * @exception NpgsqlException if a database-access error occurs.
         * @see org.postgresql.largeobject.LargeObjectManager
         */

		public LargeObject(Fastpath fp, Int32 oid, Int32 mode)
		{
			this.fp = fp;
			this.oid = oid;

			FastpathArg[] args = new FastpathArg[2];
			args[0] = new FastpathArg(oid);
			args[1] = new FastpathArg(mode);
			this.fd = fp.GetInteger("lo_open", args);
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:25,代码来源:LargeObject.cs

示例2: FastpathCall

 /// <summary>
 /// Send a function call to the PostgreSQL backend.
 /// </summary>
 /// <param name="fnid">Function id.</param>
 /// <param name="resulttype">True if the result is an integer, false for other results.</param>
 /// <param name="args">FastpathArguments to pass to fastpath.</param>
 /// <returns>null if no data, Integer if an integer result, or byte[] otherwise.</returns>
 public Object FastpathCall(Int32 fnid, Boolean resulttype, FastpathArg[] args)
 {
     try
     {
         return FastpathV3(fnid, resulttype, args);
     }
     catch (IOException)
     {
         conn.ClearPool();
         throw;
     }
 }
开发者ID:Tradioyes,项目名称:Npgsql,代码行数:19,代码来源:FastPath.cs

示例3: GetData

 /// <summary>
 /// This convenience method assumes that the return value is an Integer.
 /// </summary>
 /// <param name="name">Function name.</param>
 /// <param name="args">Function arguments.</param>
 /// <returns>Array containing result</returns>
 public Byte[] GetData(String name, FastpathArg[] args)
 {
     return (Byte[]) FastpathCall(name, false, args);
 }
开发者ID:Tradioyes,项目名称:Npgsql,代码行数:10,代码来源:FastPath.cs

示例4: GetInteger

        /// <summary>
        /// This convenience method assumes that the return value is an Integer.
        /// </summary>
        /// <param name="name">Function name.</param>
        /// <param name="args">Function arguments.</param>
        /// <returns>Integer result.</returns>
        public Int32 GetInteger(String name, FastpathArg[] args)
        {
            Int32 i = (Int32) FastpathCall(name, true, args);

            return i;
        }
开发者ID:Tradioyes,项目名称:Npgsql,代码行数:12,代码来源:FastPath.cs

示例5: FastpathV2

        private Object FastpathV2(Int32 fnid, Boolean resulttype, FastpathArg[] args)
        {
            // added Oct 7 1998 to give us thread safety
            lock (stream)
            {
                // send the function call
                try
                {
                    // 70 is 'F' in ASCII. Note: don't use SendChar() here as it adds padding
                    // that confuses the backend. The 0 terminates the command line.
                    stream.WriteByte((Byte)70);
                    stream.WriteByte((Byte)0);

                    PGUtil.WriteInt32(stream,fnid);
                    PGUtil.WriteInt32(stream,args.Length);


                    for (Int32 i = 0;i < args.Length;i++)
                        args[i].Send(stream);

                    // This is needed, otherwise data can be lost
                    stream.Flush();

                }
                catch (IOException ioe)
                {
                    //Should be sending exception as second arg.
                    throw new Exception("postgresql.fp.send: "  + ioe.ToString());
                }

                // Now handle the result

                // Now loop, reading the results
                Object result = null; // our result
                String errorMessage = "";
                Byte[] input_buffer = new Byte[512];
                Int32 c;
                Boolean l_endQuery = false;
                while (!l_endQuery)
                {
                    c = (Char)stream.ReadByte();

                    switch (c)
                    {
                    case 'A':	// Asynchronous Notify
                        //TODO: do something with this
                        Int32 pid = PGUtil.ReadInt32(stream,input_buffer);
                        String msg = PGUtil.ReadString(stream,conn.Connector.Encoding);


                        conn.Connector.CheckErrorsAndNotifications();

                        break;

                        //------------------------------
                        // Error message returned
                    case 'E':
                        NpgsqlError e = new NpgsqlError(conn.BackendProtocolVersion);
                        e.ReadFromStream(stream,conn.Connector.Encoding);
                        errorMessage +=  e.Message;
                        break;

                        //------------------------------
                        // Notice from backend
                    case 'N':
                        NpgsqlError notice = new NpgsqlError(conn.BackendProtocolVersion);
                        notice.ReadFromStream(stream,conn.Connector.Encoding);
                        errorMessage +=  notice.Message;
                        break;

                    case 'V':
                        Char l_nextChar = (Char)stream.ReadByte();
                        if (l_nextChar == 'G')
                        {
                            Int32 sz = PGUtil.ReadInt32(stream,input_buffer);
                            // Return an Integer if
                            if (resulttype)
                                result = PGUtil.ReadInt32(stream,input_buffer);
                            else
                            {
                                Byte[] buf = new Byte[sz];

                                Int32 bytes_from_stream = 0;
                                Int32 total_bytes_read = 0;
                                Int32 size = sz;
                                do
                                {
                                    bytes_from_stream = stream.Read(buf, total_bytes_read, size);
                                    total_bytes_read += bytes_from_stream;
                                    size -= bytes_from_stream;
                                }
                                while(size > 0);

                                result = buf;
                            }
                            //There should be a trailing '0'
                            Int32 l_endChar = (Char)stream.ReadByte();
                        }
                        else
                        {
//.........这里部分代码省略.........
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:101,代码来源:FastPath.cs

示例6: Create

 /// <summary>
 /// This creates a large object, returning its OID.
 /// </summary>
 /// <returns>OID of new object.</returns>
 public Int32 Create()
 {
     FastpathArg[] args = new FastpathArg[1];
     args[0] = new FastpathArg(READWRITE);
     return fp.GetInteger("lo_creat", args);
 }
开发者ID:Emill,项目名称:Npgsql,代码行数:10,代码来源:LargeObjectManager.cs

示例7: Seek

		/*
         * Sets the current position within the object.
         *
         * <p>This is similar to the fseek() call in the standard C library. It
         * allows you to have random access to the large object.
         *
         * @param pos position within object
         * @param ref Either SEEK_SET, SEEK_CUR or SEEK_END
         * @exception NpgsqlException if a database-access error occurs.
         */

		public void Seek(Int32 pos, Int32 refi)
		{
			FastpathArg[] args = new FastpathArg[3];
			args[0] = new FastpathArg(fd);
			args[1] = new FastpathArg(pos);
			args[2] = new FastpathArg(refi);
			fp.FastpathCall("lo_lseek", false, args);
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:19,代码来源:LargeObject.cs

示例8: FastpathV2

        private Object FastpathV2(Int32 fnid, Boolean resulttype, FastpathArg[] args)
        {
            // added Oct 7 1998 to give us thread safety
            lock (stream)
            {
                // send the function call

                stream
                    .WriteBytesNullTerminated((byte)ASCIIBytes.F)
                    .WriteInt32(fnid)
                    .WriteInt32(args.Length);

                for (Int32 i = 0; i < args.Length; i++)
                {
                    args[i].Send(stream);
                }

                // This is needed, otherwise data can be lost
                stream.Flush();

                // Now handle the result

                // Now loop, reading the results
                Object result = null; // our result
                String errorMessage = "";
                Int32 c;
                Boolean l_endQuery = false;
                while (!l_endQuery)
                {
                    c = (Char) stream.ReadByte();

                    switch (c)
                    {
                        case 'A': // Asynchronous Notify
                            //TODO: do something with this
                            Int32 pid = PGUtil.ReadInt32(stream);
                            String msg = PGUtil.ReadString(stream);

                            break;

                            //------------------------------
                            // Error message returned
                        case 'E':
                            NpgsqlError e = new NpgsqlError(conn.BackendProtocolVersion, stream);
                            errorMessage += e.Message;
                            break;

                            //------------------------------
                            // Notice from backend
                        case 'N':
                            NpgsqlError notice = new NpgsqlError(conn.BackendProtocolVersion, stream);
                            errorMessage += notice.Message;
                            break;

                        case 'V':
                            Char l_nextChar = (Char) stream.ReadByte();
                            if (l_nextChar == 'G')
                            {
                                Int32 sz = PGUtil.ReadInt32(stream);
                                // Return an Integer if
                                if (resulttype)
                                {
                                    result = PGUtil.ReadInt32(stream);
                                }
                                else
                                {
                                    Byte[] buf = new Byte[sz];

                                    Int32 bytes_from_stream = 0;
                                    Int32 total_bytes_read = 0;
                                    Int32 size = sz;
                                    do
                                    {
                                        bytes_from_stream = stream.Read(buf, total_bytes_read, size);
                                        total_bytes_read += bytes_from_stream;
                                        size -= bytes_from_stream;
                                    }
                                    while (size > 0);

                                    result = buf;
                                }
                                //There should be a trailing '0'
                                Int32 l_endChar = (Char) stream.ReadByte();
                            }
                            else
                            {
                                //it must have been a '0', thus no results
                            }
                            break;

                        case 'Z':
                            l_endQuery = true;
                            break;

                        default:
                            throw new NpgsqlException(string.Format("postgresql.fp.protocol {0}", c));
                    }
                }

                if (errorMessage != null)
//.........这里部分代码省略.........
开发者ID:undeadlabs,项目名称:Npgsql,代码行数:101,代码来源:FastPath.cs

示例9: FastpathCall

 /// <summary>
 /// Send a function call to the PostgreSQL backend.
 /// </summary>
 /// <param name="fnid">Function id.</param>
 /// <param name="resulttype">True if the result is an integer, false for other results.</param>
 /// <param name="args">FastpathArguments to pass to fastpath.</param>
 /// <returns>null if no data, Integer if an integer result, or byte[] otherwise.</returns>
 public Object FastpathCall(Int32 fnid, Boolean resulttype, FastpathArg[] args)
 {
     try
     {
         if (conn.BackendProtocolVersion == ProtocolVersion.Version3)
         {
             return FastpathV3(fnid, resulttype, args);
         }
         else
         {
             return FastpathV2(fnid, resulttype, args);
         }
     }
     catch (IOException)
     {
         conn.ClearPool();
         throw new NpgsqlException("The Connection is broken.");
     }
 }
开发者ID:undeadlabs,项目名称:Npgsql,代码行数:26,代码来源:FastPath.cs

示例10: Read

 /*
  * Reads some data from the object, and return as a byte[] array
  *
  * @param len number of bytes to read
  * @return byte[] array containing data read
  * @exception NpgsqlException if a database-access error occurs.
  */
 public Byte[] Read(Int32 len)
 {
     // This is the original method, where the entire block (len bytes)
     // is retrieved in one go.
     FastpathArg[] args = new FastpathArg[2];
     args[0] = new FastpathArg(fd);
     args[1] = new FastpathArg(len);
     return fp.GetData("loread", args);
 }
开发者ID:zapov,项目名称:Npgsql2,代码行数:16,代码来源:LargeObject.cs

示例11: FastpathCall

 /// <summary>
 /// Send a function call to the PostgreSQL backend.
 /// </summary>
 /// <param name="fnid">Function id.</param>
 /// <param name="resulttype">True if the result is an integer, false for other results.</param>
 /// <param name="args">FastpathArguments to pass to fastpath.</param>
 /// <returns>null if no data, Integer if an integer result, or byte[] otherwise.</returns>
 public Object FastpathCall(Int32 fnid, Boolean resulttype, FastpathArg[] args)
 {
     try
     {
         return FastpathV3(fnid, resulttype, args);
     }
     catch (IOException)
     {
         conn.ClearPool();
         throw new NpgsqlException("The Connection is broken.");
     }
 }
开发者ID:hultqvist,项目名称:Npgsql2,代码行数:19,代码来源:FastPath.cs

示例12: FastpathCall

 /*
  * Send a function call to the PostgreSQL backend
  *
  * @param fnid Function id
  * @param resulttype True if the result is an integer, false for other results
  * @param args FastpathArguments to pass to fastpath
  * @return null if no data, Integer if an integer result, or byte[] otherwise
  * @exception SQLException if a database-access error occurs.
  */
 public Object FastpathCall(Int32 fnid, Boolean resulttype, FastpathArg[] args)
 {
     if (conn.BackendProtocolVersion == ProtocolVersion.Version3)
     {
         return FastpathV3(fnid, resulttype, args);
     }
     else
     {
         return FastpathV2(fnid, resulttype, args);
     }
 }
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:20,代码来源:FastPath.cs

示例13: Read

		/*
         * Reads some data from the object, and return as a byte[] array
         *
         * @param len number of bytes to read
         * @return byte[] array containing data read
         * @exception NpgsqlException if a database-access error occurs.
         */

		public Byte[] Read(Int32 len)
		{
			// This is the original method, where the entire block (len bytes)
			// is retrieved in one go.
			FastpathArg[] args = new FastpathArg[2];
			args[0] = new FastpathArg(fd);
			args[1] = new FastpathArg(len);
			return fp.GetData("loread", args);

			// This version allows us to break this down Int32o 4k blocks
			//if (len<=4048) {
			//// handle as before, return the whole block in one go
			//FastpathArg args[] = new FastpathArg[2];
			//args[0] = new FastpathArg(fd);
			//args[1] = new FastpathArg(len);
			//return fp.getData("loread",args);
			//} else {
			//// return in 4k blocks
			//byte[] buf=new byte[len];
			//int off=0;
			//while (len>0) {
			//int bs=4048;
			//len-=bs;
			//if (len<0) {
			//bs+=len;
			//len=0;
			//}
			//read(buf,off,bs);
			//off+=bs;
			//}
			//return buf;
			//}
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:41,代码来源:LargeObject.cs

示例14: Write

		/*
         * Writes an array to the object
         *
         * @param buf array to write
         * @exception NpgsqlException if a database-access error occurs.
         */

		public void Write(Byte[] buf)
		{
			FastpathArg[] args = new FastpathArg[2];
			args[0] = new FastpathArg(fd);
			args[1] = new FastpathArg(buf);
			fp.FastpathCall("lowrite", false, args);
		}
开发者ID:Orvid,项目名称:SQLInterfaceCollection,代码行数:14,代码来源:LargeObject.cs

示例15: Delete

 /// <summary>
 /// This deletes a large object.
 /// </summary>
 /// <param name="oid">OID describing object to delete.</param>
 public void Delete(Int32 oid)
 {
     FastpathArg[] args = new FastpathArg[1];
     args[0] = new FastpathArg(oid);
     fp.FastpathCall("lo_unlink", false, args);
 }
开发者ID:Emill,项目名称:Npgsql,代码行数:10,代码来源:LargeObjectManager.cs


注:本文中的NpgsqlTypes.FastpathArg类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。