예제 #1
0
 /// <summary>
 /// Returns the command text for a DbCommand to obtain the DateTime from the database.
 /// Note: This operation will make a database call.
 /// if ReturnAsAlias is not null, it will be the alias
 /// </summary>
 /// <param name="dbDateType">Enumeration value indicating whether time is local or UTC;
 /// default is UTC.</param>
 /// <param name="returnAsAlias">What the return column will be called</param>
 /// <returns>Back-end compliant command text for returning server time</returns>
 public override string GetServerTimeCommandText(EnumDateTimeLocale dbDateType, string returnAsAlias)
 {
     return(string.Format("select {0} from sysibm.dual", GetDbTimeAs(dbDateType, returnAsAlias)));
 }
예제 #2
0
        /// <summary>
        /// Returns the backend specific function for current datetime
        /// as a string e.g. sysdate or getdate() to be used in a seperate command
        /// if ReturnAsAlias is not null, it will be the alias
        /// </summary>
        /// <param name="dbDateType">The format type of the date function</param>
        /// <param name="returnAsAlias">What the return column will be called</param>
        /// <returns>Backend specific function for current date time</returns>
        public override string GetDbTimeAs(EnumDateTimeLocale dbDateType, string returnAsAlias)
        {
            string dbTime = dbDateType == EnumDateTimeLocale.Local ? "current_timestamp" : "current_timestamp - current_timezone";

            return(dbTime + (string.IsNullOrEmpty(returnAsAlias) ? "" : " as " + returnAsAlias));
        }
        /// <summary>
        /// Returns the backend specific function for current datetime
        /// to be used in an sql command.
        /// if ReturnAsAlias is not null, it will be the alias for the function
        /// </summary>
        /// <param name="dbDateType">The format type of the date function(local, UTC, Default (UTC))</param>
        /// <param name="returnAsAlias">What the return column will be called</param>
        /// <returns>Backend specific function for current date time including milliseconds</returns>
        public override string GetDbTimeAs(EnumDateTimeLocale dbDateType, string returnAsAlias)
        {
            string dbTime = dbDateType == EnumDateTimeLocale.Local ? "getdate()" : "getutcdate()";

            return(dbTime + (string.IsNullOrEmpty(returnAsAlias) ? "" : " as " + returnAsAlias));
        }
 /// <summary>
 /// Returns the command text for a DbCommand to obtain the DateTime from the database.
 /// Note: This operation will make a database call.
 /// if ReturnAsAlias is not null, it will be the alias
 /// </summary>
 /// <param name="dbDateType">Enumeration value indicating whether time is local or UTC;
 /// default is UTC.</param>
 /// <param name="returnAsAlias">What the return column will be called</param>
 /// <returns>Back-end compliant command text for returning server time</returns>
 public abstract string GetServerTimeCommandText(EnumDateTimeLocale dbDateType, string returnAsAlias);
 /// <summary>
 /// Returns the backend specific function for current datetime
 /// to be used in an sql command.
 /// if ReturnAsAlias is not null, it will be the alias for the function
 /// </summary>
 /// <param name="dbDateType">The format type of the date function(local, UTC, Default (UTC))</param>
 /// <param name="returnAsAlias">What the return column will be called</param>
 /// <returns>Backend specific function for current date time including milliseconds</returns>
 public abstract string GetDbTimeAs(EnumDateTimeLocale dbDateType, string returnAsAlias);
예제 #6
0
        /// <summary>
        /// Returns the backend specific function for current datetime
        /// to be used in an sql command.
        /// if ReturnAsAlias is not null, it will be the alias for the function
        /// </summary>
        /// <param name="dbDateType">The format type of the date function(local, UTC, Default (UTC))</param>
        /// <param name="returnAsAlias">What the return column will be called</param>
        /// <returns>Backend specific function for current date time including milliseconds</returns>
        public override string GetDbTimeAs(EnumDateTimeLocale dbDateType, string returnAsAlias)
        {
            string dbTime = dbDateType == EnumDateTimeLocale.Local ? "systimestamp" : "sys_extract_utc(systimestamp)";

            return(dbTime + (string.IsNullOrEmpty(returnAsAlias) ? "" : " as " + returnAsAlias));
        }