Example #1
0
        // sets val as DateTime with Oid oid (PqsqlDbType.Timestamp, PqsqlDbType.TimestampTZ) into pqparam_buffer pb
        internal static void SetTimestamp(IntPtr pb, object val, PqsqlDbType oid)
        {
            DateTime dt = (DateTime)val;

            long sec;
            int  usec;

            PqsqlBinaryFormat.GetTimestamp(dt, out sec, out usec);

            PqsqlBinaryFormat.pqbf_add_timestamp(pb, sec, usec, (uint)oid);
        }
Example #2
0
        // adds o as DateTime array element into PQExpBuffer a
        internal static void SetTimestampArray(IntPtr a, object o)
        {
            DateTime dt = (DateTime)o;

            long sec;
            int  usec;

            PqsqlBinaryFormat.GetTimestamp(dt, out sec, out usec);

            PqsqlBinaryFormat.pqbf_set_array_itemlength(a, 8);
            PqsqlBinaryFormat.pqbf_set_timestamp(a, sec, usec);
        }
Example #3
0
        public int WriteTimestamp(DateTime value)
        {
            long begin = LengthCheckReset();

            long sec;
            int  usec;

            PqsqlBinaryFormat.GetTimestamp(value, out sec, out usec);

            PqsqlBinaryFormat.pqbf_set_timestamp(mExpBuf, sec, usec);
            unsafe
            {
                sbyte *val = PqsqlBinaryFormat.pqbf_get_bufval(mExpBuf) + begin;
                return(PutColumn(val, 8));
            }
        }