Documentation for Sequel (v5.86.0)
+Documentation for Sequel (v5.87.0)
@@ -166,6 +166,8 @@
Release Notes
Sequel::Model Plugins for v5.86.0
+Sequel::Model Plugins for v5.87.0
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -691 def complex_expression_sql_append(sql, op, args) -692 case op -693 when :IN, :"NOT IN" -694 ds = args[1] -695 if ds.is_a?(Sequel::Dataset) && ds.opts[:limit] -696 super(sql, op, [args[0], ds.from_self]) -697 else -698 super -699 end -700 when :~, :'!~', :'~*', :'!~*', :LIKE, :'NOT LIKE', :ILIKE, :'NOT ILIKE' -701 if !db.mariadb? && db.server_version >= 80000 && [:~, :'!~'].include?(op) -702 func = Sequel.function(:REGEXP_LIKE, args[0], args[1], 'c') -703 func = ~func if op == :'!~' -704 return literal_append(sql, func) -705 end -706 -707 sql << '(' -708 literal_append(sql, args[0]) -709 sql << ' ' -710 sql << 'NOT ' if [:'NOT LIKE', :'NOT ILIKE', :'!~', :'!~*'].include?(op) -711 sql << ([:~, :'!~', :'~*', :'!~*'].include?(op) ? 'REGEXP' : 'LIKE') -712 sql << ' ' -713 sql << 'BINARY ' if [:~, :'!~', :LIKE, :'NOT LIKE'].include?(op) -714 literal_append(sql, args[1]) -715 if [:LIKE, :'NOT LIKE', :ILIKE, :'NOT ILIKE'].include?(op) -716 sql << " ESCAPE " -717 literal_append(sql, "\\") -718 end -719 sql << ')' -720 when :'||' -721 if args.length > 1 -722 sql << "CONCAT" -723 array_sql_append(sql, args) -724 else -725 literal_append(sql, args[0]) -726 end -727 when :'B~' -728 sql << "CAST(~" -729 literal_append(sql, args[0]) -730 sql << " AS SIGNED INTEGER)" -731 else -732 super -733 end -734 end+695 def complex_expression_sql_append(sql, op, args) +696 case op +697 when :IN, :"NOT IN" +698 ds = args[1] +699 if ds.is_a?(Sequel::Dataset) && ds.opts[:limit] +700 super(sql, op, [args[0], ds.from_self]) +701 else +702 super +703 end +704 when :~, :'!~', :'~*', :'!~*', :LIKE, :'NOT LIKE', :ILIKE, :'NOT ILIKE' +705 if !db.mariadb? && db.server_version >= 80000 && [:~, :'!~'].include?(op) +706 func = Sequel.function(:REGEXP_LIKE, args[0], args[1], 'c') +707 func = ~func if op == :'!~' +708 return literal_append(sql, func) +709 end +710 +711 sql << '(' +712 literal_append(sql, args[0]) +713 sql << ' ' +714 sql << 'NOT ' if [:'NOT LIKE', :'NOT ILIKE', :'!~', :'!~*'].include?(op) +715 sql << ([:~, :'!~', :'~*', :'!~*'].include?(op) ? 'REGEXP' : 'LIKE') +716 sql << ' ' +717 sql << 'BINARY ' if [:~, :'!~', :LIKE, :'NOT LIKE'].include?(op) +718 literal_append(sql, args[1]) +719 if [:LIKE, :'NOT LIKE', :ILIKE, :'NOT ILIKE'].include?(op) +720 sql << " ESCAPE " +721 literal_append(sql, "\\") +722 end +723 sql << ')' +724 when :'||' +725 if args.length > 1 +726 sql << "CONCAT" +727 array_sql_append(sql, args) +728 else +729 literal_append(sql, args[0]) +730 end +731 when :'B~' +732 sql << "CAST(~" +733 literal_append(sql, args[0]) +734 sql << " AS SIGNED INTEGER)" +735 else +736 super +737 end +738 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -740 def constant_sql_append(sql, constant) -741 if constant == :CURRENT_TIMESTAMP && supports_timestamp_usecs? -742 sql << 'CURRENT_TIMESTAMP(6)' -743 else -744 super -745 end -746 end+744 def constant_sql_append(sql, constant) +745 if constant == :CURRENT_TIMESTAMP && supports_timestamp_usecs? +746 sql << 'CURRENT_TIMESTAMP(6)' +747 else +748 super +749 end +750 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -769 def delete_from(*tables) -770 clone(:delete_from=>tables) -771 end+773 def delete_from(*tables) +774 clone(:delete_from=>tables) +775 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -749 def distinct(*args) -750 args.empty? ? super : group(*args) -751 end+753 def distinct(*args) +754 args.empty? ? super : group(*args) +755 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -775 def explain(opts=OPTS) -776 # Load the PrettyTable class, needed for explain output -777 Sequel.extension(:_pretty_table) unless defined?(Sequel::PrettyTable) -778 -779 ds = db.send(:metadata_dataset).with_sql(((opts[:extended] && (db.mariadb? || db.server_version < 50700)) ? 'EXPLAIN EXTENDED ' : 'EXPLAIN ') + select_sql).naked -780 rows = ds.all -781 Sequel::PrettyTable.string(rows, ds.columns) -782 end+779 def explain(opts=OPTS) +780 # Load the PrettyTable class, needed for explain output +781 Sequel.extension(:_pretty_table) unless defined?(Sequel::PrettyTable) +782 +783 ds = db.send(:metadata_dataset).with_sql(((opts[:extended] && (db.mariadb? || db.server_version < 50700)) ? 'EXPLAIN EXTENDED ' : 'EXPLAIN ') + select_sql).naked +784 rows = ds.all +785 Sequel::PrettyTable.string(rows, ds.columns) +786 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -790 def full_text_search(cols, terms, opts = OPTS) -791 where(full_text_sql(cols, terms, opts)) -792 end+794 def full_text_search(cols, terms, opts = OPTS) +795 where(full_text_sql(cols, terms, opts)) +796 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -795 def full_text_sql(cols, terms, opts = OPTS) -796 terms = terms.join(' ') if terms.is_a?(Array) -797 SQL::PlaceholderLiteralString.new((opts[:boolean] ? MATCH_AGAINST_BOOLEAN : MATCH_AGAINST), [Array(cols), terms]) -798 end+799 def full_text_sql(cols, terms, opts = OPTS) +800 terms = terms.join(' ') if terms.is_a?(Array) +801 SQL::PlaceholderLiteralString.new((opts[:boolean] ? MATCH_AGAINST_BOOLEAN : MATCH_AGAINST), [Array(cols), terms]) +802 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -808 def insert_ignore -809 clone(:insert_ignore=>true) -810 end+812 def insert_ignore +813 clone(:insert_ignore=>true) +814 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -814 def insert_select(*values) -815 return unless supports_insert_select? -816 # Handle case where query does not return a row -817 server?(:default).with_sql_first(insert_select_sql(*values)) || false -818 end+818 def insert_select(*values) +819 return unless supports_insert_select? +820 # Handle case where query does not return a row +821 server?(:default).with_sql_first(insert_select_sql(*values)) || false +822 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -822 def insert_select_sql(*values) -823 ds = opts[:returning] ? self : returning -824 ds.insert_sql(*values) -825 end+826 def insert_select_sql(*values) +827 ds = opts[:returning] ? self : returning +828 ds.insert_sql(*values) +829 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -856 def on_duplicate_key_update(*args) -857 clone(:on_duplicate_key_update => args) -858 end+860 def on_duplicate_key_update(*args) +861 clone(:on_duplicate_key_update => args) +862 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -861 def quoted_identifier_append(sql, c) -862 sql << '`' << c.to_s.gsub('`', '``') << '`' -863 end+865 def quoted_identifier_append(sql, c) +866 sql << '`' << c.to_s.gsub('`', '``') << '`' +867 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -866 def supports_cte?(type=:select) -867 if db.mariadb? -868 type == :select && db.server_version >= 100200 -869 else -870 case type -871 when :select, :update, :delete -872 db.server_version >= 80000 -873 end -874 end -875 end+870 def supports_cte?(type=:select) +871 if db.mariadb? +872 type == :select && db.server_version >= 100200 +873 else +874 case type +875 when :select, :update, :delete +876 db.server_version >= 80000 +877 end +878 end +879 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -878 def supports_derived_column_lists? -879 false -880 end+882 def supports_derived_column_lists? +883 false +884 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -884 def supports_distinct_on? -885 true -886 end+888 def supports_distinct_on? +889 true +890 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -889 def supports_group_rollup? -890 true -891 end+893 def supports_group_rollup? +894 true +895 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -894 def supports_intersect_except? -895 db.mariadb? && db.server_version >= 100300 -896 end+898 def supports_intersect_except? +899 db.mariadb? && db.server_version >= 100300 +900 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -904 def supports_modifying_joins? -905 true -906 end+908 def supports_modifying_joins? +909 true +910 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -909 def supports_nowait? -910 db.server_version >= (db.mariadb? ? 100300 : 80000) -911 end+913 def supports_nowait? +914 db.server_version >= (db.mariadb? ? 100300 : 80000) +915 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -915 def supports_ordered_distinct_on? -916 false -917 end+919 def supports_ordered_distinct_on? +920 false +921 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -920 def supports_regexp? -921 true -922 end+924 def supports_regexp? +925 true +926 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -925 def supports_returning?(type) -926 (type == :insert && db.mariadb? && db.adapter_scheme != :jdbc) ? (db.server_version >= 100500) : false -927 end+929 def supports_returning?(type) +930 (type == :insert && db.mariadb? && db.adapter_scheme != :jdbc) ? (db.server_version >= 100500) : false +931 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -930 def supports_skip_locked? -931 db.server_version >= (db.mariadb? ? 100600 : 80000) -932 end+934 def supports_skip_locked? +935 db.server_version >= (db.mariadb? ? 100600 : 80000) +936 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -936 def supports_timestamp_usecs? -937 db.supports_timestamp_usecs? -938 end+940 def supports_timestamp_usecs? +941 db.supports_timestamp_usecs? +942 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -941 def supports_window_clause? -942 !db.mariadb? && db.server_version >= 80000 -943 end+945 def supports_window_clause? +946 !db.mariadb? && db.server_version >= 80000 +947 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -946 def supports_window_functions? -947 db.server_version >= (db.mariadb? ? 100200 : 80000) -948 end+950 def supports_window_functions? +951 db.server_version >= (db.mariadb? ? 100200 : 80000) +952 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/mysql.rb -956 def update_ignore -957 clone(:update_ignore=>true) -958 end+960 def update_ignore +961 clone(:update_ignore=>true) +962 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -1827 def analyze -1828 explain(:analyze=>true) -1829 end+1828 def analyze +1829 explain(:analyze=>true) +1830 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -1834 def complex_expression_sql_append(sql, op, args) -1835 case op -1836 when :^ -1837 j = ' # ' -1838 c = false -1839 args.each do |a| -1840 sql << j if c -1841 literal_append(sql, a) -1842 c ||= true -1843 end -1844 when :ILIKE, :'NOT ILIKE' -1845 sql << '(' -1846 literal_append(sql, args[0]) -1847 sql << ' ' << op.to_s << ' ' -1848 literal_append(sql, args[1]) -1849 sql << ')' -1850 else -1851 super -1852 end -1853 end+1835 def complex_expression_sql_append(sql, op, args) +1836 case op +1837 when :^ +1838 j = ' # ' +1839 c = false +1840 args.each do |a| +1841 sql << j if c +1842 literal_append(sql, a) +1843 c ||= true +1844 end +1845 when :ILIKE, :'NOT ILIKE' +1846 sql << '(' +1847 literal_append(sql, args[0]) +1848 sql << ' ' << op.to_s << ' ' +1849 literal_append(sql, args[1]) +1850 sql << ')' +1851 else +1852 super +1853 end +1854 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -1869 def disable_insert_returning -1870 clone(:disable_insert_returning=>true) -1871 end+1870 def disable_insert_returning +1871 clone(:disable_insert_returning=>true) +1872 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -1874 def empty? -1875 return false if @opts[:values] -1876 super -1877 end+1875 def empty? +1876 return false if @opts[:values] +1877 super +1878 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -1880 def explain(opts=OPTS) -1881 with_sql((opts[:analyze] ? 'EXPLAIN ANALYZE ' : 'EXPLAIN ') + select_sql).map(:'QUERY PLAN').join("\r\n") -1882 end+1881 def explain(opts=OPTS) +1882 with_sql((opts[:analyze] ? 'EXPLAIN ANALYZE ' : 'EXPLAIN ') + select_sql).map(:'QUERY PLAN').join("\r\n") +1883 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -1908 def full_text_search(cols, terms, opts = OPTS) -1909 lang = Sequel.cast(opts[:language] || 'simple', :regconfig) -1910 -1911 unless opts[:tsvector] -1912 phrase_cols = full_text_string_join(cols) -1913 cols = Sequel.function(:to_tsvector, lang, phrase_cols) -1914 end -1915 -1916 unless opts[:tsquery] -1917 phrase_terms = terms.is_a?(Array) ? terms.join(' | ') : terms -1918 -1919 query_func = case to_tsquery = opts[:to_tsquery] -1920 when :phrase, :plain -1921 :"#{to_tsquery}to_tsquery" -1922 when :websearch -1923 :"websearch_to_tsquery" -1924 else -1925 (opts[:phrase] || opts[:plain]) ? :plainto_tsquery : :to_tsquery -1926 end -1927 -1928 terms = Sequel.function(query_func, lang, phrase_terms) -1929 end -1930 -1931 ds = where(Sequel.lit(["", " @@ ", ""], cols, terms)) -1932 -1933 if opts[:phrase] -1934 raise Error, "can't use :phrase with either :tsvector or :tsquery arguments to full_text_search together" if opts[:tsvector] || opts[:tsquery] -1935 ds = ds.grep(phrase_cols, "%#{escape_like(phrase_terms)}%", :case_insensitive=>true) -1936 end -1937 -1938 if opts[:rank] -1939 ds = ds.reverse{ts_rank_cd(cols, terms)} -1940 end -1941 -1942 if opts[:headline] -1943 ds = ds.select_append{ts_headline(lang, phrase_cols, terms).as(:headline)} -1944 end -1945 -1946 ds -1947 end+1909 def full_text_search(cols, terms, opts = OPTS) +1910 lang = Sequel.cast(opts[:language] || 'simple', :regconfig) +1911 +1912 unless opts[:tsvector] +1913 phrase_cols = full_text_string_join(cols) +1914 cols = Sequel.function(:to_tsvector, lang, phrase_cols) +1915 end +1916 +1917 unless opts[:tsquery] +1918 phrase_terms = terms.is_a?(Array) ? terms.join(' | ') : terms +1919 +1920 query_func = case to_tsquery = opts[:to_tsquery] +1921 when :phrase, :plain +1922 :"#{to_tsquery}to_tsquery" +1923 when :websearch +1924 :"websearch_to_tsquery" +1925 else +1926 (opts[:phrase] || opts[:plain]) ? :plainto_tsquery : :to_tsquery +1927 end +1928 +1929 terms = Sequel.function(query_func, lang, phrase_terms) +1930 end +1931 +1932 ds = where(Sequel.lit(["", " @@ ", ""], cols, terms)) +1933 +1934 if opts[:phrase] +1935 raise Error, "can't use :phrase with either :tsvector or :tsquery arguments to full_text_search together" if opts[:tsvector] || opts[:tsquery] +1936 ds = ds.grep(phrase_cols, "%#{escape_like(phrase_terms)}%", :case_insensitive=>true) +1937 end +1938 +1939 if opts[:rank] +1940 ds = ds.reverse{ts_rank_cd(cols, terms)} +1941 end +1942 +1943 if opts[:headline] +1944 ds = ds.select_append{ts_headline(lang, phrase_cols, terms).as(:headline)} +1945 end +1946 +1947 ds +1948 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -1950 def insert(*values) -1951 if @opts[:returning] -1952 # Already know which columns to return, let the standard code handle it -1953 super -1954 elsif @opts[:sql] || @opts[:disable_insert_returning] -1955 # Raw SQL used or RETURNING disabled, just use the default behavior -1956 # and return nil since sequence is not known. -1957 super -1958 nil -1959 else -1960 # Force the use of RETURNING with the primary key value, -1961 # unless it has been disabled. -1962 returning(insert_pk).insert(*values){|r| return r.values.first} -1963 end -1964 end+1951 def insert(*values) +1952 if @opts[:returning] +1953 # Already know which columns to return, let the standard code handle it +1954 super +1955 elsif @opts[:sql] || @opts[:disable_insert_returning] +1956 # Raw SQL used or RETURNING disabled, just use the default behavior +1957 # and return nil since sequence is not known. +1958 super +1959 nil +1960 else +1961 # Force the use of RETURNING with the primary key value, +1962 # unless it has been disabled. +1963 returning(insert_pk).insert(*values){|r| return r.values.first} +1964 end +1965 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2001 def insert_conflict(opts=OPTS) -2002 clone(:insert_conflict => opts) -2003 end+2002 def insert_conflict(opts=OPTS) +2003 clone(:insert_conflict => opts) +2004 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2011 def insert_ignore -2012 insert_conflict -2013 end+2012 def insert_ignore +2013 insert_conflict +2014 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2018 def insert_select(*values) -2019 return unless supports_insert_select? -2020 # Handle case where query does not return a row -2021 server?(:default).with_sql_first(insert_select_sql(*values)) || false -2022 end+2019 def insert_select(*values) +2020 return unless supports_insert_select? +2021 # Handle case where query does not return a row +2022 server?(:default).with_sql_first(insert_select_sql(*values)) || false +2023 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2026 def insert_select_sql(*values) -2027 ds = opts[:returning] ? self : returning -2028 ds.insert_sql(*values) -2029 end+2027 def insert_select_sql(*values) +2028 ds = opts[:returning] ? self : returning +2029 ds.insert_sql(*values) +2030 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2033 def join_table(type, table, expr=nil, options=OPTS, &block) -2034 if expr.is_a?(SQL::AliasedExpression) && expr.expression.is_a?(Array) && !expr.expression.empty? && expr.expression.all? -2035 options = options.merge(:join_using=>true) -2036 end -2037 super -2038 end+2034 def join_table(type, table, expr=nil, options=OPTS, &block) +2035 if expr.is_a?(SQL::AliasedExpression) && expr.expression.is_a?(Array) && !expr.expression.empty? && expr.expression.all? +2036 options = options.merge(:join_using=>true) +2037 end +2038 super +2039 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2045 def lock(mode, opts=OPTS) -2046 if defined?(yield) # perform locking inside a transaction and yield to block -2047 @db.transaction(opts){lock(mode, opts); yield} -2048 else -2049 sql = 'LOCK TABLE '.dup -2050 source_list_append(sql, @opts[:from]) -2051 mode = mode.to_s.upcase.strip -2052 unless LOCK_MODES.include?(mode) -2053 raise Error, "Unsupported lock mode: #{mode}" -2054 end -2055 sql << " IN #{mode} MODE" -2056 @db.execute(sql, opts) -2057 end -2058 nil -2059 end+2046 def lock(mode, opts=OPTS) +2047 if defined?(yield) # perform locking inside a transaction and yield to block +2048 @db.transaction(opts){lock(mode, opts); yield} +2049 else +2050 sql = 'LOCK TABLE '.dup +2051 source_list_append(sql, @opts[:from]) +2052 mode = mode.to_s.upcase.strip +2053 unless LOCK_MODES.include?(mode) +2054 raise Error, "Unsupported lock mode: #{mode}" +2055 end +2056 sql << " IN #{mode} MODE" +2057 @db.execute(sql, opts) +2058 end +2059 nil +2060 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2062 def merge(&block) -2063 sql = merge_sql -2064 if uses_returning?(:merge) -2065 returning_fetch_rows(sql, &block) -2066 else -2067 execute_ddl(sql) -2068 end -2069 end+2063 def merge(&block) +2064 sql = merge_sql +2065 if uses_returning?(:merge) +2066 returning_fetch_rows(sql, &block) +2067 else +2068 execute_ddl(sql) +2069 end +2070 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2080 def merge_delete_when_not_matched_by_source(&block) -2081 _merge_when(:type=>:delete_not_matched_by_source, &block) -2082 end+2081 def merge_delete_when_not_matched_by_source(&block) +2082 _merge_when(:type=>:delete_not_matched_by_source, &block) +2083 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2093 def merge_do_nothing_when_matched(&block) -2094 _merge_when(:type=>:matched, &block) -2095 end+2094 def merge_do_nothing_when_matched(&block) +2095 _merge_when(:type=>:matched, &block) +2096 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2106 def merge_do_nothing_when_not_matched(&block) -2107 _merge_when(:type=>:not_matched, &block) -2108 end+2107 def merge_do_nothing_when_not_matched(&block) +2108 _merge_when(:type=>:not_matched, &block) +2109 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2119 def merge_do_nothing_when_not_matched_by_source(&block) -2120 _merge_when(:type=>:not_matched_by_source, &block) -2121 end+2120 def merge_do_nothing_when_not_matched_by_source(&block) +2121 _merge_when(:type=>:not_matched_by_source, &block) +2122 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2124 def merge_insert(*values, &block) -2125 h = {:type=>:insert, :values=>values} -2126 if @opts[:override] -2127 h[:override] = insert_override_sql(String.new) -2128 end -2129 _merge_when(h, &block) -2130 end+2125 def merge_insert(*values, &block) +2126 h = {:type=>:insert, :values=>values} +2127 if @opts[:override] +2128 h[:override] = insert_override_sql(String.new) +2129 end +2130 _merge_when(h, &block) +2131 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2141 def merge_update_when_not_matched_by_source(values, &block) -2142 _merge_when(:type=>:update_not_matched_by_source, :values=>values, &block) -2143 end+2142 def merge_update_when_not_matched_by_source(values, &block) +2143 _merge_when(:type=>:update_not_matched_by_source, :values=>values, &block) +2144 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2148 def overriding_system_value -2149 clone(:override=>:system) -2150 end+2149 def overriding_system_value +2150 clone(:override=>:system) +2151 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2154 def overriding_user_value -2155 clone(:override=>:user) -2156 end+2155 def overriding_user_value +2156 clone(:override=>:user) +2157 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2158 def supports_cte?(type=:select) -2159 if type == :select -2160 server_version >= 80400 -2161 else -2162 server_version >= 90100 -2163 end -2164 end+2159 def supports_cte?(type=:select) +2160 if type == :select +2161 server_version >= 80400 +2162 else +2163 server_version >= 90100 +2164 end +2165 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2168 def supports_cte_in_subqueries? -2169 supports_cte? -2170 end+2169 def supports_cte_in_subqueries? +2170 supports_cte? +2171 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2173 def supports_distinct_on? -2174 true -2175 end+2174 def supports_distinct_on? +2175 true +2176 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2178 def supports_group_cube? -2179 server_version >= 90500 -2180 end+2179 def supports_group_cube? +2180 server_version >= 90500 +2181 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2183 def supports_group_rollup? -2184 server_version >= 90500 -2185 end+2184 def supports_group_rollup? +2185 server_version >= 90500 +2186 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2188 def supports_grouping_sets? -2189 server_version >= 90500 -2190 end+2189 def supports_grouping_sets? +2190 server_version >= 90500 +2191 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2198 def supports_insert_conflict? -2199 server_version >= 90500 -2200 end+2199 def supports_insert_conflict? +2200 server_version >= 90500 +2201 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2193 def supports_insert_select? -2194 !@opts[:disable_insert_returning] -2195 end+2194 def supports_insert_select? +2195 !@opts[:disable_insert_returning] +2196 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2203 def supports_lateral_subqueries? -2204 server_version >= 90300 -2205 end+2204 def supports_lateral_subqueries? +2205 server_version >= 90300 +2206 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2213 def supports_merge? -2214 server_version >= 150000 -2215 end+2214 def supports_merge? +2215 server_version >= 150000 +2216 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2208 def supports_modifying_joins? -2209 true -2210 end+2209 def supports_modifying_joins? +2210 true +2211 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2218 def supports_nowait? -2219 true -2220 end+2219 def supports_nowait? +2220 true +2221 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2233 def supports_regexp? -2234 true -2235 end+2234 def supports_regexp? +2235 true +2236 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2224 def supports_returning?(type) -2225 if type == :merge -2226 server_version >= 170000 -2227 else -2228 true -2229 end -2230 end+2225 def supports_returning?(type) +2226 if type == :merge +2227 server_version >= 170000 +2228 else +2229 true +2230 end +2231 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2238 def supports_skip_locked? -2239 server_version >= 90500 -2240 end+2239 def supports_skip_locked? +2240 server_version >= 90500 +2241 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2245 def supports_timestamp_timezones? -2246 # SEQUEL6: Remove -2247 true -2248 end+2246 def supports_timestamp_timezones? +2247 # SEQUEL6: Remove +2248 true +2249 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2252 def supports_window_clause? -2253 server_version >= 80400 -2254 end+2253 def supports_window_clause? +2254 server_version >= 80400 +2255 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2263 def supports_window_function_frame_option?(option) -2264 case option -2265 when :rows, :range -2266 true -2267 when :offset -2268 server_version >= 90000 -2269 when :groups, :exclude -2270 server_version >= 110000 -2271 else -2272 false -2273 end -2274 end+2264 def supports_window_function_frame_option?(option) +2265 case option +2266 when :rows, :range +2267 true +2268 when :offset +2269 server_version >= 90000 +2270 when :groups, :exclude +2271 server_version >= 110000 +2272 else +2273 false +2274 end +2275 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2257 def supports_window_functions? -2258 server_version >= 80400 -2259 end+2258 def supports_window_functions? +2259 server_version >= 80400 +2260 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2292 def truncate(opts = OPTS) -2293 if opts.empty? -2294 super() -2295 else -2296 clone(:truncate_opts=>opts).truncate -2297 end -2298 end+2293 def truncate(opts = OPTS) +2294 if opts.empty? +2295 super() +2296 else +2297 clone(:truncate_opts=>opts).truncate +2298 end +2299 end
Public Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2303 def with_ties -2304 clone(:limit_with_ties=>true) -2305 end+2304 def with_ties +2305 clone(:limit_with_ties=>true) +2306 end
Protected Instance methods
@@ -1301,18 +1301,18 @@Protected Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2313 def _import(columns, values, opts=OPTS) -2314 if @opts[:returning] -2315 # no transaction: our multi_insert_sql_strategy should guarantee -2316 # that there's only ever a single statement. -2317 sql = multi_insert_sql(columns, values)[0] -2318 returning_fetch_rows(sql).map{|v| v.length == 1 ? v.values.first : v} -2319 elsif opts[:return] == :primary_key -2320 returning(insert_pk)._import(columns, values, opts) -2321 else -2322 super -2323 end -2324 end+2314 def _import(columns, values, opts=OPTS) +2315 if @opts[:returning] +2316 # no transaction: our multi_insert_sql_strategy should guarantee +2317 # that there's only ever a single statement. +2318 sql = multi_insert_sql(columns, values)[0] +2319 returning_fetch_rows(sql).map{|v| v.length == 1 ? v.values.first : v} +2320 elsif opts[:return] == :primary_key +2321 returning(insert_pk)._import(columns, values, opts) +2322 else +2323 super +2324 end +2325 end
Protected Instance methods
[show source]# File lib/sequel/adapters/shared/postgres.rb -2326 def to_prepared_statement(type, *a) -2327 if type == :insert && !@opts.has_key?(:returning) -2328 returning(insert_pk).send(:to_prepared_statement, :insert_pk, *a) -2329 else -2330 super -2331 end -2332 end+2327 def to_prepared_statement(type, *a) +2328 if type == :insert && !@opts.has_key?(:returning) +2329 returning(insert_pk).send(:to_prepared_statement, :insert_pk, *a) +2330 else +2331 super +2332 end +2333 end
Public Instance methods
[show source] -# File lib/sequel/adapters/trilogy.rb - 94 def fetch_rows(sql) - 95 execute(sql) do |r| - 96 self.columns = r.fields.map!{|c| output_identifier(c.to_s)} - 97 r.each_hash{|h| yield h} - 98 end - 99 self -100 end+
# File lib/sequel/adapters/trilogy.rb +93 def fetch_rows(sql) +94 execute(sql) do |r| +95 self.columns = r.fields.map!{|c| output_identifier(c.to_s)} +96 r.each_hash{|h| yield h} +97 end +98 self +99 enddiff --git a/rdoc-adapters/created.rid b/rdoc-adapters/created.rid index 26a5fd827..9ce702a38 100644 --- a/rdoc-adapters/created.rid +++ b/rdoc-adapters/created.rid @@ -1,4 +1,4 @@ -Fri, 01 Nov 2024 09:23:32 -0700 +Sun, 01 Dec 2024 09:22:43 -0800 lib/sequel/adapters/ado.rb Tue, 21 Sep 2021 14:24:30 -0700 lib/sequel/adapters/ado/access.rb Tue, 21 Sep 2021 14:24:30 -0700 lib/sequel/adapters/ado/mssql.rb Mon, 28 Jan 2019 08:29:19 -0800 @@ -31,15 +31,15 @@ lib/sequel/adapters/postgresql.rb Tue, 01 Aug 2017 08:12:00 -0700 lib/sequel/adapters/shared/access.rb Wed, 21 Dec 2022 15:06:01 -0800 lib/sequel/adapters/shared/db2.rb Thu, 11 Jul 2024 11:09:22 -0700 lib/sequel/adapters/shared/mssql.rb Thu, 11 Jul 2024 11:09:22 -0700 -lib/sequel/adapters/shared/mysql.rb Fri, 05 Apr 2024 07:51:26 -0700 +lib/sequel/adapters/shared/mysql.rb Mon, 11 Nov 2024 14:55:11 -0800 lib/sequel/adapters/shared/oracle.rb Wed, 06 Dec 2023 16:41:40 -0800 -lib/sequel/adapters/shared/postgres.rb Thu, 03 Oct 2024 14:10:05 -0700 +lib/sequel/adapters/shared/postgres.rb Mon, 11 Nov 2024 14:55:11 -0800 lib/sequel/adapters/shared/sqlanywhere.rb Wed, 06 Dec 2023 16:41:40 -0800 lib/sequel/adapters/shared/sqlite.rb Thu, 22 Aug 2024 11:50:35 -0700 lib/sequel/adapters/sqlanywhere.rb Tue, 21 Sep 2021 14:24:30 -0700 lib/sequel/adapters/sqlite.rb Sun, 27 Oct 2024 20:47:17 -0700 lib/sequel/adapters/tinytds.rb Tue, 21 Sep 2021 14:24:30 -0700 -lib/sequel/adapters/trilogy.rb Thu, 04 May 2023 13:25:27 -0700 +lib/sequel/adapters/trilogy.rb Thu, 07 Nov 2024 20:43:02 -0800 lib/sequel/adapters/utils/columns_limit_1.rb Wed, 13 Oct 2021 12:18:25 -0700 lib/sequel/adapters/utils/emulate_offset_with_reverse_and_count.rb Fri, 03 Aug 2018 16:28:24 -0700 lib/sequel/adapters/utils/emulate_offset_with_row_number.rb Tue, 01 Aug 2017 08:12:00 -0700 diff --git a/rdoc-adapters/files/lib/sequel/adapters/shared/mysql_rb.html b/rdoc-adapters/files/lib/sequel/adapters/shared/mysql_rb.html index e344d1c6c..4c20dd894 100644 --- a/rdoc-adapters/files/lib/sequel/adapters/shared/mysql_rb.html +++ b/rdoc-adapters/files/lib/sequel/adapters/shared/mysql_rb.html @@ -31,7 +31,7 @@
mysql.rb
Last Update:
-2024-04-05 07:51:26 -0700
+2024-11-11 14:55:11 -0800
diff --git a/rdoc-adapters/files/lib/sequel/adapters/shared/postgres_rb.html b/rdoc-adapters/files/lib/sequel/adapters/shared/postgres_rb.html
index 9e5bc5d7d..c6baa1b04 100644
--- a/rdoc-adapters/files/lib/sequel/adapters/shared/postgres_rb.html
+++ b/rdoc-adapters/files/lib/sequel/adapters/shared/postgres_rb.html
@@ -31,7 +31,7 @@
Last Update:
-2024-10-03 14:10:05 -0700
+2024-11-11 14:55:11 -0800
diff --git a/rdoc-adapters/files/lib/sequel/adapters/trilogy_rb.html b/rdoc-adapters/files/lib/sequel/adapters/trilogy_rb.html
index ff180e7d5..65470b9a5 100644
--- a/rdoc-adapters/files/lib/sequel/adapters/trilogy_rb.html
+++ b/rdoc-adapters/files/lib/sequel/adapters/trilogy_rb.html
@@ -31,7 +31,7 @@ trilogy.rb
Last Update:
-2023-05-04 13:25:27 -0700
+2024-11-07 20:43:02 -0800
diff --git a/rdoc-plugins/classes/Sequel.html b/rdoc-plugins/classes/Sequel.html
index fa6420b2b..792cf0f08 100644
--- a/rdoc-plugins/classes/Sequel.html
+++ b/rdoc-plugins/classes/Sequel.html
@@ -224,6 +224,9 @@ module
lib/sequel/extensions/pg_row_ops.rb
+lib/sequel/extensions/pg_schema_caching.rb
+
+
lib/sequel/extensions/pg_static_cache_updater.rb
@@ -446,6 +449,9 @@ module
lib/sequel/plugins/insert_returning_select.rb
+lib/sequel/plugins/inspect_pk.rb
+
+
lib/sequel/plugins/instance_filters.rb
diff --git a/rdoc-plugins/classes/Sequel/Plugins.html b/rdoc-plugins/classes/Sequel/Plugins.html
index fb60ef211..9cd070a96 100644
--- a/rdoc-plugins/classes/Sequel/Plugins.html
+++ b/rdoc-plugins/classes/Sequel/Plugins.html
@@ -164,6 +164,9 @@ module
lib/sequel/plugins/insert_returning_select.rb
+lib/sequel/plugins/inspect_pk.rb
+
+
lib/sequel/plugins/instance_filters.rb
@@ -390,6 +393,7 @@ Classes and Modules
Sequel::Plugins::InputTransformer
Sequel::Plugins::InsertConflict
Sequel::Plugins::InsertReturningSelect
+Sequel::Plugins::InspectPk
Sequel::Plugins::InstanceFilters
Sequel::Plugins::InstanceHooks
Sequel::Plugins::InstanceSpecificDefault
diff --git a/rdoc-plugins/classes/Sequel/Plugins/InspectPk.html b/rdoc-plugins/classes/Sequel/Plugins/InspectPk.html
new file mode 100644
index 000000000..676406b3d
--- /dev/null
+++ b/rdoc-plugins/classes/Sequel/Plugins/InspectPk.html
@@ -0,0 +1,75 @@
+
+
+
+Sequel::Plugins::InspectPk
+
+
+
+
+
+
+
+
+module
+Sequel::Plugins::InspectPk
+
+
+
+
+
+
+The inspect_pk plugin includes the pk right next to the model name in inspect, allowing for easily copying and pasting to retrieve a copy of the object:
+
+Album.with_pk(1).inspect
+# default: #<Album @values={...}>
+# with inspect_pk: #<Album[1] @values={...}>
+
+
+Usage:
+
+# Make all model instances include pk in inspect output
+Sequel::Model.plugin :inspect_pk
+
+# Make Album instances include pk in inspect output
+Album.plugin :inspect_pk
+
+
+
+
+
+Classes and Modules
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rdoc-plugins/classes/Sequel/Plugins/InspectPk/InstanceMethods.html b/rdoc-plugins/classes/Sequel/Plugins/InspectPk/InstanceMethods.html
new file mode 100644
index 000000000..1caaafc5b
--- /dev/null
+++ b/rdoc-plugins/classes/Sequel/Plugins/InspectPk/InstanceMethods.html
@@ -0,0 +1,53 @@
+
+
+
+Sequel::Plugins::InspectPk::InstanceMethods
+
+
+
+
+
+
+
+
+module
+Sequel::Plugins::InspectPk::InstanceMethods
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rdoc-plugins/classes/Sequel/Postgres.html b/rdoc-plugins/classes/Sequel/Postgres.html
index 87088ab29..a27de9552 100644
--- a/rdoc-plugins/classes/Sequel/Postgres.html
+++ b/rdoc-plugins/classes/Sequel/Postgres.html
@@ -89,6 +89,9 @@ module
lib/sequel/extensions/pg_row_ops.rb
+lib/sequel/extensions/pg_schema_caching.rb
+
+
lib/sequel/extensions/pg_static_cache_updater.rb
@@ -143,6 +146,7 @@ Classes and Modules
Sequel::Postgres::LooseCount
Sequel::Postgres::PGRow
Sequel::Postgres::RangeOpMethods
+Sequel::Postgres::SchemaCaching
Sequel::Postgres::StaticCacheUpdater
Sequel::Postgres::Timestamptz
Sequel::Postgres::TimestamptzDatasetMethods
diff --git a/rdoc-plugins/classes/Sequel/Postgres/SchemaCaching.html b/rdoc-plugins/classes/Sequel/Postgres/SchemaCaching.html
new file mode 100644
index 000000000..9d9152ca5
--- /dev/null
+++ b/rdoc-plugins/classes/Sequel/Postgres/SchemaCaching.html
@@ -0,0 +1,59 @@
+
+
+
+Sequel::Postgres::SchemaCaching
+
+
+
+
+
+
+
+
+module
+Sequel::Postgres::SchemaCaching
+
+
+
+
+
+
+
+
+Included modules
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rdoc-plugins/classes/Sequel/SchemaCaching.html b/rdoc-plugins/classes/Sequel/SchemaCaching.html
index 37dd37363..bd3c5267e 100644
--- a/rdoc-plugins/classes/Sequel/SchemaCaching.html
+++ b/rdoc-plugins/classes/Sequel/SchemaCaching.html
@@ -68,17 +68,10 @@ Public Instance methods
# File lib/sequel/extensions/schema_caching.rb
53 def dump_schema_cache(file)
-54 sch = {}
-55 @schemas.sort.each do |k,v|
-56 sch[k] = v.map do |c, h|
-57 h = Hash[h]
-58 h.delete(:callable_default)
-59 [c, h]
-60 end
-61 end
-62 File.open(file, 'wb'){|f| f.write(Marshal.dump(sch))}
-63 nil
-64 end
+54 sch = dumpable_schema_cache
+55 File.open(file, 'wb'){|f| f.write(Marshal.dump(sch))}
+56 nil
+57 end
@@ -97,9 +90,9 @@ Public Instance methods
[show source]
# File lib/sequel/extensions/schema_caching.rb
-68 def dump_schema_cache?(file)
-69 dump_schema_cache(file) unless File.exist?(file)
-70 end
+61 def dump_schema_cache?(file)
+62 dump_schema_cache(file) unless File.exist?(file)
+63 end
@@ -118,11 +111,11 @@ Public Instance methods
[show source]
# File lib/sequel/extensions/schema_caching.rb
-74 def load_schema_cache(file)
-75 @schemas = Marshal.load(File.read(file))
-76 @schemas.each_value{|v| schema_post_process(v)}
-77 nil
-78 end
+67 def load_schema_cache(file)
+68 @schemas = load_schema_cache_file(file)
+69 @schemas.each_value{|v| schema_post_process(v)}
+70 nil
+71 end
@@ -141,9 +134,9 @@ Public Instance methods
[show source]
# File lib/sequel/extensions/schema_caching.rb
-82 def load_schema_cache?(file)
-83 load_schema_cache(file) if File.exist?(file)
-84 end
+75 def load_schema_cache?(file)
+76 load_schema_cache(file) if File.exist?(file)
+77 end
diff --git a/rdoc-plugins/created.rid b/rdoc-plugins/created.rid
index 2ac5a8e13..deba6fca1 100644
--- a/rdoc-plugins/created.rid
+++ b/rdoc-plugins/created.rid
@@ -1,4 +1,4 @@
-Fri, 01 Nov 2024 09:23:36 -0700
+Sun, 01 Dec 2024 09:22:46 -0800
lib/sequel/extensions/_model_constraint_validations.rb Tue, 24 Jan 2017 12:27:29 -0800
lib/sequel/extensions/_model_pg_row.rb Tue, 11 Oct 2022 13:37:12 -0700
lib/sequel/extensions/_pretty_table.rb Mon, 17 Oct 2022 09:39:14 -0700
@@ -47,7 +47,7 @@ lib/sequel/extensions/null_dataset.rb Fri, 08 Dec 2017 12:55:50 -0800
lib/sequel/extensions/pagination.rb Tue, 21 Sep 2021 14:24:30 -0700
lib/sequel/extensions/pg_array.rb Wed, 06 Dec 2023 16:41:40 -0800
lib/sequel/extensions/pg_array_ops.rb Fri, 02 Sep 2022 09:11:30 -0700
-lib/sequel/extensions/pg_auto_parameterize.rb Mon, 23 Jan 2023 17:12:11 -0800
+lib/sequel/extensions/pg_auto_parameterize.rb Mon, 04 Nov 2024 16:30:04 -0800
lib/sequel/extensions/pg_auto_parameterize_in_array.rb Tue, 08 Aug 2023 15:45:53 -0700
lib/sequel/extensions/pg_enum.rb Thu, 13 Apr 2023 12:51:52 -0700
lib/sequel/extensions/pg_extended_date_support.rb Wed, 06 Dec 2023 16:41:40 -0800
@@ -65,6 +65,7 @@ lib/sequel/extensions/pg_range.rb Wed, 06 Dec 2023 16:41:40 -0800
lib/sequel/extensions/pg_range_ops.rb Sat, 18 Dec 2021 12:49:34 -0800
lib/sequel/extensions/pg_row.rb Thu, 13 Apr 2023 12:51:52 -0700
lib/sequel/extensions/pg_row_ops.rb Sat, 18 Dec 2021 12:49:34 -0800
+lib/sequel/extensions/pg_schema_caching.rb Thu, 14 Nov 2024 15:28:58 -0800
lib/sequel/extensions/pg_static_cache_updater.rb Fri, 02 Sep 2022 09:11:30 -0700
lib/sequel/extensions/pg_timestamptz.rb Wed, 06 Dec 2023 16:41:40 -0800
lib/sequel/extensions/pretty_table.rb Thu, 11 Feb 2016 15:50:14 -0800
@@ -73,7 +74,7 @@ lib/sequel/extensions/query.rb Wed, 02 Dec 2020 15:37:08 -0800
lib/sequel/extensions/round_timestamps.rb Wed, 06 Dec 2023 16:41:40 -0800
lib/sequel/extensions/run_transaction_hooks.rb Wed, 01 Jul 2020 11:28:34 -0700
lib/sequel/extensions/s.rb Sat, 18 Dec 2021 12:49:34 -0800
-lib/sequel/extensions/schema_caching.rb Thu, 17 Aug 2023 13:01:31 -0700
+lib/sequel/extensions/schema_caching.rb Thu, 14 Nov 2024 15:28:58 -0800
lib/sequel/extensions/schema_dumper.rb Tue, 08 Oct 2024 15:47:24 -0700
lib/sequel/extensions/select_remove.rb Tue, 01 Aug 2017 08:12:01 -0700
lib/sequel/extensions/sequel_4_dataset_methods.rb Thu, 10 Jan 2019 07:53:39 -0800
@@ -84,7 +85,7 @@ lib/sequel/extensions/split_array_nil.rb Tue, 01 Aug 2017 08:12:01 -0700
lib/sequel/extensions/sql_comments.rb Tue, 01 Feb 2022 08:07:06 -0800
lib/sequel/extensions/sql_expr.rb Fri, 14 Oct 2016 13:06:50 -0700
lib/sequel/extensions/sql_log_normalizer.rb Mon, 11 Oct 2021 08:09:16 -0700
-lib/sequel/extensions/sqlite_json_ops.rb Wed, 21 Feb 2024 09:59:48 -0800
+lib/sequel/extensions/sqlite_json_ops.rb Thu, 21 Nov 2024 08:27:20 -0800
lib/sequel/extensions/stdio_logger.rb Mon, 01 Jul 2024 16:32:10 -0700
lib/sequel/extensions/string_agg.rb Tue, 23 Jul 2024 12:20:12 -0700
lib/sequel/extensions/string_date_time.rb Fri, 17 Dec 2021 16:59:47 -0800
@@ -141,6 +142,7 @@ lib/sequel/plugins/hook_class_methods.rb Tue, 23 Apr 2019 16:34:31 -0700
lib/sequel/plugins/input_transformer.rb Mon, 20 May 2024 16:45:35 -0700
lib/sequel/plugins/insert_conflict.rb Fri, 02 Sep 2022 09:11:30 -0700
lib/sequel/plugins/insert_returning_select.rb Tue, 01 Aug 2017 08:12:01 -0700
+lib/sequel/plugins/inspect_pk.rb Fri, 08 Nov 2024 13:09:48 -0800
lib/sequel/plugins/instance_filters.rb Tue, 01 Aug 2017 08:12:01 -0700
lib/sequel/plugins/instance_hooks.rb Tue, 01 Aug 2017 08:12:01 -0700
lib/sequel/plugins/instance_specific_default.rb Wed, 13 Apr 2022 08:45:21 -0700
diff --git a/rdoc-plugins/files/lib/sequel/extensions/pg_auto_parameterize_rb.html b/rdoc-plugins/files/lib/sequel/extensions/pg_auto_parameterize_rb.html
index c9cb1f892..c9f335690 100644
--- a/rdoc-plugins/files/lib/sequel/extensions/pg_auto_parameterize_rb.html
+++ b/rdoc-plugins/files/lib/sequel/extensions/pg_auto_parameterize_rb.html
@@ -31,7 +31,7 @@ pg_auto_parameterize.rb
Last Update:
-2023-01-23 17:12:11 -0800
+2024-11-04 16:30:04 -0800
diff --git a/rdoc-plugins/files/lib/sequel/extensions/pg_schema_caching_rb.html b/rdoc-plugins/files/lib/sequel/extensions/pg_schema_caching_rb.html
new file mode 100644
index 000000000..f2305e646
--- /dev/null
+++ b/rdoc-plugins/files/lib/sequel/extensions/pg_schema_caching_rb.html
@@ -0,0 +1,58 @@
+
+
+
+pg_schema_caching.rb
+
+
+
+
+
+
+
+
+pg_schema_caching.rb
+
+
+lib/sequel/extensions/pg_schema_caching.rb
+
+
+Last Update:
+2024-11-14 15:28:58 -0800
+
+
+
+
+
+The pg_schema_caching extension builds on top of the schema_caching extension, and allows it to handle custom PostgreSQL types. On PostgreSQL, column schema hashes include an :oid entry for the OID for the column’s type. For custom types, this OID is dependent on the PostgreSQL database, so in most cases, test and development versions of the same database, created with the same migrations, will have different OIDs.
+
+To fix this case, the pg_schema_caching extension removes custom OIDs from the schema cache when dumping the schema, replacing them with a placeholder. When loading the cached schema, the Database object makes a single query to get the OIDs for all custom types used by the cached schema, and it updates all related column schema hashes to set the correct :oid entry for the current database.
+
+Related module: Sequel::Postgres::SchemaCaching
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rdoc-plugins/files/lib/sequel/extensions/schema_caching_rb.html b/rdoc-plugins/files/lib/sequel/extensions/schema_caching_rb.html
index 9d1b11dd5..385668a85 100644
--- a/rdoc-plugins/files/lib/sequel/extensions/schema_caching_rb.html
+++ b/rdoc-plugins/files/lib/sequel/extensions/schema_caching_rb.html
@@ -31,7 +31,7 @@ schema_caching.rb
Last Update:
-2023-08-17 13:01:31 -0700
+2024-11-14 15:28:58 -0800
diff --git a/rdoc-plugins/files/lib/sequel/extensions/sqlite_json_ops_rb.html b/rdoc-plugins/files/lib/sequel/extensions/sqlite_json_ops_rb.html
index 922bae6f3..a5ef47666 100644
--- a/rdoc-plugins/files/lib/sequel/extensions/sqlite_json_ops_rb.html
+++ b/rdoc-plugins/files/lib/sequel/extensions/sqlite_json_ops_rb.html
@@ -31,7 +31,7 @@ sqlite_json_ops.rb
Last Update:
-2024-02-21 09:59:48 -0800
+2024-11-21 08:27:20 -0800
@@ -66,7 +66,7 @@ sqlite_json_ops.rb
j[1] # (json_column ->> 1)
j.get(1) # (json_column ->> 1)
-j.get_text(1) # (json_column -> 1)
+j.get_json(1) # (json_column -> 1)
j.extract('$.a') # json_extract(json_column, '$.a')
jb.extract('$.a') # jsonb_extract(jsonb_column, '$.a')
diff --git a/rdoc-plugins/files/lib/sequel/plugins/inspect_pk_rb.html b/rdoc-plugins/files/lib/sequel/plugins/inspect_pk_rb.html
new file mode 100644
index 000000000..b2f9d1913
--- /dev/null
+++ b/rdoc-plugins/files/lib/sequel/plugins/inspect_pk_rb.html
@@ -0,0 +1,52 @@
+
+
+
+inspect_pk.rb
+
+
+
+
+
+
+
+
+inspect_pk.rb
+
+
+lib/sequel/plugins/inspect_pk.rb
+
+
+Last Update:
+2024-11-08 13:09:48 -0800
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rdoc-plugins/fr_class_index.html b/rdoc-plugins/fr_class_index.html
index 208337eda..f4f561250 100644
--- a/rdoc-plugins/fr_class_index.html
+++ b/rdoc-plugins/fr_class_index.html
@@ -215,6 +215,8 @@
Sequel::Plugins::InsertReturningSelect
Sequel::Plugins::InsertReturningSelect::ClassMethods
Sequel::Plugins::InsertReturningSelect::InstanceMethods
+Sequel::Plugins::InstanceHooks
@@ -444,6 +446,7 @@
Sequel::Postgres::PGRowOp::ExpressionMethods
Sequel::Postgres::RangeOp
Sequel::Postgres::RangeOpMethods
+Sequel::Postgres::SchemaCaching
Sequel::Postgres::StaticCacheUpdater
Sequel::Postgres::Timestamptz
Sequel::Postgres::TimestamptzDatasetMethods
diff --git a/rdoc-plugins/fr_file_index.html b/rdoc-plugins/fr_file_index.html
index e2508329f..f73a11271 100644
--- a/rdoc-plugins/fr_file_index.html
+++ b/rdoc-plugins/fr_file_index.html
@@ -77,6 +77,7 @@
pg_range_ops.rb
pg_row.rb
pg_row_ops.rb
+pg_schema_caching.rb
pg_static_cache_updater.rb
pg_timestamptz.rb
pretty_table.rb
@@ -153,6 +154,7 @@
input_transformer.rb
insert_conflict.rb
insert_returning_select.rb
+inspect_pk.rb
instance_filters.rb
instance_hooks.rb
instance_specific_default.rb
diff --git a/rdoc/classes/Sequel.html b/rdoc/classes/Sequel.html
index 5cbbeecab..bbf3dc9b6 100644
--- a/rdoc/classes/Sequel.html
+++ b/rdoc/classes/Sequel.html
@@ -434,7 +434,7 @@ Constants
MINOR
=
-86
+87
The minor version of Sequel
. Bumped for every non-patch level release, generally around once a month.
diff --git a/rdoc/classes/Sequel/Database.html b/rdoc/classes/Sequel/Database.html
index 95cab74ba..509e5c85c 100644
--- a/rdoc/classes/Sequel/Database.html
+++ b/rdoc/classes/Sequel/Database.html
@@ -2905,18 +2905,22 @@ Public Instance methods
# File lib/sequel/database/misc.rb
248 def extension(*exts)
-249 Sequel.extension(*exts)
-250 exts.each do |ext|
-251 if pr = Sequel.synchronize{EXTENSIONS[ext]}
-252 if Sequel.synchronize{@loaded_extensions.include?(ext) ? false : (@loaded_extensions << ext)}
-253 pr.call(self)
-254 end
-255 else
-256 raise(Error, "Extension #{ext} does not have specific support handling individual databases (try: Sequel.extension #{ext.inspect})")
-257 end
-258 end
-259 self
-260 end
+249 exts.each do |ext|
+250 unless pr = Sequel.synchronize{EXTENSIONS[ext]}
+251 Sequel.extension(ext)
+252 pr = Sequel.synchronize{EXTENSIONS[ext]}
+253 end
+254
+255 if pr
+256 if Sequel.synchronize{@loaded_extensions.include?(ext) ? false : (@loaded_extensions << ext)}
+257 pr.call(self)
+258 end
+259 else
+260 raise(Error, "Extension #{ext} does not have specific support handling individual databases (try: Sequel.extension #{ext.inspect})")
+261 end
+262 end
+263 self
+264 end
@@ -2966,9 +2970,9 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-265 def from_application_timestamp(v)
-266 Sequel.convert_output_timestamp(v, timezone)
-267 end
+269 def from_application_timestamp(v)
+270 Sequel.convert_output_timestamp(v, timezone)
+271 end
@@ -2987,26 +2991,26 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-271 def inspect
-272 s = String.new
-273 s << "#<#{self.class}"
-274 s << " database_type=#{database_type}" if database_type && database_type != adapter_scheme
-275
-276 keys = [:host, :database, :user]
-277 opts = self.opts
-278 if !keys.any?{|k| opts[k]} && opts[:uri]
-279 opts = self.class.send(:options_from_uri, URI.parse(opts[:uri]))
-280 end
-281
-282 keys.each do |key|
-283 val = opts[key]
-284 if val && val != ''
-285 s << " #{key}=#{val}"
-286 end
-287 end
-288
-289 s << ">"
-290 end
+275 def inspect
+276 s = String.new
+277 s << "#<#{self.class}"
+278 s << " database_type=#{database_type}" if database_type && database_type != adapter_scheme
+279
+280 keys = [:host, :database, :user]
+281 opts = self.opts
+282 if !keys.any?{|k| opts[k]} && opts[:uri]
+283 opts = self.class.send(:options_from_uri, URI.parse(opts[:uri]))
+284 end
+285
+286 keys.each do |key|
+287 val = opts[key]
+288 if val && val != ''
+289 s << " #{key}=#{val}"
+290 end
+291 end
+292
+293 s << ">"
+294 end
@@ -3030,9 +3034,9 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-297 def literal(v)
-298 schema_utility_dataset.literal(v)
-299 end
+301 def literal(v)
+302 schema_utility_dataset.literal(v)
+303 end
@@ -3051,9 +3055,9 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-303 def literal_symbol(sym)
-304 Sequel.synchronize{@symbol_literal_cache[sym]}
-305 end
+307 def literal_symbol(sym)
+308 Sequel.synchronize{@symbol_literal_cache[sym]}
+309 end
@@ -3072,9 +3076,9 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-308 def literal_symbol_set(sym, lit)
-309 Sequel.synchronize{@symbol_literal_cache[sym] = lit}
-310 end
+312 def literal_symbol_set(sym, lit)
+313 Sequel.synchronize{@symbol_literal_cache[sym] = lit}
+314 end
@@ -3093,9 +3097,9 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-313 def prepared_statement(name)
-314 Sequel.synchronize{prepared_statements[name]}
-315 end
+317 def prepared_statement(name)
+318 Sequel.synchronize{prepared_statements[name]}
+319 end
@@ -3114,9 +3118,9 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-320 def quote_identifier(v)
-321 schema_utility_dataset.quote_identifier(v)
-322 end
+324 def quote_identifier(v)
+325 schema_utility_dataset.quote_identifier(v)
+326 end
@@ -3135,9 +3139,9 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-325 def schema_type_class(type)
-326 @schema_type_classes[type]
-327 end
+329 def schema_type_class(type)
+330 @schema_type_classes[type]
+331 end
@@ -3156,9 +3160,9 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-330 def serial_primary_key_options
-331 {:primary_key => true, :type => Integer, :auto_increment => true}
-332 end
+334 def serial_primary_key_options
+335 {:primary_key => true, :type => Integer, :auto_increment => true}
+336 end
@@ -3177,9 +3181,9 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-335 def set_prepared_statement(name, ps)
-336 Sequel.synchronize{prepared_statements[name] = ps}
-337 end
+339 def set_prepared_statement(name, ps)
+340 Sequel.synchronize{prepared_statements[name] = ps}
+341 end
@@ -3198,9 +3202,9 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-341 def sharded?
-342 @sharded
-343 end
+345 def sharded?
+346 @sharded
+347 end
@@ -3219,9 +3223,9 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-346 def timezone
-347 @timezone || Sequel.database_timezone
-348 end
+350 def timezone
+351 @timezone || Sequel.database_timezone
+352 end
@@ -3240,9 +3244,9 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-353 def to_application_timestamp(v)
-354 Sequel.convert_timestamp(v, timezone)
-355 end
+357 def to_application_timestamp(v)
+358 Sequel.convert_timestamp(v, timezone)
+359 end
@@ -3261,16 +3265,16 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-362 def typecast_value(column_type, value)
-363 return nil if value.nil?
-364 meth = "typecast_value_#{column_type}"
-365 begin
-366 # Allow calling private methods as per-type typecasting methods are private
-367 respond_to?(meth, true) ? send(meth, value) : value
-368 rescue ArgumentError, TypeError => e
-369 raise Sequel.convert_exception_class(e, InvalidValue)
-370 end
-371 end
+366 def typecast_value(column_type, value)
+367 return nil if value.nil?
+368 meth = "typecast_value_#{column_type}"
+369 begin
+370 # Allow calling private methods as per-type typecasting methods are private
+371 respond_to?(meth, true) ? send(meth, value) : value
+372 rescue ArgumentError, TypeError => e
+373 raise Sequel.convert_exception_class(e, InvalidValue)
+374 end
+375 end
@@ -3289,9 +3293,9 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-375 def uri
-376 opts[:uri]
-377 end
+379 def uri
+380 opts[:uri]
+381 end
@@ -3310,9 +3314,9 @@ Public Instance methods
[show source]
# File lib/sequel/database/misc.rb
-380 def url
-381 uri
-382 end
+384 def url
+385 uri
+386 end
diff --git a/rdoc/classes/Sequel/Dataset.html b/rdoc/classes/Sequel/Dataset.html
index 9eeece884..b97575d4f 100644
--- a/rdoc/classes/Sequel/Dataset.html
+++ b/rdoc/classes/Sequel/Dataset.html
@@ -739,7 +739,7 @@ Public Instance methods
# File lib/sequel/dataset/query.rb
206 def extension(*exts)
-207 Sequel.extension(*exts)
+207 exts.each{|ext| Sequel.extension(ext) unless Sequel.synchronize{EXTENSIONS[ext]}}
208 mods = exts.map{|ext| Sequel.synchronize{EXTENSION_MODULES[ext]}}
209 if mods.all?
210 with_extend(*mods)
diff --git a/rdoc/classes/Sequel/Model/ClassMethods.html b/rdoc/classes/Sequel/Model/ClassMethods.html
index f0faa39da..1152617e5 100644
--- a/rdoc/classes/Sequel/Model/ClassMethods.html
+++ b/rdoc/classes/Sequel/Model/ClassMethods.html
@@ -243,7 +243,7 @@ Attributes
[R]
-Should be the literal table name if this Model’s dataset is a simple table (no select, order, join, etc.), or nil otherwise. This and simple_pk
are used for an optimization in Model.[].
+Should be the literal table name if this Model’s dataset is a simple table (no select, order, join, etc.), or nil otherwise. This and simple_pk
are used for an optimization in Model[].
@@ -760,7 +760,7 @@ Public Instance methods
-Finds a single record according to the supplied filter. You are encouraged to use Model.[] or Model.first instead of this method.
+Finds a single record according to the supplied filter. You are encouraged to use Model[] or Model.first instead of this method.
Artist.find(name: 'Bob')
# SELECT * FROM artists WHERE (name = 'Bob') LIMIT 1
diff --git a/rdoc/classes/Sequel/Model/DatasetMethods.html b/rdoc/classes/Sequel/Model/DatasetMethods.html
index fcab56f99..5bcffa9d2 100644
--- a/rdoc/classes/Sequel/Model/DatasetMethods.html
+++ b/rdoc/classes/Sequel/Model/DatasetMethods.html
@@ -77,13 +77,13 @@ Public Instance methods
[show source]
# File lib/sequel/model/base.rb
-2138 def [](*args)
-2139 if args.length == 1 && (i = args[0]) && i.is_a?(Integer)
-2140 with_pk(i)
-2141 else
-2142 super
-2143 end
-2144 end
+2143 def [](*args)
+2144 if args.length == 1 && (i = args[0]) && i.is_a?(Integer)
+2145 with_pk(i)
+2146 else
+2147 super
+2148 end
+2149 end
@@ -108,14 +108,14 @@ Public Instance methods
[show source]
# File lib/sequel/model/base.rb
-2198 def as_hash(key_column=nil, value_column=nil, opts=OPTS)
-2199 if key_column
-2200 super
-2201 else
-2202 raise(Sequel::Error, "No primary key for model") unless model && (pk = model.primary_key)
-2203 super(pk, value_column, opts)
-2204 end
-2205 end
+2203 def as_hash(key_column=nil, value_column=nil, opts=OPTS)
+2204 if key_column
+2205 super
+2206 else
+2207 raise(Sequel::Error, "No primary key for model") unless model && (pk = model.primary_key)
+2208 super(pk, value_column, opts)
+2209 end
+2210 end
@@ -140,11 +140,11 @@ Public Instance methods
[show source]
# File lib/sequel/model/base.rb
-2155 def destroy
-2156 @db.transaction(:server=>opts[:server], :skip_transaction=>model.use_transactions == false) do
-2157 all(&:destroy).length
-2158 end
-2159 end
+2160 def destroy
+2161 @db.transaction(:server=>opts[:server], :skip_transaction=>model.use_transactions == false) do
+2162 all(&:destroy).length
+2163 end
+2164 end
@@ -167,13 +167,13 @@ Public Instance methods
[show source]
# File lib/sequel/model/base.rb
-2166 def last(*a, &block)
-2167 if ds = _primary_key_order
-2168 ds.last(*a, &block)
-2169 else
-2170 super
-2171 end
-2172 end
+2171 def last(*a, &block)
+2172 if ds = _primary_key_order
+2173 ds.last(*a, &block)
+2174 else
+2175 super
+2176 end
+2177 end
@@ -195,9 +195,9 @@ Public Instance methods
[show source]
# File lib/sequel/model/base.rb
-2130 def model
-2131 @opts[:model]
-2132 end
+2135 def model
+2136 @opts[:model]
+2137 end
@@ -223,13 +223,13 @@ Public Instance methods
[show source]
# File lib/sequel/model/base.rb
-2182 def paged_each(*a, &block)
-2183 if ds = _primary_key_order
-2184 ds.paged_each(*a, &block)
-2185 else
-2186 super
-2187 end
-2188 end
+2187 def paged_each(*a, &block)
+2188 if ds = _primary_key_order
+2189 ds.paged_each(*a, &block)
+2190 else
+2191 super
+2192 end
+2193 end
@@ -248,9 +248,9 @@ Public Instance methods
[show source]
# File lib/sequel/model/base.rb
-2208 def to_hash(*a)
-2209 as_hash(*a)
-2210 end
+2213 def to_hash(*a)
+2214 as_hash(*a)
+2215 end
@@ -278,13 +278,13 @@ Public Instance methods
[show source]
# File lib/sequel/model/base.rb
-2222 def with_pk(pk)
-2223 if pk && (loader = _with_pk_loader)
-2224 loader.first(*pk)
-2225 else
-2226 first(model.qualified_primary_key_hash(pk))
-2227 end
-2228 end
+2227 def with_pk(pk)
+2228 if pk && (loader = _with_pk_loader)
+2229 loader.first(*pk)
+2230 else
+2231 first(model.qualified_primary_key_hash(pk))
+2232 end
+2233 end
@@ -303,9 +303,9 @@ Public Instance methods
[show source]
# File lib/sequel/model/base.rb
-2232 def with_pk!(pk)
-2233 with_pk(pk) || raise(NoMatchingRow.new(self))
-2234 end
+2237 def with_pk!(pk)
+2238 with_pk(pk) || raise(NoMatchingRow.new(self))
+2239 end
diff --git a/rdoc/classes/Sequel/Model/InstanceMethods.html b/rdoc/classes/Sequel/Model/InstanceMethods.html
index 28a509807..2b8695b8d 100644
--- a/rdoc/classes/Sequel/Model/InstanceMethods.html
+++ b/rdoc/classes/Sequel/Model/InstanceMethods.html
@@ -653,7 +653,7 @@ Public Instance methods
# File lib/sequel/model/base.rb
1313 def inspect
-1314 "#<#{model.name} @values=#{inspect_values}>"
+1314 "#<#{inspect_prefix} @values=#{inspect_values}>"
1315 end
diff --git a/rdoc/created.rid b/rdoc/created.rid
index 85a7a9b3e..fc562c1b6 100644
--- a/rdoc/created.rid
+++ b/rdoc/created.rid
@@ -1,6 +1,6 @@
-Fri, 01 Nov 2024 09:22:58 -0700
+Sun, 01 Dec 2024 09:22:09 -0800
README.rdoc Sun, 31 Mar 2024 10:39:03 -0700
-CHANGELOG Fri, 01 Nov 2024 09:04:27 -0700
+CHANGELOG Sun, 01 Dec 2024 09:13:44 -0800
doc/CHANGELOG.old Tue, 04 Aug 2020 18:11:34 -0700
MIT-LICENSE Tue, 03 Jan 2023 11:20:51 -0800
lib/sequel.rb Tue, 01 Aug 2017 08:12:00 -0700
@@ -14,7 +14,7 @@ lib/sequel/exceptions.rb Fri, 02 Feb 2024 13:06:09 -0800
lib/sequel/model.rb Tue, 04 Aug 2020 18:11:34 -0700
lib/sequel/sql.rb Thu, 22 Aug 2024 11:50:35 -0700
lib/sequel/timezones.rb Fri, 17 Dec 2021 16:59:47 -0800
-lib/sequel/version.rb Fri, 01 Nov 2024 09:04:27 -0700
+lib/sequel/version.rb Sun, 01 Dec 2024 09:13:44 -0800
lib/sequel/connection_pool/sharded_single.rb Fri, 17 Dec 2021 16:59:47 -0800
lib/sequel/connection_pool/sharded_threaded.rb Fri, 28 Jun 2024 09:03:32 -0700
lib/sequel/connection_pool/sharded_timed_queue.rb Mon, 12 Jun 2023 13:05:49 -0700
@@ -26,7 +26,7 @@ lib/sequel/database/dataset.rb Tue, 28 Mar 2023 14:16:05 -0700
lib/sequel/database/dataset_defaults.rb Tue, 01 Aug 2017 08:12:00 -0700
lib/sequel/database/features.rb Tue, 01 Aug 2017 08:12:00 -0700
lib/sequel/database/logging.rb Fri, 30 Aug 2019 08:15:18 -0700
-lib/sequel/database/misc.rb Tue, 08 Oct 2024 08:28:45 -0700
+lib/sequel/database/misc.rb Thu, 07 Nov 2024 12:36:23 -0800
lib/sequel/database/query.rb Wed, 21 Dec 2022 15:06:01 -0800
lib/sequel/database/schema_generator.rb Tue, 28 Mar 2023 07:40:44 -0700
lib/sequel/database/schema_methods.rb Thu, 22 Aug 2024 11:50:35 -0700
@@ -39,10 +39,10 @@ lib/sequel/dataset/graph.rb Thu, 04 Apr 2024 14:06:41 -0700
lib/sequel/dataset/misc.rb Mon, 23 Jan 2023 11:36:37 -0800
lib/sequel/dataset/placeholder_literalizer.rb Mon, 23 Jan 2023 11:36:37 -0800
lib/sequel/dataset/prepared_statements.rb Wed, 02 Dec 2020 15:37:08 -0800
-lib/sequel/dataset/query.rb Thu, 04 Apr 2024 14:06:41 -0700
+lib/sequel/dataset/query.rb Thu, 07 Nov 2024 12:36:23 -0800
lib/sequel/dataset/sql.rb Mon, 01 Jul 2024 16:32:10 -0700
lib/sequel/model/associations.rb Fri, 19 Jan 2024 15:26:00 -0800
-lib/sequel/model/base.rb Fri, 11 Oct 2024 15:23:17 -0700
+lib/sequel/model/base.rb Fri, 08 Nov 2024 13:09:48 -0800
lib/sequel/model/dataset_module.rb Fri, 11 Oct 2024 15:23:15 -0700
lib/sequel/model/default_inflections.rb Tue, 01 Aug 2017 08:12:01 -0700
lib/sequel/model/errors.rb Mon, 09 Aug 2021 13:30:01 -0700
@@ -70,7 +70,7 @@ doc/opening_databases.rdoc Sun, 27 Oct 2024 20:44:24 -0700
doc/postgresql.rdoc Fri, 21 Oct 2022 08:19:04 -0700
doc/prepared_statements.rdoc Tue, 01 Aug 2017 08:12:00 -0700
doc/querying.rdoc Fri, 06 Sep 2024 09:53:34 -0700
-doc/reflection.rdoc Tue, 01 Aug 2017 08:12:00 -0700
+doc/reflection.rdoc Mon, 11 Nov 2024 14:55:11 -0800
doc/schema_modification.rdoc Thu, 01 Feb 2024 15:00:17 -0800
doc/security.rdoc Fri, 21 Oct 2022 08:19:04 -0700
doc/sharding.rdoc Fri, 26 May 2023 07:47:08 -0700
@@ -283,5 +283,6 @@ doc/release_notes/5.83.0.txt Thu, 08 Aug 2024 09:05:13 -0700
doc/release_notes/5.84.0.txt Thu, 29 Aug 2024 16:43:54 -0700
doc/release_notes/5.85.0.txt Tue, 01 Oct 2024 08:44:47 -0700
doc/release_notes/5.86.0.txt Fri, 01 Nov 2024 09:04:27 -0700
+doc/release_notes/5.87.0.txt Sun, 01 Dec 2024 09:13:44 -0800
doc/release_notes/5.9.0.txt Fri, 01 Jun 2018 07:49:41 -0700
lib/sequel/extensions/migration.rb Fri, 02 Feb 2024 13:06:09 -0800
diff --git a/rdoc/files/CHANGELOG.html b/rdoc/files/CHANGELOG.html
index d52b047c7..a15242037 100644
--- a/rdoc/files/CHANGELOG.html
+++ b/rdoc/files/CHANGELOG.html
@@ -31,12 +31,27 @@ CHANGELOG
Last Update:
-2024-11-01 09:04:27 -0700
+2024-12-01 09:13:44 -0800
+5.87.0 (2024-12-01)¶ ↑
+-
+
Add pg_schema_caching extension, for reloading OIDs for custom types when loading cached schema (jeremyevans)
+ -
+
Make Database#schema hashes include :comment field on MySQL and PostgreSQL (Bahanix) (#2248, #2249)
+ -
+
Add inspect_pk plugin to make it easier to retrieve model instance based on inspect output (jeremyevans)
+ -
+
Treat all Trilogy errors with error code 1205 as Sequel::DatabaseLockTimeout in the trilogy adapter (jeremyevans)
+ -
+
Allow Data{base,set}#extension to not require files if the extension is already registered (jeremyevans) (#2246)
+ -
+
Do not limit imports to 40 rows at a time if using pg_auto_parameterize extension with the no_auto_parameterize method (davekaro) (#2242)
+
+
5.86.0 (2024-11-01)¶ ↑
-
Support the :disable_dqs Database option in the sqlite adapter to disable treating double quoted values as strings (jeremyevans) (#2233)
diff --git a/rdoc/files/doc/reflection_rdoc.html b/rdoc/files/doc/reflection_rdoc.html
index 2f26ca134..8eeac50b2 100644
--- a/rdoc/files/doc/reflection_rdoc.html
+++ b/rdoc/files/doc/reflection_rdoc.html
@@ -31,7 +31,7 @@ reflection.rdoc
Last Update:
-2017-08-01 08:12:00 -0700
+2024-11-11 14:55:11 -0800
@@ -110,6 +110,8 @@ Column Information for a TableDatabase#schema takes a table symbol and returns column information in an array with each element being an array with two elements. The first elements of the subarray is a column symbol, and the second element is a hash of information about that column. The hash should include the following keys:
:allow_null
Whether NULL/nil is an allowed value for this column. Used by the Sequel::Model
typecasting code.
+ :comment
+The comment on the column (MySQL and PostreSQL only).
:db_type
The type of column the database provided, as a string. Used by the schema_dumper plugin for a more specific type translation.
:default
diff --git a/rdoc/files/doc/release_notes/5_87_0_txt.html b/rdoc/files/doc/release_notes/5_87_0_txt.html
new file mode 100644
index 000000000..e39d9db9e
--- /dev/null
+++ b/rdoc/files/doc/release_notes/5_87_0_txt.html
@@ -0,0 +1,77 @@
+
+
+
+5.87.0.txt
+
+
+
+
+
+
+
+
+5.87.0.txt
+
+
+doc/release_notes/5.87.0.txt
+
+
+Last Update:
+2024-12-01 09:13:44 -0800
+
+
+
+
+
+New Features¶ ↑
+-
+
Column schema hashes on MySQL and PostgreSQL now include the comment on the column in the :comment entry.
+ -
+
An inspect_pk plugin has been added, which makes the inspect output include the primary key next to the class name, so that you can copy and paste the inspect output to return the model object:
+
+Album.with_pk(1).inspect
+# default: #<Album @values={...}>
+# with inspect_pk: #<Album[1] @values={...}>
+
+ -
+
A pg_schema_caching extension has been added. This builds on top of the schema_caching extension, and handles OIDs for custom types.
+
+Type OIDs are included in column schema hashes on PostgreSQL. The OIDs are static for built-in types, but dynamic for custom types. The pg_schema_caching extension will perform a query to get the type OIDs for the custom types after loading the cached schema.
+
+
+Other Improvements¶ ↑
+-
+
Database#extension and Dataset#extension no longer attempt to require the extension file if the extension has already been registered. This is how model plugins work, and makes it easier for applications to use custom extensions without messing with the load path.
+ -
+
When using the pg_auto_parameterize extension, and using Dataset#no_auto_parameterize, Dataset#import is no longer limited to inserting 40 rows at a time.
+ -
+
The trilogy adapter now treats all database errors with code 1205 as Sequel::DatabaseLockTimeout.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rdoc/files/lib/sequel/database/misc_rb.html b/rdoc/files/lib/sequel/database/misc_rb.html
index bc58a7455..7e2a06339 100644
--- a/rdoc/files/lib/sequel/database/misc_rb.html
+++ b/rdoc/files/lib/sequel/database/misc_rb.html
@@ -31,7 +31,7 @@ misc.rb
Last Update:
-2024-10-08 08:28:45 -0700
+2024-11-07 12:36:23 -0800
diff --git a/rdoc/files/lib/sequel/dataset/query_rb.html b/rdoc/files/lib/sequel/dataset/query_rb.html
index 3fc3de18a..adb13dab8 100644
--- a/rdoc/files/lib/sequel/dataset/query_rb.html
+++ b/rdoc/files/lib/sequel/dataset/query_rb.html
@@ -31,7 +31,7 @@ query.rb
Last Update:
-2024-04-04 14:06:41 -0700
+2024-11-07 12:36:23 -0800
diff --git a/rdoc/files/lib/sequel/model/base_rb.html b/rdoc/files/lib/sequel/model/base_rb.html
index bdba95a11..3c61232c2 100644
--- a/rdoc/files/lib/sequel/model/base_rb.html
+++ b/rdoc/files/lib/sequel/model/base_rb.html
@@ -31,7 +31,7 @@ base.rb
Last Update:
-2024-10-11 15:23:17 -0700
+2024-11-08 13:09:48 -0800
diff --git a/rdoc/files/lib/sequel/version_rb.html b/rdoc/files/lib/sequel/version_rb.html
index 45f06621c..84e181ffe 100644
--- a/rdoc/files/lib/sequel/version_rb.html
+++ b/rdoc/files/lib/sequel/version_rb.html
@@ -31,7 +31,7 @@ version.rb
Last Update:
-2024-11-01 09:04:27 -0700
+2024-12-01 09:13:44 -0800
diff --git a/rdoc/fr_file_index.html b/rdoc/fr_file_index.html
index 26bbcf311..b2a09c133 100644
--- a/rdoc/fr_file_index.html
+++ b/rdoc/fr_file_index.html
@@ -239,6 +239,7 @@
5.84.0.txt
5.85.0.txt
5.86.0.txt
+5.87.0.txt
5.9.0.txt
schema_modification.rdoc
security.rdoc
trilogy.rb
module lib/sequel/extensions/pg_row_ops.rb
module lib/sequel/plugins/insert_returning_select.rb
module lib/sequel/plugins/insert_returning_select.rb
Classes and Modules
module +Sequel::Plugins::InspectPk +
+ +The inspect_pk plugin includes the pk right next to the model name in inspect, allowing for easily copying and pasting to retrieve a copy of the object:
+ +Album.with_pk(1).inspect +# default: #<Album @values={...}> +# with inspect_pk: #<Album[1] @values={...}> ++ +
Usage:
+ +# Make all model instances include pk in inspect output +Sequel::Model.plugin :inspect_pk + +# Make Album instances include pk in inspect output +Album.plugin :inspect_pk ++
Classes and Modules
+ +module +Sequel::Plugins::InspectPk::InstanceMethods +
+ +module lib/sequel/extensions/pg_row_ops.rb
Classes and Modules
module +Sequel::Postgres::SchemaCaching +
+ +Included modules
+ +Public Instance methods
# File lib/sequel/extensions/schema_caching.rb 53 def dump_schema_cache(file) -54 sch = {} -55 @schemas.sort.each do |k,v| -56 sch[k] = v.map do |c, h| -57 h = Hash[h] -58 h.delete(:callable_default) -59 [c, h] -60 end -61 end -62 File.open(file, 'wb'){|f| f.write(Marshal.dump(sch))} -63 nil -64 end+54 sch = dumpable_schema_cache +55 File.open(file, 'wb'){|f| f.write(Marshal.dump(sch))} +56 nil +57 end
Public Instance methods
[show source]# File lib/sequel/extensions/schema_caching.rb -68 def dump_schema_cache?(file) -69 dump_schema_cache(file) unless File.exist?(file) -70 end+61 def dump_schema_cache?(file) +62 dump_schema_cache(file) unless File.exist?(file) +63 end
Public Instance methods
[show source]# File lib/sequel/extensions/schema_caching.rb -74 def load_schema_cache(file) -75 @schemas = Marshal.load(File.read(file)) -76 @schemas.each_value{|v| schema_post_process(v)} -77 nil -78 end+67 def load_schema_cache(file) +68 @schemas = load_schema_cache_file(file) +69 @schemas.each_value{|v| schema_post_process(v)} +70 nil +71 end
Public Instance methods
[show source]# File lib/sequel/extensions/schema_caching.rb -82 def load_schema_cache?(file) -83 load_schema_cache(file) if File.exist?(file) -84 end+75 def load_schema_cache?(file) +76 load_schema_cache(file) if File.exist?(file) +77 end
pg_schema_caching.rb +
+The pg_schema_caching extension builds on top of the schema_caching extension, and allows it to handle custom PostgreSQL types. On PostgreSQL, column schema hashes include an :oid entry for the OID for the column’s type. For custom types, this OID is dependent on the PostgreSQL database, so in most cases, test and development versions of the same database, created with the same migrations, will have different OIDs.
+ +To fix this case, the pg_schema_caching extension removes custom OIDs from the schema cache when dumping the schema, replacing them with a placeholder. When loading the cached schema, the Database object makes a single query to get the OIDs for all custom types used by the cached schema, and it updates all related column schema hashes to set the correct :oid entry for the current database.
+ +Related module: Sequel::Postgres::SchemaCaching
schema_caching.rb
sqlite_json_ops.rb
sqlite_json_ops.rb
j[1] # (json_column ->> 1)
j.get(1) # (json_column ->> 1)
-j.get_text(1) # (json_column -> 1)
+j.get_json(1) # (json_column -> 1)
j.extract('$.a') # json_extract(json_column, '$.a')
jb.extract('$.a') # jsonb_extract(jsonb_column, '$.a')
diff --git a/rdoc-plugins/files/lib/sequel/plugins/inspect_pk_rb.html b/rdoc-plugins/files/lib/sequel/plugins/inspect_pk_rb.html
new file mode 100644
index 000000000..b2f9d1913
--- /dev/null
+++ b/rdoc-plugins/files/lib/sequel/plugins/inspect_pk_rb.html
@@ -0,0 +1,52 @@
+
+
+
+inspect_pk.rb
+
+
+
+
+
+
+
+
+inspect_pk.rb
+
+
+lib/sequel/plugins/inspect_pk.rb
+
+
+Last Update:
+2024-11-08 13:09:48 -0800
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rdoc-plugins/fr_class_index.html b/rdoc-plugins/fr_class_index.html
index 208337eda..f4f561250 100644
--- a/rdoc-plugins/fr_class_index.html
+++ b/rdoc-plugins/fr_class_index.html
@@ -215,6 +215,8 @@
Sequel::Plugins::InsertReturningSelect
Sequel::Plugins::InsertReturningSelect::ClassMethods
Sequel::Plugins::InsertReturningSelect::InstanceMethods
+Sequel::Plugins::InstanceHooks
@@ -444,6 +446,7 @@
Sequel::Postgres::PGRowOp::ExpressionMethods
Sequel::Postgres::RangeOp
Sequel::Postgres::RangeOpMethods
+Sequel::Postgres::SchemaCaching
Sequel::Postgres::StaticCacheUpdater
Sequel::Postgres::Timestamptz
Sequel::Postgres::TimestamptzDatasetMethods
diff --git a/rdoc-plugins/fr_file_index.html b/rdoc-plugins/fr_file_index.html
index e2508329f..f73a11271 100644
--- a/rdoc-plugins/fr_file_index.html
+++ b/rdoc-plugins/fr_file_index.html
@@ -77,6 +77,7 @@
inspect_pk.rb +
+Sequel::Plugins::InsertReturningSelect
Sequel::Plugins::InsertReturningSelect::ClassMethods Sequel::Plugins::InsertReturningSelect::InstanceMethods +Sequel::Plugins::InstanceHooks
@@ -444,6 +446,7 @@ Sequel::Postgres::PGRowOp::ExpressionMethodsConstants
The minor version of Sequel
. Bumped for every non-patch level release, generally around once a month.
Public Instance methods
# File lib/sequel/database/misc.rb 248 def extension(*exts) -249 Sequel.extension(*exts) -250 exts.each do |ext| -251 if pr = Sequel.synchronize{EXTENSIONS[ext]} -252 if Sequel.synchronize{@loaded_extensions.include?(ext) ? false : (@loaded_extensions << ext)} -253 pr.call(self) -254 end -255 else -256 raise(Error, "Extension #{ext} does not have specific support handling individual databases (try: Sequel.extension #{ext.inspect})") -257 end -258 end -259 self -260 end+249 exts.each do |ext| +250 unless pr = Sequel.synchronize{EXTENSIONS[ext]} +251 Sequel.extension(ext) +252 pr = Sequel.synchronize{EXTENSIONS[ext]} +253 end +254 +255 if pr +256 if Sequel.synchronize{@loaded_extensions.include?(ext) ? false : (@loaded_extensions << ext)} +257 pr.call(self) +258 end +259 else +260 raise(Error, "Extension #{ext} does not have specific support handling individual databases (try: Sequel.extension #{ext.inspect})") +261 end +262 end +263 self +264 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -265 def from_application_timestamp(v) -266 Sequel.convert_output_timestamp(v, timezone) -267 end+269 def from_application_timestamp(v) +270 Sequel.convert_output_timestamp(v, timezone) +271 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -271 def inspect -272 s = String.new -273 s << "#<#{self.class}" -274 s << " database_type=#{database_type}" if database_type && database_type != adapter_scheme -275 -276 keys = [:host, :database, :user] -277 opts = self.opts -278 if !keys.any?{|k| opts[k]} && opts[:uri] -279 opts = self.class.send(:options_from_uri, URI.parse(opts[:uri])) -280 end -281 -282 keys.each do |key| -283 val = opts[key] -284 if val && val != '' -285 s << " #{key}=#{val}" -286 end -287 end -288 -289 s << ">" -290 end+275 def inspect +276 s = String.new +277 s << "#<#{self.class}" +278 s << " database_type=#{database_type}" if database_type && database_type != adapter_scheme +279 +280 keys = [:host, :database, :user] +281 opts = self.opts +282 if !keys.any?{|k| opts[k]} && opts[:uri] +283 opts = self.class.send(:options_from_uri, URI.parse(opts[:uri])) +284 end +285 +286 keys.each do |key| +287 val = opts[key] +288 if val && val != '' +289 s << " #{key}=#{val}" +290 end +291 end +292 +293 s << ">" +294 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -297 def literal(v) -298 schema_utility_dataset.literal(v) -299 end+301 def literal(v) +302 schema_utility_dataset.literal(v) +303 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -303 def literal_symbol(sym) -304 Sequel.synchronize{@symbol_literal_cache[sym]} -305 end+307 def literal_symbol(sym) +308 Sequel.synchronize{@symbol_literal_cache[sym]} +309 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -308 def literal_symbol_set(sym, lit) -309 Sequel.synchronize{@symbol_literal_cache[sym] = lit} -310 end+312 def literal_symbol_set(sym, lit) +313 Sequel.synchronize{@symbol_literal_cache[sym] = lit} +314 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -313 def prepared_statement(name) -314 Sequel.synchronize{prepared_statements[name]} -315 end+317 def prepared_statement(name) +318 Sequel.synchronize{prepared_statements[name]} +319 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -320 def quote_identifier(v) -321 schema_utility_dataset.quote_identifier(v) -322 end+324 def quote_identifier(v) +325 schema_utility_dataset.quote_identifier(v) +326 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -325 def schema_type_class(type) -326 @schema_type_classes[type] -327 end+329 def schema_type_class(type) +330 @schema_type_classes[type] +331 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -330 def serial_primary_key_options -331 {:primary_key => true, :type => Integer, :auto_increment => true} -332 end+334 def serial_primary_key_options +335 {:primary_key => true, :type => Integer, :auto_increment => true} +336 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -335 def set_prepared_statement(name, ps) -336 Sequel.synchronize{prepared_statements[name] = ps} -337 end+339 def set_prepared_statement(name, ps) +340 Sequel.synchronize{prepared_statements[name] = ps} +341 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -341 def sharded? -342 @sharded -343 end+345 def sharded? +346 @sharded +347 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -346 def timezone -347 @timezone || Sequel.database_timezone -348 end+350 def timezone +351 @timezone || Sequel.database_timezone +352 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -353 def to_application_timestamp(v) -354 Sequel.convert_timestamp(v, timezone) -355 end+357 def to_application_timestamp(v) +358 Sequel.convert_timestamp(v, timezone) +359 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -362 def typecast_value(column_type, value) -363 return nil if value.nil? -364 meth = "typecast_value_#{column_type}" -365 begin -366 # Allow calling private methods as per-type typecasting methods are private -367 respond_to?(meth, true) ? send(meth, value) : value -368 rescue ArgumentError, TypeError => e -369 raise Sequel.convert_exception_class(e, InvalidValue) -370 end -371 end+366 def typecast_value(column_type, value) +367 return nil if value.nil? +368 meth = "typecast_value_#{column_type}" +369 begin +370 # Allow calling private methods as per-type typecasting methods are private +371 respond_to?(meth, true) ? send(meth, value) : value +372 rescue ArgumentError, TypeError => e +373 raise Sequel.convert_exception_class(e, InvalidValue) +374 end +375 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -375 def uri -376 opts[:uri] -377 end+379 def uri +380 opts[:uri] +381 end
Public Instance methods
[show source]# File lib/sequel/database/misc.rb -380 def url -381 uri -382 end+384 def url +385 uri +386 end
Public Instance methods
# File lib/sequel/dataset/query.rb 206 def extension(*exts) -207 Sequel.extension(*exts) +207 exts.each{|ext| Sequel.extension(ext) unless Sequel.synchronize{EXTENSIONS[ext]}} 208 mods = exts.map{|ext| Sequel.synchronize{EXTENSION_MODULES[ext]}} 209 if mods.all? 210 with_extend(*mods) diff --git a/rdoc/classes/Sequel/Model/ClassMethods.html b/rdoc/classes/Sequel/Model/ClassMethods.html index f0faa39da..1152617e5 100644 --- a/rdoc/classes/Sequel/Model/ClassMethods.html +++ b/rdoc/classes/Sequel/Model/ClassMethods.html @@ -243,7 +243,7 @@Attributes
Should be the literal table name if this Model’s dataset is a simple table (no select, order, join, etc.), or nil otherwise. This and simple_pk
are used for an optimization in Model.[].
Should be the literal table name if this Model’s dataset is a simple table (no select, order, join, etc.), or nil otherwise. This and simple_pk
are used for an optimization in Model[].
Public Instance methods
Finds a single record according to the supplied filter. You are encouraged to use Model.[] or Model.first instead of this method.
+Finds a single record according to the supplied filter. You are encouraged to use Model[] or Model.first instead of this method.
Artist.find(name: 'Bob') # SELECT * FROM artists WHERE (name = 'Bob') LIMIT 1 diff --git a/rdoc/classes/Sequel/Model/DatasetMethods.html b/rdoc/classes/Sequel/Model/DatasetMethods.html index fcab56f99..5bcffa9d2 100644 --- a/rdoc/classes/Sequel/Model/DatasetMethods.html +++ b/rdoc/classes/Sequel/Model/DatasetMethods.html @@ -77,13 +77,13 @@Public Instance methods
[show source]# File lib/sequel/model/base.rb -2138 def [](*args) -2139 if args.length == 1 && (i = args[0]) && i.is_a?(Integer) -2140 with_pk(i) -2141 else -2142 super -2143 end -2144 end+2143 def [](*args) +2144 if args.length == 1 && (i = args[0]) && i.is_a?(Integer) +2145 with_pk(i) +2146 else +2147 super +2148 end +2149 end
Public Instance methods
[show source]# File lib/sequel/model/base.rb -2198 def as_hash(key_column=nil, value_column=nil, opts=OPTS) -2199 if key_column -2200 super -2201 else -2202 raise(Sequel::Error, "No primary key for model") unless model && (pk = model.primary_key) -2203 super(pk, value_column, opts) -2204 end -2205 end+2203 def as_hash(key_column=nil, value_column=nil, opts=OPTS) +2204 if key_column +2205 super +2206 else +2207 raise(Sequel::Error, "No primary key for model") unless model && (pk = model.primary_key) +2208 super(pk, value_column, opts) +2209 end +2210 end
Public Instance methods
[show source]# File lib/sequel/model/base.rb -2155 def destroy -2156 @db.transaction(:server=>opts[:server], :skip_transaction=>model.use_transactions == false) do -2157 all(&:destroy).length -2158 end -2159 end+2160 def destroy +2161 @db.transaction(:server=>opts[:server], :skip_transaction=>model.use_transactions == false) do +2162 all(&:destroy).length +2163 end +2164 end
Public Instance methods
[show source]# File lib/sequel/model/base.rb -2166 def last(*a, &block) -2167 if ds = _primary_key_order -2168 ds.last(*a, &block) -2169 else -2170 super -2171 end -2172 end+2171 def last(*a, &block) +2172 if ds = _primary_key_order +2173 ds.last(*a, &block) +2174 else +2175 super +2176 end +2177 end
Public Instance methods
[show source]# File lib/sequel/model/base.rb -2130 def model -2131 @opts[:model] -2132 end+2135 def model +2136 @opts[:model] +2137 end
Public Instance methods
[show source]# File lib/sequel/model/base.rb -2182 def paged_each(*a, &block) -2183 if ds = _primary_key_order -2184 ds.paged_each(*a, &block) -2185 else -2186 super -2187 end -2188 end+2187 def paged_each(*a, &block) +2188 if ds = _primary_key_order +2189 ds.paged_each(*a, &block) +2190 else +2191 super +2192 end +2193 end
Public Instance methods
[show source]# File lib/sequel/model/base.rb -2208 def to_hash(*a) -2209 as_hash(*a) -2210 end+2213 def to_hash(*a) +2214 as_hash(*a) +2215 end
Public Instance methods
[show source]# File lib/sequel/model/base.rb -2222 def with_pk(pk) -2223 if pk && (loader = _with_pk_loader) -2224 loader.first(*pk) -2225 else -2226 first(model.qualified_primary_key_hash(pk)) -2227 end -2228 end+2227 def with_pk(pk) +2228 if pk && (loader = _with_pk_loader) +2229 loader.first(*pk) +2230 else +2231 first(model.qualified_primary_key_hash(pk)) +2232 end +2233 end
Public Instance methods
[show source]# File lib/sequel/model/base.rb -2232 def with_pk!(pk) -2233 with_pk(pk) || raise(NoMatchingRow.new(self)) -2234 end+2237 def with_pk!(pk) +2238 with_pk(pk) || raise(NoMatchingRow.new(self)) +2239 end
Public Instance methods
# File lib/sequel/model/base.rb 1313 def inspect -1314 "#<#{model.name} @values=#{inspect_values}>" +1314 "#<#{inspect_prefix} @values=#{inspect_values}>" 1315 enddiff --git a/rdoc/created.rid b/rdoc/created.rid index 85a7a9b3e..fc562c1b6 100644 --- a/rdoc/created.rid +++ b/rdoc/created.rid @@ -1,6 +1,6 @@ -Fri, 01 Nov 2024 09:22:58 -0700 +Sun, 01 Dec 2024 09:22:09 -0800 README.rdoc Sun, 31 Mar 2024 10:39:03 -0700 -CHANGELOG Fri, 01 Nov 2024 09:04:27 -0700 +CHANGELOG Sun, 01 Dec 2024 09:13:44 -0800 doc/CHANGELOG.old Tue, 04 Aug 2020 18:11:34 -0700 MIT-LICENSE Tue, 03 Jan 2023 11:20:51 -0800 lib/sequel.rb Tue, 01 Aug 2017 08:12:00 -0700 @@ -14,7 +14,7 @@ lib/sequel/exceptions.rb Fri, 02 Feb 2024 13:06:09 -0800 lib/sequel/model.rb Tue, 04 Aug 2020 18:11:34 -0700 lib/sequel/sql.rb Thu, 22 Aug 2024 11:50:35 -0700 lib/sequel/timezones.rb Fri, 17 Dec 2021 16:59:47 -0800 -lib/sequel/version.rb Fri, 01 Nov 2024 09:04:27 -0700 +lib/sequel/version.rb Sun, 01 Dec 2024 09:13:44 -0800 lib/sequel/connection_pool/sharded_single.rb Fri, 17 Dec 2021 16:59:47 -0800 lib/sequel/connection_pool/sharded_threaded.rb Fri, 28 Jun 2024 09:03:32 -0700 lib/sequel/connection_pool/sharded_timed_queue.rb Mon, 12 Jun 2023 13:05:49 -0700 @@ -26,7 +26,7 @@ lib/sequel/database/dataset.rb Tue, 28 Mar 2023 14:16:05 -0700 lib/sequel/database/dataset_defaults.rb Tue, 01 Aug 2017 08:12:00 -0700 lib/sequel/database/features.rb Tue, 01 Aug 2017 08:12:00 -0700 lib/sequel/database/logging.rb Fri, 30 Aug 2019 08:15:18 -0700 -lib/sequel/database/misc.rb Tue, 08 Oct 2024 08:28:45 -0700 +lib/sequel/database/misc.rb Thu, 07 Nov 2024 12:36:23 -0800 lib/sequel/database/query.rb Wed, 21 Dec 2022 15:06:01 -0800 lib/sequel/database/schema_generator.rb Tue, 28 Mar 2023 07:40:44 -0700 lib/sequel/database/schema_methods.rb Thu, 22 Aug 2024 11:50:35 -0700 @@ -39,10 +39,10 @@ lib/sequel/dataset/graph.rb Thu, 04 Apr 2024 14:06:41 -0700 lib/sequel/dataset/misc.rb Mon, 23 Jan 2023 11:36:37 -0800 lib/sequel/dataset/placeholder_literalizer.rb Mon, 23 Jan 2023 11:36:37 -0800 lib/sequel/dataset/prepared_statements.rb Wed, 02 Dec 2020 15:37:08 -0800 -lib/sequel/dataset/query.rb Thu, 04 Apr 2024 14:06:41 -0700 +lib/sequel/dataset/query.rb Thu, 07 Nov 2024 12:36:23 -0800 lib/sequel/dataset/sql.rb Mon, 01 Jul 2024 16:32:10 -0700 lib/sequel/model/associations.rb Fri, 19 Jan 2024 15:26:00 -0800 -lib/sequel/model/base.rb Fri, 11 Oct 2024 15:23:17 -0700 +lib/sequel/model/base.rb Fri, 08 Nov 2024 13:09:48 -0800 lib/sequel/model/dataset_module.rb Fri, 11 Oct 2024 15:23:15 -0700 lib/sequel/model/default_inflections.rb Tue, 01 Aug 2017 08:12:01 -0700 lib/sequel/model/errors.rb Mon, 09 Aug 2021 13:30:01 -0700 @@ -70,7 +70,7 @@ doc/opening_databases.rdoc Sun, 27 Oct 2024 20:44:24 -0700 doc/postgresql.rdoc Fri, 21 Oct 2022 08:19:04 -0700 doc/prepared_statements.rdoc Tue, 01 Aug 2017 08:12:00 -0700 doc/querying.rdoc Fri, 06 Sep 2024 09:53:34 -0700 -doc/reflection.rdoc Tue, 01 Aug 2017 08:12:00 -0700 +doc/reflection.rdoc Mon, 11 Nov 2024 14:55:11 -0800 doc/schema_modification.rdoc Thu, 01 Feb 2024 15:00:17 -0800 doc/security.rdoc Fri, 21 Oct 2022 08:19:04 -0700 doc/sharding.rdoc Fri, 26 May 2023 07:47:08 -0700 @@ -283,5 +283,6 @@ doc/release_notes/5.83.0.txt Thu, 08 Aug 2024 09:05:13 -0700 doc/release_notes/5.84.0.txt Thu, 29 Aug 2024 16:43:54 -0700 doc/release_notes/5.85.0.txt Tue, 01 Oct 2024 08:44:47 -0700 doc/release_notes/5.86.0.txt Fri, 01 Nov 2024 09:04:27 -0700 +doc/release_notes/5.87.0.txt Sun, 01 Dec 2024 09:13:44 -0800 doc/release_notes/5.9.0.txt Fri, 01 Jun 2018 07:49:41 -0700 lib/sequel/extensions/migration.rb Fri, 02 Feb 2024 13:06:09 -0800 diff --git a/rdoc/files/CHANGELOG.html b/rdoc/files/CHANGELOG.html index d52b047c7..a15242037 100644 --- a/rdoc/files/CHANGELOG.html +++ b/rdoc/files/CHANGELOG.html @@ -31,12 +31,27 @@
CHANGELOG
Last Update:
-2024-11-01 09:04:27 -0700
+2024-12-01 09:13:44 -0800
+5.87.0 (2024-12-01)¶ ↑
+-
+
Add pg_schema_caching extension, for reloading OIDs for custom types when loading cached schema (jeremyevans)
+ -
+
Make Database#schema hashes include :comment field on MySQL and PostgreSQL (Bahanix) (#2248, #2249)
+ -
+
Add inspect_pk plugin to make it easier to retrieve model instance based on inspect output (jeremyevans)
+ -
+
Treat all Trilogy errors with error code 1205 as Sequel::DatabaseLockTimeout in the trilogy adapter (jeremyevans)
+ -
+
Allow Data{base,set}#extension to not require files if the extension is already registered (jeremyevans) (#2246)
+ -
+
Do not limit imports to 40 rows at a time if using pg_auto_parameterize extension with the no_auto_parameterize method (davekaro) (#2242)
+
+
5.86.0 (2024-11-01)¶ ↑
-
Support the :disable_dqs Database option in the sqlite adapter to disable treating double quoted values as strings (jeremyevans) (#2233)
diff --git a/rdoc/files/doc/reflection_rdoc.html b/rdoc/files/doc/reflection_rdoc.html
index 2f26ca134..8eeac50b2 100644
--- a/rdoc/files/doc/reflection_rdoc.html
+++ b/rdoc/files/doc/reflection_rdoc.html
@@ -31,7 +31,7 @@ reflection.rdoc
Last Update:
-2017-08-01 08:12:00 -0700
+2024-11-11 14:55:11 -0800
@@ -110,6 +110,8 @@ Column Information for a TableDatabase#schema takes a table symbol and returns column information in an array with each element being an array with two elements. The first elements of the subarray is a column symbol, and the second element is a hash of information about that column. The hash should include the following keys:
:allow_null
Whether NULL/nil is an allowed value for this column. Used by the Sequel::Model
typecasting code.
+ :comment
+The comment on the column (MySQL and PostreSQL only).
:db_type
The type of column the database provided, as a string. Used by the schema_dumper plugin for a more specific type translation.
:default
diff --git a/rdoc/files/doc/release_notes/5_87_0_txt.html b/rdoc/files/doc/release_notes/5_87_0_txt.html
new file mode 100644
index 000000000..e39d9db9e
--- /dev/null
+++ b/rdoc/files/doc/release_notes/5_87_0_txt.html
@@ -0,0 +1,77 @@
+
+
+
+5.87.0.txt
+
+
+
+
+
+
+
+
+5.87.0.txt
+
+
+doc/release_notes/5.87.0.txt
+
+
+Last Update:
+2024-12-01 09:13:44 -0800
+
+
+
+
+
+New Features¶ ↑
+-
+
Column schema hashes on MySQL and PostgreSQL now include the comment on the column in the :comment entry.
+ -
+
An inspect_pk plugin has been added, which makes the inspect output include the primary key next to the class name, so that you can copy and paste the inspect output to return the model object:
+
+Album.with_pk(1).inspect
+# default: #<Album @values={...}>
+# with inspect_pk: #<Album[1] @values={...}>
+
+ -
+
A pg_schema_caching extension has been added. This builds on top of the schema_caching extension, and handles OIDs for custom types.
+
+Type OIDs are included in column schema hashes on PostgreSQL. The OIDs are static for built-in types, but dynamic for custom types. The pg_schema_caching extension will perform a query to get the type OIDs for the custom types after loading the cached schema.
+
+
+Other Improvements¶ ↑
+-
+
Database#extension and Dataset#extension no longer attempt to require the extension file if the extension has already been registered. This is how model plugins work, and makes it easier for applications to use custom extensions without messing with the load path.
+ -
+
When using the pg_auto_parameterize extension, and using Dataset#no_auto_parameterize, Dataset#import is no longer limited to inserting 40 rows at a time.
+ -
+
The trilogy adapter now treats all database errors with code 1205 as Sequel::DatabaseLockTimeout.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rdoc/files/lib/sequel/database/misc_rb.html b/rdoc/files/lib/sequel/database/misc_rb.html
index bc58a7455..7e2a06339 100644
--- a/rdoc/files/lib/sequel/database/misc_rb.html
+++ b/rdoc/files/lib/sequel/database/misc_rb.html
@@ -31,7 +31,7 @@ misc.rb
Last Update:
-2024-10-08 08:28:45 -0700
+2024-11-07 12:36:23 -0800
diff --git a/rdoc/files/lib/sequel/dataset/query_rb.html b/rdoc/files/lib/sequel/dataset/query_rb.html
index 3fc3de18a..adb13dab8 100644
--- a/rdoc/files/lib/sequel/dataset/query_rb.html
+++ b/rdoc/files/lib/sequel/dataset/query_rb.html
@@ -31,7 +31,7 @@ query.rb
Last Update:
-2024-04-04 14:06:41 -0700
+2024-11-07 12:36:23 -0800
diff --git a/rdoc/files/lib/sequel/model/base_rb.html b/rdoc/files/lib/sequel/model/base_rb.html
index bdba95a11..3c61232c2 100644
--- a/rdoc/files/lib/sequel/model/base_rb.html
+++ b/rdoc/files/lib/sequel/model/base_rb.html
@@ -31,7 +31,7 @@ base.rb
Last Update:
-2024-10-11 15:23:17 -0700
+2024-11-08 13:09:48 -0800
diff --git a/rdoc/files/lib/sequel/version_rb.html b/rdoc/files/lib/sequel/version_rb.html
index 45f06621c..84e181ffe 100644
--- a/rdoc/files/lib/sequel/version_rb.html
+++ b/rdoc/files/lib/sequel/version_rb.html
@@ -31,7 +31,7 @@ version.rb
Last Update:
-2024-11-01 09:04:27 -0700
+2024-12-01 09:13:44 -0800
diff --git a/rdoc/fr_file_index.html b/rdoc/fr_file_index.html
index 26bbcf311..b2a09c133 100644
--- a/rdoc/fr_file_index.html
+++ b/rdoc/fr_file_index.html
@@ -239,6 +239,7 @@
5.84.0.txt
5.85.0.txt
5.86.0.txt
+5.87.0.txt
5.9.0.txt
schema_modification.rdoc
security.rdoc
5.87.0 (2024-12-01)¶ ↑
+-
+
Add pg_schema_caching extension, for reloading OIDs for custom types when loading cached schema (jeremyevans)
+ -
+
Make Database#schema hashes include :comment field on MySQL and PostgreSQL (Bahanix) (#2248, #2249)
+ -
+
Add inspect_pk plugin to make it easier to retrieve model instance based on inspect output (jeremyevans)
+ -
+
Treat all Trilogy errors with error code 1205 as Sequel::DatabaseLockTimeout in the trilogy adapter (jeremyevans)
+ -
+
Allow Data{base,set}#extension to not require files if the extension is already registered (jeremyevans) (#2246)
+ -
+
Do not limit imports to 40 rows at a time if using pg_auto_parameterize extension with the no_auto_parameterize method (davekaro) (#2242)
+
5.86.0 (2024-11-01)¶ ↑
-
Support the :disable_dqs Database option in the sqlite adapter to disable treating double quoted values as strings (jeremyevans) (#2233)
diff --git a/rdoc/files/doc/reflection_rdoc.html b/rdoc/files/doc/reflection_rdoc.html index 2f26ca134..8eeac50b2 100644 --- a/rdoc/files/doc/reflection_rdoc.html +++ b/rdoc/files/doc/reflection_rdoc.html @@ -31,7 +31,7 @@reflection.rdoc
Column Information for a TableDatabase#schema takes a table symbol and returns column information in an array with each element being an array with two elements. The first elements of the subarray is a column symbol, and the second element is a hash of information about that column. The hash should include the following keys:
:allow_null
Whether NULL/nil is an allowed value for this column. Used by the Sequel::Model
typecasting code.
+ :comment
+The comment on the column (MySQL and PostreSQL only).
:db_type
The type of column the database provided, as a string. Used by the schema_dumper plugin for a more specific type translation.
:default
diff --git a/rdoc/files/doc/release_notes/5_87_0_txt.html b/rdoc/files/doc/release_notes/5_87_0_txt.html
new file mode 100644
index 000000000..e39d9db9e
--- /dev/null
+++ b/rdoc/files/doc/release_notes/5_87_0_txt.html
@@ -0,0 +1,77 @@
+
+
+
+5.87.0.txt
+
+
+
+
+
+
+
+
+5.87.0.txt
+
+
+doc/release_notes/5.87.0.txt
+
+
+Last Update:
+2024-12-01 09:13:44 -0800
+
+
+
+
+
+New Features¶ ↑
+-
+
Column schema hashes on MySQL and PostgreSQL now include the comment on the column in the :comment entry.
+ -
+
An inspect_pk plugin has been added, which makes the inspect output include the primary key next to the class name, so that you can copy and paste the inspect output to return the model object:
+
+Album.with_pk(1).inspect
+# default: #<Album @values={...}>
+# with inspect_pk: #<Album[1] @values={...}>
+
+ -
+
A pg_schema_caching extension has been added. This builds on top of the schema_caching extension, and handles OIDs for custom types.
+
+Type OIDs are included in column schema hashes on PostgreSQL. The OIDs are static for built-in types, but dynamic for custom types. The pg_schema_caching extension will perform a query to get the type OIDs for the custom types after loading the cached schema.
+
+
+Other Improvements¶ ↑
+-
+
Database#extension and Dataset#extension no longer attempt to require the extension file if the extension has already been registered. This is how model plugins work, and makes it easier for applications to use custom extensions without messing with the load path.
+ -
+
When using the pg_auto_parameterize extension, and using Dataset#no_auto_parameterize, Dataset#import is no longer limited to inserting 40 rows at a time.
+ -
+
The trilogy adapter now treats all database errors with code 1205 as Sequel::DatabaseLockTimeout.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/rdoc/files/lib/sequel/database/misc_rb.html b/rdoc/files/lib/sequel/database/misc_rb.html
index bc58a7455..7e2a06339 100644
--- a/rdoc/files/lib/sequel/database/misc_rb.html
+++ b/rdoc/files/lib/sequel/database/misc_rb.html
@@ -31,7 +31,7 @@ misc.rb
Last Update:
-2024-10-08 08:28:45 -0700
+2024-11-07 12:36:23 -0800
diff --git a/rdoc/files/lib/sequel/dataset/query_rb.html b/rdoc/files/lib/sequel/dataset/query_rb.html
index 3fc3de18a..adb13dab8 100644
--- a/rdoc/files/lib/sequel/dataset/query_rb.html
+++ b/rdoc/files/lib/sequel/dataset/query_rb.html
@@ -31,7 +31,7 @@ query.rb
Last Update:
-2024-04-04 14:06:41 -0700
+2024-11-07 12:36:23 -0800
diff --git a/rdoc/files/lib/sequel/model/base_rb.html b/rdoc/files/lib/sequel/model/base_rb.html
index bdba95a11..3c61232c2 100644
--- a/rdoc/files/lib/sequel/model/base_rb.html
+++ b/rdoc/files/lib/sequel/model/base_rb.html
@@ -31,7 +31,7 @@ base.rb
Last Update:
-2024-10-11 15:23:17 -0700
+2024-11-08 13:09:48 -0800
diff --git a/rdoc/files/lib/sequel/version_rb.html b/rdoc/files/lib/sequel/version_rb.html
index 45f06621c..84e181ffe 100644
--- a/rdoc/files/lib/sequel/version_rb.html
+++ b/rdoc/files/lib/sequel/version_rb.html
@@ -31,7 +31,7 @@ version.rb
Last Update:
-2024-11-01 09:04:27 -0700
+2024-12-01 09:13:44 -0800
diff --git a/rdoc/fr_file_index.html b/rdoc/fr_file_index.html
index 26bbcf311..b2a09c133 100644
--- a/rdoc/fr_file_index.html
+++ b/rdoc/fr_file_index.html
@@ -239,6 +239,7 @@
5.84.0.txt
5.85.0.txt
5.86.0.txt
+5.87.0.txt
5.9.0.txt
schema_modification.rdoc
security.rdoc
:allow_null |
Whether NULL/nil is an allowed value for this column. Used by the |
:comment |
+ The comment on the column (MySQL and PostreSQL only). |
:db_type |
The type of column the database provided, as a string. Used by the schema_dumper plugin for a more specific type translation. |
:default |
diff --git a/rdoc/files/doc/release_notes/5_87_0_txt.html b/rdoc/files/doc/release_notes/5_87_0_txt.html
new file mode 100644
index 000000000..e39d9db9e
--- /dev/null
+++ b/rdoc/files/doc/release_notes/5_87_0_txt.html
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
diff --git a/rdoc/files/lib/sequel/database/misc_rb.html b/rdoc/files/lib/sequel/database/misc_rb.html
index bc58a7455..7e2a06339 100644
--- a/rdoc/files/lib/sequel/database/misc_rb.html
+++ b/rdoc/files/lib/sequel/database/misc_rb.html
@@ -31,7 +31,7 @@
+
+5.87.0.txt ++
+doc/release_notes/5.87.0.txt
+
+
+Last Update:
+2024-12-01 09:13:44 -0800
+
+
+
+
+
+
+
+
+
+New Features¶ ↑+
Other Improvements¶ ↑+
+
+
+misc.rb
query.rbbase.rbversion.rb |