File: sql_source.rb

package info (click to toggle)
ruby-riddle 2.3.1-2~deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 10,752 kB
  • sloc: sql: 25,022; php: 5,992; ruby: 4,757; sh: 59; makefile: 5
file content (56 lines) | stat: -rw-r--r-- 2,025 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# frozen_string_literal: true

module Riddle
  class Configuration
    class SQLSource < Riddle::Configuration::Source
      def self.settings
        [
          :type, :sql_host, :sql_user, :sql_pass, :sql_db,
          :sql_port, :sql_sock, :mysql_connect_flags, :mysql_ssl_cert,
          :mysql_ssl_key, :mysql_ssl_ca, :odbc_dsn, :sql_query_pre, :sql_query,
          :sql_joined_field, :sql_file_field, :sql_query_range,
          :sql_range_step, :sql_query_killlist, :sql_attr_uint, :sql_attr_bool,
          :sql_attr_bigint, :sql_attr_timestamp, :sql_attr_str2ordinal,
          :sql_attr_float, :sql_attr_multi, :sql_attr_string,
          :sql_attr_str2wordcount, :sql_attr_json,
          :sql_column_buffers, :sql_field_string, :sql_field_str2wordcount,
          :sql_query_post, :sql_query_post_index, :sql_ranged_throttle,
          :sql_query_info, :mssql_winauth, :mssql_unicode, :unpack_zlib,
          :unpack_mysqlcompress, :unpack_mysqlcompress_maxsize
        ]
      end

      attr_accessor *self.settings

      def initialize(name, type)
        @name = name
        @type = type

        @sql_query_pre            = []
        @sql_joined_field         = []
        @sql_file_field           = []
        @sql_attr_uint            = []
        @sql_attr_bool            = []
        @sql_attr_bigint          = []
        @sql_attr_timestamp       = []
        @sql_attr_str2ordinal     = []
        @sql_attr_float           = []
        @sql_attr_multi           = []
        @sql_attr_string          = []
        @sql_attr_str2wordcount   = []
        @sql_attr_json            = []
        @sql_field_string         = []
        @sql_field_str2wordcount  = []
        @sql_query_post           = []
        @sql_query_post_index     = []
        @unpack_zlib              = []
        @unpack_mysqlcompress     = []
      end

      def valid?
        super && (!( @sql_host.nil? || @sql_user.nil? || @sql_db.nil? ||
          @sql_query.nil? ) || !@parent.nil?)
      end
    end
  end
end