Esempio n. 1
0
        private static DatabaseParameterBufferBase BuildDpb(DatabaseBase db, ConnectionString options)
        {
            var dpb = db.CreateDatabaseParameterBuffer();

            dpb.Append(IscCodes.isc_dpb_dummy_packet_interval, new byte[] { 120, 10, 0, 0 });
            dpb.Append(IscCodes.isc_dpb_sql_dialect, new byte[] { options.Dialect, 0, 0, 0 });
            dpb.Append(IscCodes.isc_dpb_lc_ctype, options.Charset);
            if (options.DbCachePages > 0)
            {
                dpb.Append(IscCodes.isc_dpb_num_buffers, options.DbCachePages);
            }
            if (!string.IsNullOrEmpty(options.UserID))
            {
                dpb.Append(IscCodes.isc_dpb_user_name, options.UserID);
            }
            if (!string.IsNullOrEmpty(options.Role))
            {
                dpb.Append(IscCodes.isc_dpb_sql_role_name, options.Role);
            }
            dpb.Append(IscCodes.isc_dpb_connect_timeout, options.ConnectionTimeout);
            dpb.Append(IscCodes.isc_dpb_process_id, GetProcessId());
            dpb.Append(IscCodes.isc_dpb_process_name, GetProcessName(options));
            dpb.Append(IscCodes.isc_dpb_client_version, GetClientVersion());
            if (options.NoDatabaseTriggers)
            {
                dpb.Append(IscCodes.isc_dpb_no_db_triggers, 1);
            }
            if (options.NoGarbageCollect)
            {
                dpb.Append(IscCodes.isc_dpb_no_garbage_collect, (byte)0);
            }

            return(dpb);
        }