query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Notifies the given channel. See the PostgreSQL NOTIFY documentation. Options: :payload :: The payload string to use for the NOTIFY statement. Only supported in PostgreSQL 9.0+. :server :: The server to which to send the NOTIFY statement, if the sharding support is being used. | def notify(channel, opts=OPTS)
sql = String.new
sql << "NOTIFY "
dataset.send(:identifier_append, sql, channel)
if payload = opts[:payload]
sql << ", "
dataset.literal_append(sql, payload.to_s)
end
execute_ddl(sql, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_channel(connection, channel, payload)\n connection.execute(\"NOTIFY #{channel}, #{payload}\")\n end",
"def notify msg, channel \n if @slack_url == '' \n puts \"No slack webhook url specified\"\n return\n end\n \n hash = {:text => msg, :channel => channel}\n json = JSON.gener... | [
"0.8064743",
"0.57137465",
"0.5685415",
"0.56356466",
"0.5602777",
"0.55876213",
"0.54835033",
"0.5469714",
"0.5420852",
"0.5420809",
"0.5384294",
"0.5377497",
"0.53681254",
"0.53485763",
"0.5333337",
"0.5321088",
"0.5249252",
"0.523603",
"0.5228612",
"0.52157784",
"0.5215308... | 0.77982366 | 1 |
Refresh the materialized view with the given name. DB.refresh_view(:items_view) REFRESH MATERIALIZED VIEW items_view DB.refresh_view(:items_view, concurrently: true) REFRESH MATERIALIZED VIEW CONCURRENTLY items_view | def refresh_view(name, opts=OPTS)
run "REFRESH MATERIALIZED VIEW#{' CONCURRENTLY' if opts[:concurrently]} #{quote_schema_table(name)}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def refresh_materialized_view(name, options = {})\n options = {\n :with_data => true\n }.merge(options)\n\n sql = \"REFRESH MATERIALIZED VIEW #{quote_view_name(name)}\"\n sql << \" WITH NO DATA\" unless options[:with_data]\n\n execute \"#{sql};\"\n end",
"def refr... | [
"0.7993562",
"0.7882737",
"0.75135463",
"0.7201716",
"0.6636582",
"0.643207",
"0.6383927",
"0.6365476",
"0.6278349",
"0.610675",
"0.60786706",
"0.6030206",
"0.59427327",
"0.58854914",
"0.58234787",
"0.5808679",
"0.5808097",
"0.5795441",
"0.5790887",
"0.5762876",
"0.5745043",
... | 0.8195975 | 0 |
Reset the primary key sequence for the given table, basing it on the maximum current value of the table's primary key. | def reset_primary_key_sequence(table)
return unless seq = primary_key_sequence(table)
pk = SQL::Identifier.new(primary_key(table))
db = self
s, t = schema_and_table(table)
table = Sequel.qualify(s, t) if s
if server_version >= 100000
seq_ds = metadata_dataset.f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_pk_sequence!(table, pk = nil, sequence = nil)\n if ! pk || ! sequence\n default_pk, default_sequence = pk_and_sequence_for(table)\n pk ||= default_pk; sequence ||= default_sequence\n end\n if pk && sequence\n quoted_sequence = quote_column_name(sequence)\n\n sel... | [
"0.81005555",
"0.80798966",
"0.80725735",
"0.80469537",
"0.80416894",
"0.7450408",
"0.74204576",
"0.7341868",
"0.72347623",
"0.71692264",
"0.7104913",
"0.7014823",
"0.6871635",
"0.66317236",
"0.66317236",
"0.66184896",
"0.6581778",
"0.65705836",
"0.6544491",
"0.6426742",
"0.6... | 0.8832561 | 0 |
PostgreSQL supports deferrable foreign key constraints. | def supports_deferrable_foreign_key_constraints?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supports_deferrable_foreign_key_constraints?\n supports_deferrable_constraints?\n end",
"def foreign_key_present?\n false\n end",
"def foreign_key_present?\n false\n end",
"def foreign_keys\n @foreign_keys ||= connection.foreign_keys(table_name, \"#{name} ... | [
"0.7820092",
"0.7030612",
"0.7030612",
"0.68069375",
"0.677845",
"0.67621166",
"0.67621166",
"0.674389",
"0.6702672",
"0.66943294",
"0.66943294",
"0.661967",
"0.65737766",
"0.65495896",
"0.65211123",
"0.6496953",
"0.6462772",
"0.64350355",
"0.641176",
"0.6408627",
"0.6408627"... | 0.8199576 | 1 |
PostgreSQL supports DROP TABLE IF EXISTS | def supports_drop_table_if_exists?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_drop_table_if_exists\n connection.create_table(:testings)\n assert connection.table_exists?(:testings)\n connection.drop_table(:testings, if_exists: true)\n assert_not connection.table_exists?(:testings)\n end",
"def drop_table_sql(name, options)\n \"DROP ... | [
"0.75406855",
"0.7447282",
"0.7352017",
"0.7257186",
"0.70561236",
"0.70199263",
"0.7016024",
"0.6948586",
"0.692693",
"0.69207895",
"0.69183964",
"0.68844426",
"0.68596363",
"0.68555564",
"0.68210626",
"0.67926085",
"0.6784143",
"0.6715057",
"0.6701895",
"0.66934294",
"0.667... | 0.7773049 | 1 |
PostgreSQL supports partial indexes. | def supports_partial_indexes?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supports_partial_indexes?\n false\n end",
"def supports_partial_index?\n false\n end",
"def supports_partial_index?\n false\n end",
"def indexes(table_name, name = nil)\n result = query(<<-SQL, 'SCHEMA')\n SELECT distinct i.relname, d.indisunique, d.ind... | [
"0.78717965",
"0.7054134",
"0.7054134",
"0.63987356",
"0.63508844",
"0.63295084",
"0.6323869",
"0.6159993",
"0.61426693",
"0.61346114",
"0.6086542",
"0.60757685",
"0.6067708",
"0.6039056",
"0.60032016",
"0.5991477",
"0.5991477",
"0.5944628",
"0.5943683",
"0.5924851",
"0.59207... | 0.79788727 | 0 |
PostgreSQL supports prepared transactions (twophase commit) if max_prepared_transactions is greater than 0. | def supports_prepared_transactions?
return @supports_prepared_transactions if defined?(@supports_prepared_transactions)
@supports_prepared_transactions = self['SHOW max_prepared_transactions'].get.to_i > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supports_prepared_transactions?\n false\n end",
"def on_prepare_transaction_commit(unit, transaction); end",
"def commit_transaction(conn, opts=OPTS)\n if (s = opts[:prepare]) && savepoint_level(conn) <= 1\n log_connection_execute(conn, \"PREPARE TRANSACTION #{literal(s)}\")\n ... | [
"0.7779416",
"0.67318296",
"0.66393447",
"0.6488887",
"0.64478713",
"0.642692",
"0.62858105",
"0.6274448",
"0.6274448",
"0.62604916",
"0.6229228",
"0.6184096",
"0.6167285",
"0.6167285",
"0.61652166",
"0.61652166",
"0.60421",
"0.59701645",
"0.5968591",
"0.59547496",
"0.592801"... | 0.7233213 | 1 |
PostgreSQL supports transaction DDL statements. | def supports_transactional_ddl?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supports_transactional_ddl?\n false\n end",
"def begin_db_transaction\n execute(\"BEGIN\")\n end",
"def begin_db_transaction\n execute(\"BEGIN\")\n end",
"def supports_ddl_transactions?\n false\n end",
"def supports_ddl_transactions?\n false\n ... | [
"0.7055532",
"0.69787323",
"0.69787323",
"0.68916005",
"0.68916005",
"0.68916005",
"0.6853812",
"0.6645684",
"0.6645684",
"0.6479298",
"0.6479298",
"0.64768124",
"0.64768124",
"0.64768124",
"0.6476242",
"0.6454384",
"0.6442726",
"0.6442726",
"0.6414321",
"0.6414321",
"0.64097... | 0.725727 | 0 |
Array of symbols specifying view names in the current database. Options: :materialized :: Return materialized views :qualify :: Return the views as Sequel::SQL::QualifiedIdentifier instances, using the schema the view is located in as the qualifier. :schema :: The schema to search :server :: The server to use | def views(opts=OPTS)
relkind = opts[:materialized] ? 'm' : 'v'
pg_class_relname(relkind, opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def views(name = nil)\n select_values(\"SELECT table_name FROM information_schema.views\", name)\n end",
"def get_views\n connect_db.fetch(\"SELECT RDB$RELATION_NAME, RDB$VIEW_SOURCE FROM RDB$RELATIONS WHERE RDB$VIEW_BLR IS NOT NULL AND (RDB$SYSTEM_FLAG IS NULL OR RDB$SYSTEM_FLAG = 0)\")\n end",
... | [
"0.7103677",
"0.66371846",
"0.62148297",
"0.6162572",
"0.6033561",
"0.5926373",
"0.58784133",
"0.5872362",
"0.5858072",
"0.5778937",
"0.5770808",
"0.5722647",
"0.57035476",
"0.563731",
"0.55852634",
"0.55369884",
"0.5510381",
"0.5483866",
"0.5450678",
"0.54368955",
"0.5373665... | 0.69248116 | 1 |
Dataset used to retrieve CHECK constraint information | def _check_constraints_ds
@_check_constraints_ds ||= metadata_dataset.
from{pg_constraint.as(:co)}.
left_join(Sequel[:pg_attribute].as(:att), :attrelid=>:conrelid, :attnum=>SQL::Function.new(:ANY, Sequel[:co][:conkey])).
where(:contype=>'c').
select{[co[:conname].as(:cons... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_constraints(table)\n m = output_identifier_meth\n\n hash = {}\n _check_constraints_ds.where_each(:conrelid=>regclass_oid(table)) do |row|\n constraint = m.call(row[:constraint])\n entry = hash[constraint] ||= {:definition=>row[:definition], :columns=>[]}\n ... | [
"0.6155641",
"0.60944134",
"0.5996631",
"0.59153426",
"0.58677566",
"0.57724947",
"0.57413626",
"0.57413626",
"0.57413626",
"0.569063",
"0.5663217",
"0.5560472",
"0.5520541",
"0.5471246",
"0.5470642",
"0.54595786",
"0.54445577",
"0.54018646",
"0.5377396",
"0.5370092",
"0.5359... | 0.7300358 | 0 |
Build dataset used for foreign key list methods. | def __foreign_key_list_ds(reverse)
if reverse
ctable = Sequel[:att2]
cclass = Sequel[:cl2]
rtable = Sequel[:att]
rclass = Sequel[:cl]
else
ctable = Sequel[:att]
cclass = Sequel[:cl]
rtable = Sequel[:att2]
rclass = Sequel[:cl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _foreign_key_list_ds\n @_foreign_key_list_ds ||= __foreign_key_list_ds(false)\n end",
"def _reverse_foreign_key_list_ds\n @_reverse_foreign_key_list_ds ||= __foreign_key_list_ds(true)\n end",
"def build!(data_set_name)\n interface(data_set_name).create_empty_data_set\n ... | [
"0.6950944",
"0.61976147",
"0.6181576",
"0.57991093",
"0.5773287",
"0.56557083",
"0.5640482",
"0.5637681",
"0.5618548",
"0.5608803",
"0.56053627",
"0.55660987",
"0.5563028",
"0.55293816",
"0.5527643",
"0.55013406",
"0.5487018",
"0.5480283",
"0.5435237",
"0.5426875",
"0.541391... | 0.68358237 | 1 |
Dataset used to retrieve index information | def _indexes_ds
@_indexes_ds ||= begin
if server_version >= 90500
order = [Sequel[:indc][:relname], Sequel.function(:array_position, Sequel[:ind][:indkey], Sequel[:att][:attnum])]
# :nocov:
else
range = 0...32
order = [Sequel[:indc][:relname], SQ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @dataset_data = DatasetDatum.all\n end",
"def indices\n @data.keys\n end",
"def construct_index\n end",
"def dataset(index)\n idx_name = IndexName[index]\n Dataset.new(client, params: { index: idx_name.to_sym })\n end",
"def indexed\n self['indexed']\n end",... | [
"0.71727204",
"0.69043535",
"0.66589785",
"0.6559253",
"0.6507489",
"0.6449275",
"0.6387849",
"0.6387849",
"0.6387849",
"0.63644105",
"0.63298535",
"0.63144547",
"0.6288391",
"0.6281459",
"0.6281459",
"0.6281459",
"0.62788105",
"0.62172794",
"0.62114143",
"0.6202234",
"0.6196... | 0.70689636 | 1 |
Dataset used to determine custom serial sequences for tables | def _select_custom_sequence_ds
@_select_custom_sequence_ds ||= metadata_dataset.
from{pg_class.as(:t)}.
join(:pg_namespace, {:oid => :relnamespace}, :table_alias=>:name).
join(:pg_attribute, {:attrelid => Sequel[:t][:oid]}, :table_alias=>:attr).
join(:pg_attrdef, {:adreli... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _select_serial_sequence_ds\n @_serial_sequence_ds ||= metadata_dataset.\n from{[\n pg_class.as(:seq),\n pg_attribute.as(:attr),\n pg_depend.as(:dep),\n pg_namespace.as(:name),\n pg_constraint.as(:cons),\n pg_class.as(:t)\n ... | [
"0.700258",
"0.56914324",
"0.5634827",
"0.55601764",
"0.55468976",
"0.53256935",
"0.5324605",
"0.52987653",
"0.52987653",
"0.52441895",
"0.52351105",
"0.5192623",
"0.5109223",
"0.5084473",
"0.50460196",
"0.503191",
"0.5023268",
"0.501827",
"0.49391106",
"0.49349368",
"0.49286... | 0.6921501 | 1 |
Dataset used to determine normal serial sequences for tables | def _select_serial_sequence_ds
@_serial_sequence_ds ||= metadata_dataset.
from{[
pg_class.as(:seq),
pg_attribute.as(:attr),
pg_depend.as(:dep),
pg_namespace.as(:name),
pg_constraint.as(:cons),
pg_class.as(:t)
]}.
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _select_custom_sequence_ds\n @_select_custom_sequence_ds ||= metadata_dataset.\n from{pg_class.as(:t)}.\n join(:pg_namespace, {:oid => :relnamespace}, :table_alias=>:name).\n join(:pg_attribute, {:attrelid => Sequel[:t][:oid]}, :table_alias=>:attr).\n join(:pg_attrdef... | [
"0.60077465",
"0.52115154",
"0.5192342",
"0.5162852",
"0.5099557",
"0.5063107",
"0.50618666",
"0.5042069",
"0.5014444",
"0.5005303",
"0.4981823",
"0.49606812",
"0.49182153",
"0.49182153",
"0.49060225",
"0.489107",
"0.48698348",
"0.48606262",
"0.48503137",
"0.48341665",
"0.482... | 0.6579111 | 0 |
Dataset used to determine primary keys for tables | def _select_pk_ds
@_select_pk_ds ||= metadata_dataset.
from(:pg_class, :pg_attribute, :pg_index, :pg_namespace).
where{[
[pg_class[:oid], pg_attribute[:attrelid]],
[pg_class[:relnamespace], pg_namespace[:oid]],
[pg_class[:oid], pg_index[:indrelid]],
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def primary_key(table)\n t = dataset.send(:input_identifier, table)\n @primary_keys.fetch(t) do\n pk = fetch(\"SELECT RDB$FIELD_NAME FROM RDB$INDEX_SEGMENTS NATURAL JOIN RDB$RELATION_CONSTRAINTS WHERE RDB$CONSTRAINT_TYPE = 'PRIMARY KEY' AND RDB$RELATION_NAME = ?\", t).single_value\n ... | [
"0.77333367",
"0.7475051",
"0.7425205",
"0.7375289",
"0.7366104",
"0.72455585",
"0.7180687",
"0.7167466",
"0.7092792",
"0.70765555",
"0.706616",
"0.7043821",
"0.69874865",
"0.68165034",
"0.68044215",
"0.6772434",
"0.67652905",
"0.675731",
"0.67554665",
"0.6754021",
"0.6702185... | 0.75759834 | 1 |
If the :synchronous option is given and nonnil, set synchronous_commit appropriately. Valid values for the :synchronous option are true, :on, false, :off, :local, and :remote_write. | def begin_new_transaction(conn, opts)
super
if opts.has_key?(:synchronous)
case sync = opts[:synchronous]
when true
sync = :on
when false
sync = :off
when nil
return
end
log_connection_execute(conn, "SET LOC... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def synchronous_commit=(value)\n raise ArgumentError, \"argument must be true or false\" unless value == true || value == false\n\n execute \"SET #{'LOCAL' if open_transactions > 0} synchronous_commit TO #{value ? 'ON' : 'OFF'}\"\n end",
"def synchronous!\n @asynchronous = false\n end",
... | [
"0.79772484",
"0.6915001",
"0.59547013",
"0.5716413",
"0.5692907",
"0.5628751",
"0.5575133",
"0.5575133",
"0.5518805",
"0.5504294",
"0.5468508",
"0.53467554",
"0.53143233",
"0.53134865",
"0.52963495",
"0.5211512",
"0.5206623",
"0.51856744",
"0.5146709",
"0.51061195",
"0.50953... | 0.7401804 | 1 |
Set the READ ONLY transaction setting per savepoint, as PostgreSQL supports that. | def begin_savepoint(conn, opts)
super
unless (read_only = opts[:read_only]).nil?
log_connection_execute(conn, "SET TRANSACTION READ #{read_only ? 'ONLY' : 'WRITE'}")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def with_transaction(read_only: false, &block)\n @env.transaction(read_only, &block)\n end",
"def set_transaction_isolation(conn, opts)\n level = opts.fetch(:isolation, transaction_isolation_level)\n read_only = opts[:read_only]\n deferrable = opts[:deferrable]\n if level || !... | [
"0.6960527",
"0.6353735",
"0.62602395",
"0.60868007",
"0.6068373",
"0.60130394",
"0.5990826",
"0.58925563",
"0.5890557",
"0.5845283",
"0.57550824",
"0.57550824",
"0.5740366",
"0.56175214",
"0.56175214",
"0.55855775",
"0.5568516",
"0.5552127",
"0.55378616",
"0.5520403",
"0.550... | 0.7488052 | 0 |
Literalize nonString collate options. This is because unquoted collatations are folded to lowercase, and PostgreSQL used mixed case or capitalized collations. | def column_definition_collate_sql(sql, column)
if collate = column[:collate]
collate = literal(collate) unless collate.is_a?(String)
sql << " COLLATE #{collate}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collation\n nil\n end",
"def collation\n select_value(\n \"SELECT pg_database.datcollate\" <<\n \" FROM pg_database\" <<\n \" WHERE pg_database.datname LIKE '#{current_database}'\",\n 'SCHEMA')\n end",
"def column_definition_collate_sql(sql, column)\n if colla... | [
"0.61051226",
"0.5877964",
"0.584784",
"0.5752945",
"0.5641679",
"0.55594814",
"0.553016",
"0.5495804",
"0.5466278",
"0.5410757",
"0.5399953",
"0.538035",
"0.5236631",
"0.51445156",
"0.5142646",
"0.5113955",
"0.51080203",
"0.51070803",
"0.5061387",
"0.50466436",
"0.50328183",... | 0.5957464 | 1 |
Support identity columns, but only use the identity SQL syntax if no default value is given. | def column_definition_default_sql(sql, column)
super
if !column[:serial] && !['smallserial', 'serial', 'bigserial'].include?(column[:type].to_s) && !column[:default]
if (identity = column[:identity])
sql << " GENERATED "
sql << (identity == :always ? "ALWAYS" : "BY DEFA... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pre_insert(sql, name, pk, id_value, sequence_name)\n @iiTable = get_table_name(sql)\n @iiCol = get_autounique_column(@iiTable)\n @iiEnabled = false\n\n if @iiCol != nil\n if query_contains_autounique_col(sql, @iiCol)\n begin\n @connection.do(enable_identity_insert(@iiTable, tru... | [
"0.6527207",
"0.6237912",
"0.62254494",
"0.619042",
"0.61669624",
"0.61669624",
"0.6040682",
"0.6005519",
"0.6005519",
"0.59868515",
"0.5979152",
"0.59677976",
"0.59677976",
"0.59347665",
"0.58789515",
"0.5854652",
"0.5758402",
"0.57253426",
"0.57253426",
"0.5648476",
"0.5648... | 0.6951704 | 0 |
If the :prepare option is given and we aren't in a savepoint, prepare the transaction for a twophase commit. | def commit_transaction(conn, opts=OPTS)
if (s = opts[:prepare]) && savepoint_level(conn) <= 1
log_connection_execute(conn, "PREPARE TRANSACTION #{literal(s)}")
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_prepare_transaction_commit(unit, transaction); end",
"def commit_transaction(conn, opts=OPTS)\n if in_savepoint?(conn)\n if supports_releasing_savepoints?\n log_connection_yield('Transaction.release_savepoint', conn){conn.release_savepoint(savepoint_obj(conn))}\n end\n ... | [
"0.6718019",
"0.662396",
"0.6306131",
"0.6208742",
"0.61423445",
"0.6091793",
"0.6091793",
"0.6078697",
"0.6044119",
"0.59700394",
"0.5848423",
"0.58226323",
"0.58226323",
"0.57957965",
"0.5729422",
"0.56911594",
"0.56845605",
"0.56661",
"0.56661",
"0.56661",
"0.5664158",
"... | 0.71222514 | 0 |
SQL for doing fast table insert from stdin. | def copy_into_sql(table, opts)
sql = String.new
sql << "COPY #{literal(table)}"
if cols = opts[:columns]
sql << literal(Array(cols))
end
sql << " FROM STDIN"
if opts[:options] || opts[:format]
sql << " ("
sql << "FORMAT #{opts[:format]}" if o... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format table, keys, values\n <<-SQL\nCOPY #{table} (#{keys.join(', ')}) FROM stdin;\n#{values.collect { |row| row.join \"\\t\" }.join \"\\n\"}\n\\\\.\n SQL\n end",
"def fast_insert(rows, base_cmd, end_cmd = '')\n RawDB.fast_insert(db, rows, base_cmd, end_cmd)\n end",
"def row... | [
"0.6569321",
"0.65120876",
"0.6489801",
"0.64708847",
"0.6438791",
"0.63468456",
"0.622612",
"0.6213247",
"0.62104845",
"0.6193804",
"0.61814976",
"0.6177956",
"0.61522686",
"0.6113579",
"0.61133456",
"0.6103705",
"0.6092123",
"0.60913783",
"0.60901535",
"0.60656404",
"0.6050... | 0.6786813 | 0 |
SQL statement to create database function. | def create_function_sql(name, definition, opts=OPTS)
args = opts[:args]
if !opts[:args].is_a?(Array) || !opts[:args].any?{|a| Array(a).length == 3 and %w'OUT INOUT'.include?(a[2].to_s)}
returns = opts[:returns] || 'void'
end
language = opts[:language] || 'SQL'
<<-END
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n\t\t\"db_fun\"\n\tend",
"def create_function(name, definition, opts=OPTS)\n self << create_function_sql(name, definition, opts)\n end",
"def function(name, *args)\n SQL::Function.new(name, *args)\n end",
"def create_function(function_name, returning, definition, options = {}... | [
"0.73484826",
"0.72461474",
"0.72118765",
"0.7096132",
"0.7025482",
"0.6792593",
"0.64558375",
"0.64074355",
"0.6336611",
"0.63190633",
"0.63179994",
"0.6292024",
"0.6202775",
"0.6190527",
"0.61772263",
"0.61308116",
"0.61014944",
"0.6098711",
"0.6088275",
"0.60713166",
"0.60... | 0.7258271 | 1 |
SQL for creating a procedural language. | def create_language_sql(name, opts=OPTS)
"CREATE#{' OR REPLACE' if opts[:replace] && server_version >= 90000}#{' TRUSTED' if opts[:trusted]} LANGUAGE #{name}#{" HANDLER #{opts[:handler]}" if opts[:handler]}#{" VALIDATOR #{opts[:validator]}" if opts[:validator]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_language(name, opts=OPTS)\n self << create_language_sql(name, opts)\n end",
"def make_statement\n end",
"def make_statement\n end",
"def sql\n @parser.sql\n end",
"def sql\n @parser.sql\n end",
"def add_code(cheatsheet_db, language, type, code, comment)\n cheatsh... | [
"0.61669266",
"0.6121147",
"0.6121147",
"0.59831965",
"0.59831965",
"0.58226854",
"0.57331324",
"0.5722036",
"0.5647145",
"0.56217813",
"0.5590047",
"0.55899316",
"0.55826867",
"0.557583",
"0.55719095",
"0.5558236",
"0.55524683",
"0.5549",
"0.55081385",
"0.54753685",
"0.54551... | 0.71067977 | 0 |
SQL for creating a partition of another table. | def create_partition_of_table_sql(name, generator, options)
sql = create_table_prefix_sql(name, options).dup
sql << " PARTITION OF #{quote_schema_table(options[:partition_of])}"
case generator.partition_type
when :range
from, to = generator.range
sql << " FOR VALUES... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_partition_of_table_from_generator(name, generator, options)\n execute_ddl(create_partition_of_table_sql(name, generator, options))\n end",
"def create_range_partition(table_name, options, &block)\n raise ArgumentError, 'partition_key must be defined' if options[:partition_key].nil?\n\... | [
"0.7089116",
"0.6901333",
"0.668798",
"0.6673402",
"0.6528554",
"0.64039016",
"0.62698126",
"0.62523615",
"0.6106679",
"0.60739046",
"0.6064444",
"0.6059633",
"0.60556954",
"0.6045033",
"0.60409546",
"0.59562093",
"0.5860424",
"0.5821033",
"0.5763657",
"0.57181513",
"0.569176... | 0.7671302 | 0 |
DDL fragment for initial part of CREATE VIEW statement | def create_view_prefix_sql(name, options)
sql = create_view_sql_append_columns("CREATE #{'OR REPLACE 'if options[:replace]}#{'TEMPORARY 'if options[:temp]}#{'RECURSIVE ' if options[:recursive]}#{'MATERIALIZED ' if options[:materialized]}VIEW #{quote_schema_table(name)}", options[:columns] || options[:recursive]... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_view_prefix_sql(name, options)\n create_view_sql_append_columns(\"CREATE #{'OR REPLACE 'if options[:replace]}VIEW #{quote_schema_table(name)}\", options[:columns])\n end",
"def create_view(name, source)\n source = source.sql if source.is_a?(Dataset)\n execute(\"CREATE VIEW #{name} AS... | [
"0.76422477",
"0.7080754",
"0.69882655",
"0.6876096",
"0.6707558",
"0.6691078",
"0.66169316",
"0.6589881",
"0.65825975",
"0.6561772",
"0.6553956",
"0.638153",
"0.6370509",
"0.6340597",
"0.62826496",
"0.6160476",
"0.615917",
"0.61341274",
"0.601144",
"0.5997561",
"0.5932272",
... | 0.7618731 | 1 |
SQL for dropping a function from the database. | def drop_function_sql(name, opts=OPTS)
"DROP FUNCTION#{' IF EXISTS' if opts[:if_exists]} #{name}#{sql_function_args(opts[:args])}#{' CASCADE' if opts[:cascade]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sql_for_remove\n \"DROP FUNCTION IF EXISTS #{proname}(#{get_function_args})\"\n end",
"def drop_function(name, opts=OPTS)\n self << drop_function_sql(name, opts)\n end",
"def drop_function(function_name, options = {})\n function_name = full_function_name(function_name, options)\n\n ... | [
"0.8369946",
"0.80704874",
"0.8003502",
"0.7982197",
"0.7879706",
"0.76229805",
"0.76229805",
"0.75548965",
"0.7380597",
"0.71375334",
"0.71096754",
"0.70644176",
"0.68965197",
"0.68872184",
"0.68156517",
"0.6793039",
"0.67553425",
"0.6700025",
"0.66806155",
"0.66347694",
"0.... | 0.8339578 | 1 |
SQL for dropping a procedural language from the database. | def drop_language_sql(name, opts=OPTS)
"DROP LANGUAGE#{' IF EXISTS' if opts[:if_exists]} #{name}#{' CASCADE' if opts[:cascade]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_language(name, opts=OPTS)\n self << drop_language_sql(name, opts)\n end",
"def drop_sql\n raise NotImplementedError, \"DatabaseSymbol should not be instanciated\"\n end",
"def drop_database_sql(name, opts = {})\n \"DROP DATABASE #{quote_identifier(name)}\"\n end",
"def to_dro... | [
"0.74222535",
"0.68442863",
"0.6644301",
"0.6460011",
"0.6444636",
"0.6371063",
"0.6324901",
"0.6263596",
"0.6263596",
"0.6256065",
"0.6241722",
"0.62375337",
"0.620885",
"0.6179907",
"0.61783373",
"0.6157233",
"0.6125394",
"0.60962826",
"0.60942584",
"0.607084",
"0.60548294"... | 0.81428945 | 0 |
SQL for dropping a schema from the database. | def drop_schema_sql(name, opts=OPTS)
"DROP SCHEMA#{' IF EXISTS' if opts[:if_exists]} #{quote_identifier(name)}#{' CASCADE' if opts[:cascade]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_schema_sql(name, opts = {})\n \"DROP SCHEMA #{quote_identifier(name)}\"\n end",
"def drop_schema schema_name\n execute \"DROP SCHEMA #{schema_name} CASCADE\"\n end",
"def drop_schema_sql(name, opts = {})\n \"DROP SCHEMA #{quote_identifier(name)} CASCADE\"\n end",
"def dro... | [
"0.8680619",
"0.85794634",
"0.85016835",
"0.84340376",
"0.8426357",
"0.829404",
"0.82850105",
"0.8108252",
"0.80193865",
"0.8011835",
"0.77801085",
"0.74915457",
"0.7473172",
"0.746467",
"0.74538666",
"0.7438913",
"0.7438811",
"0.73444384",
"0.73317754",
"0.7308943",
"0.72807... | 0.86468154 | 1 |
SQL for dropping a trigger from the database. | def drop_trigger_sql(table, name, opts=OPTS)
"DROP TRIGGER#{' IF EXISTS' if opts[:if_exists]} #{name} ON #{quote_schema_table(table)}#{' CASCADE' if opts[:cascade]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_trigger(table_name, trigger_name, options = {})\n SchemaMonkey::Middleware::Migration::CreateTrigger.start(connection: self, table_name: table_name, trigger_name: trigger_name, options: options) do |env|\n table_name = env.table_name\n trigger_name = env.trigger_name\n ... | [
"0.8119375",
"0.7688167",
"0.76867425",
"0.7282038",
"0.7202269",
"0.71872044",
"0.71872044",
"0.7185238",
"0.67402",
"0.658491",
"0.65673536",
"0.6561976",
"0.649828",
"0.6490543",
"0.6459425",
"0.6437757",
"0.6430077",
"0.64237756",
"0.6383998",
"0.6349056",
"0.63020337",
... | 0.82029164 | 0 |
SQL for dropping a view from the database. | def drop_view_sql(name, opts=OPTS)
"DROP #{'MATERIALIZED ' if opts[:materialized]}VIEW#{' IF EXISTS' if opts[:if_exists]} #{quote_schema_table(name)}#{' CASCADE' if opts[:cascade]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drop_view(name)\n execute(\"DROP VIEW #{name}\")\n end",
"def drop_view_sql(name, options)\n \"DROP VIEW#{' IF EXISTS' if options[:if_exists]} #{quote_schema_table(name)}#{' CASCADE' if options[:cascade]}\"\n end",
"def drop_view(view_name, options = {})\n SchemaMonkey::Middleware:... | [
"0.8725758",
"0.8525937",
"0.83034474",
"0.8208464",
"0.796217",
"0.7813755",
"0.779644",
"0.72723156",
"0.68422073",
"0.6783589",
"0.6363096",
"0.63456047",
"0.63331085",
"0.62820417",
"0.62791556",
"0.62631696",
"0.6211049",
"0.6098684",
"0.6076997",
"0.6065854",
"0.6051685... | 0.86309105 | 1 |
If opts includes a :schema option, use it, otherwise restrict the filter to only the currently visible schemas. | def filter_schema(ds, opts)
expr = if schema = opts[:schema]
schema.to_s
else
Sequel.function(:any, Sequel.function(:current_schemas, false))
end
ds.where{{pg_namespace[:nspname]=>expr}}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_shema(schema)\n schema.filter{|obj| include?(obj)}\n end",
"def schema_ds_filter(table_name, opts)\n if table_name\n [{:c__table_name=>table_name.to_s}]\n else\n [{:t__table_type=>'BASE TABLE'}]\n end\n end",
"def skip_schema_queries=(_arg0... | [
"0.60258114",
"0.5587685",
"0.53232336",
"0.53136456",
"0.5252506",
"0.5210141",
"0.5191124",
"0.516309",
"0.51339316",
"0.5003855",
"0.49896494",
"0.49556172",
"0.49474233",
"0.4935256",
"0.49325764",
"0.49156702",
"0.48878336",
"0.4864185",
"0.4861228",
"0.48379704",
"0.483... | 0.72058666 | 0 |
Setup datastructures shared by all postgres adapters. | def initialize_postgres_adapter
@primary_keys = {}
@primary_key_sequences = {}
@supported_types = {}
procs = @conversion_procs = CONVERSION_PROCS.dup
procs[1184] = procs[1114] = method(:to_application_timestamp)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_database\n require \"sequel\"\n\n options = {\n :max_connections => 16,\n :pool_timeout => 240\n }\n\n database_config = YAML.load_file(\"#{$intrigue_basedir}/config/database.yml\")\n database_host = database_config[$intrigue_environment][\"host\"] || \"localhost\"\n database_port = database_... | [
"0.6303121",
"0.62652934",
"0.6196027",
"0.60925674",
"0.60923743",
"0.6072901",
"0.5956406",
"0.59346074",
"0.5915412",
"0.58782214",
"0.58357775",
"0.5783705",
"0.5774008",
"0.5756109",
"0.57473207",
"0.574559",
"0.5708784",
"0.5698038",
"0.56972337",
"0.5685741",
"0.566666... | 0.68285835 | 0 |
Return an expression the oid for the table expr. Used by the metadata parsing code to disambiguate unqualified tables. | def regclass_oid(expr, opts=OPTS)
if expr.is_a?(String) && !expr.is_a?(LiteralString)
expr = Sequel.identifier(expr)
end
sch, table = schema_and_table(expr)
sch ||= opts[:schema]
if sch
expr = Sequel.qualify(sch, table)
end
expr = if ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def table\n if @table_expr.is_a?(AliasedExpression)\n @table_expr.expression\n else\n @table_expr\n end\n end",
"def table_alias\n if @table_expr.is_a?(AliasedExpression)\n @table_expr.alias\n end\n end",
"def expanded_identifier\n ... | [
"0.6339249",
"0.6206004",
"0.5620424",
"0.53660464",
"0.5346105",
"0.5278037",
"0.52770036",
"0.52121466",
"0.50888646",
"0.5088609",
"0.50797004",
"0.50403136",
"0.50403136",
"0.502814",
"0.5012339",
"0.49936682",
"0.49752772",
"0.49023044",
"0.48680702",
"0.4855873",
"0.485... | 0.6270272 | 1 |
Remove the cached entries for primary keys and sequences when a table is changed. | def remove_cached_schema(table)
tab = quote_schema_table(table)
Sequel.synchronize do
@primary_keys.delete(tab)
@primary_key_sequences.delete(tab)
end
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_cached_schema(table)\n tab = quote_schema_table(table)\n Sequel.synchronize do\n @primary_keys.delete(tab)\n end\n super\n end",
"def clean\n disable_referential_integrity do\n tables_cache.keys.reverse_each do |table|\n ActiveRecord... | [
"0.71739537",
"0.6630591",
"0.65746415",
"0.6339876",
"0.63392925",
"0.6294856",
"0.62028897",
"0.6157955",
"0.61444277",
"0.60552055",
"0.60023355",
"0.60008526",
"0.5963297",
"0.5955787",
"0.59497863",
"0.5938426",
"0.59146667",
"0.59047925",
"0.5871068",
"0.5853251",
"0.58... | 0.7296072 | 0 |
Handle interval and citext types. | def schema_column_type(db_type)
case db_type
when /\Ainterval\z/io
:interval
when /\Acitext\z/io
:string
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getIntervalType\n\t\t# get the interval type from settings\n\t\t# currently not implemented. It will useful in future\n\t\tintervalType = 'W'\n\t\tintervalType\n\tend",
"def nonregular_type; end",
"def handle_ts\n handle_at\n handle_in\n @time_special = @tokens[@index].get_tag(TimeSpecial).t... | [
"0.5744355",
"0.57287997",
"0.56326085",
"0.5621758",
"0.5467443",
"0.54393935",
"0.5346401",
"0.5315598",
"0.53015447",
"0.52042335",
"0.51975113",
"0.51377654",
"0.5134359",
"0.51323223",
"0.50979125",
"0.50302005",
"0.50287396",
"0.5001532",
"0.49825865",
"0.49769452",
"0.... | 0.60351527 | 0 |
The schema :type entry to use for array types. | def schema_array_type(db_type)
:array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array_type?\n type = self.sexp_type\n @@array_types.include? type\n end",
"def specimen_array_type=(type)\n setSpecimenArrayType(type)\n unless type.nil? then\n copy_container_type_capacity\n end\n type\n end",
"def datatypes\n value.document.fetch(\"#{value.key}... | [
"0.6450744",
"0.6379572",
"0.63508356",
"0.625358",
"0.6250903",
"0.6245001",
"0.6201754",
"0.61653715",
"0.61405534",
"0.6108816",
"0.61036503",
"0.60928565",
"0.60765946",
"0.60398626",
"0.6015898",
"0.5971627",
"0.59705085",
"0.5964192",
"0.5859733",
"0.5846391",
"0.584043... | 0.81926167 | 0 |
The schema :type entry to use for row/composite types. | def schema_composite_type(db_type)
:composite
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schema_composite_type(db_type)\n @row_schema_types[db_type] || super\n end",
"def inheritance_column\n \"type\"\n end",
"def type\n self['type']\n end",
"def type\n self['type']['type']\n end",
"def type ; metadata[:type] ; end",
"def type_schema\n ... | [
"0.7407996",
"0.6968629",
"0.6907057",
"0.67898774",
"0.6775752",
"0.6767818",
"0.6758813",
"0.6750373",
"0.6736719",
"0.67302775",
"0.6687589",
"0.6660528",
"0.66603494",
"0.66603494",
"0.66603494",
"0.6624262",
"0.6578886",
"0.6575831",
"0.65535015",
"0.6541125",
"0.6524185... | 0.7014892 | 1 |
The schema :type entry to use for enum types. | def schema_enum_type(db_type)
:enum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schema_type(column)\n column.type == :enum_set ? :enum : super\n end",
"def type\n self.class.type_enum_map.key(@cred_struct[:type])\n end",
"def enum_types\n @enum_types ||= schemas.map do |namespace, schema|\n schema.enum_types.map do |name, enum_type|\n [... | [
"0.70020103",
"0.67391855",
"0.6676959",
"0.6676959",
"0.65402603",
"0.65355814",
"0.6528048",
"0.6519687",
"0.6457913",
"0.63885754",
"0.6387319",
"0.6386674",
"0.63202965",
"0.6282332",
"0.6236421",
"0.6234482",
"0.62296706",
"0.62296706",
"0.62296706",
"0.61989784",
"0.619... | 0.8054382 | 0 |
The schema :type entry to use for range types. | def schema_range_type(db_type)
:range
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schema_multirange_type(db_type)\n :multirange\n end",
"def index\n @range_types = RangeType.all\n end",
"def schema_column_type(db_type)\n case db_type\n when /\\Ainterval\\z/io\n :interval\n when /\\Acitext\\z/io\n :string\n else\n sup... | [
"0.71249956",
"0.63931143",
"0.63107294",
"0.62629265",
"0.60207546",
"0.60207546",
"0.60207546",
"0.60200715",
"0.601815",
"0.59934384",
"0.59934384",
"0.5989703",
"0.5982694",
"0.5975312",
"0.5952823",
"0.59515506",
"0.59414446",
"0.5932852",
"0.59324676",
"0.5932421",
"0.5... | 0.8037973 | 0 |
The schema :type entry to use for multirange types. | def schema_multirange_type(db_type)
:multirange
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def schema_range_type(db_type)\n :range\n end",
"def schema_column_type(db_type)\n case db_type\n when /\\Ainterval\\z/io\n :interval\n when /\\Acitext\\z/io\n :string\n else\n super\n end\n end",
"def type\n self['type']['type... | [
"0.6891105",
"0.6131667",
"0.6009287",
"0.5958005",
"0.5958005",
"0.5958005",
"0.5958005",
"0.5958005",
"0.5939438",
"0.5932011",
"0.59073764",
"0.58985317",
"0.58985317",
"0.58985317",
"0.5897736",
"0.58881843",
"0.583995",
"0.5836035",
"0.58355254",
"0.58355254",
"0.5835525... | 0.808547 | 0 |
Set the transaction isolation level on the given connection | def set_transaction_isolation(conn, opts)
level = opts.fetch(:isolation, transaction_isolation_level)
read_only = opts[:read_only]
deferrable = opts[:deferrable]
if level || !read_only.nil? || !deferrable.nil?
sql = String.new
sql << "SET TRANSACTION"
sql <<... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_transaction_isolation(conn, opts)\n level = opts.fetch(:isolation, transaction_isolation_level)\n if (jdbc_level = JDBC_TRANSACTION_ISOLATION_LEVELS[level]) &&\n conn.getMetaData.supportsTransactionIsolationLevel(jdbc_level)\n _trans(conn)[:original_jdbc_isolation_level] =... | [
"0.78659075",
"0.6963964",
"0.6858327",
"0.6758857",
"0.6758857",
"0.6613616",
"0.657389",
"0.65524185",
"0.62963855",
"0.6283287",
"0.6274031",
"0.6241779",
"0.6174861",
"0.616061",
"0.6112377",
"0.59543675",
"0.58255845",
"0.58255845",
"0.56776065",
"0.56605256",
"0.5651041... | 0.7724414 | 1 |
Turns an array of argument specifiers into an SQL fragment used for function arguments. See create_function_sql. | def sql_function_args(args)
"(#{Array(args).map{|a| Array(a).reverse.join(' ')}.join(', ')})"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def function_sql(f)\n args = f.args\n \"#{f.f}#{args.empty? ? '()' : literal(args)}\"\n end",
"def irregular_function_sql(f)\n \"#{f.f}(#{literal(f.arg1)} #{f.joiner} #{literal(f.arg2)})\"\n end",
"def compose_sql_array(ary)\n statement, *values = ary\n if values.first.is_a?(Hash... | [
"0.68161327",
"0.6770824",
"0.6261491",
"0.6212632",
"0.6161116",
"0.59570205",
"0.58529675",
"0.58524",
"0.5774345",
"0.5739209",
"0.5678828",
"0.56407475",
"0.5639164",
"0.5581457",
"0.55652213",
"0.5481259",
"0.5450736",
"0.5443238",
"0.5410283",
"0.53626436",
"0.5294864",... | 0.7663649 | 0 |
PostgreSQL can combine multiple alter table ops into a single query. | def supports_combining_alter_table_ops?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_alter_table(name, ops)\n alter_table_sql_list(name, ops).each{|sql| execute_ddl(sql)}\n end",
"def alter_table_sql_list(table, operations)\n operations.map{|op| alter_table_sql(table, op)}\n end",
"def alter_table_sql_list(table, operations)\n operations.map{|op| alter_table_sq... | [
"0.7256814",
"0.68517065",
"0.68125564",
"0.68125564",
"0.67696595",
"0.67665815",
"0.6752053",
"0.67360526",
"0.67310065",
"0.6724511",
"0.669938",
"0.66552204",
"0.6649486",
"0.6588922",
"0.6582951",
"0.6451879",
"0.64394355",
"0.62767357",
"0.60828197",
"0.5993038",
"0.598... | 0.69321823 | 1 |
Handle bigserial type if :serial option is present | def type_literal_generic_bignum_symbol(column)
column[:serial] ? :bigserial : super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supports_serial?\n true\n end",
"def type_literal_generic_bignum(column)\n column[:serial] ? :bigserial : super\n end",
"def type_literal_generic_integer(column)\n column[:serial] ? :serial : super\n end",
"def type_literal_generic_integer(column)\n column[:... | [
"0.68647045",
"0.6242564",
"0.5943363",
"0.5943363",
"0.57919806",
"0.5643944",
"0.5643944",
"0.5393611",
"0.5393611",
"0.5379735",
"0.5183374",
"0.5166281",
"0.512758",
"0.506078",
"0.506078",
"0.50425655",
"0.5034772",
"0.49538374",
"0.49437237",
"0.4926396",
"0.4922839",
... | 0.63120544 | 1 |
PostgreSQL uses the bytea data type for blobs | def type_literal_generic_file(column)
:bytea
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def typecast_value_blob(value)\n value.is_a?(Sequel::SQL::Blob) ? value : Sequel::SQL::Blob.new(value)\n end",
"def type_literal_generic_file(column)\n :blob\n end",
"def blob(s)\n if s.is_a?(SQL::Blob)\n s\n else\n SQL::Blob.new(s)\n end\n end",
"d... | [
"0.748311",
"0.7277911",
"0.6994736",
"0.68574053",
"0.6844959",
"0.6844959",
"0.6809552",
"0.6809552",
"0.6809552",
"0.6809552",
"0.6809552",
"0.6809552",
"0.674962",
"0.66967905",
"0.66562515",
"0.64659435",
"0.6404109",
"0.62737864",
"0.6272902",
"0.6261824",
"0.621018",
... | 0.734235 | 1 |
PostgreSQL prefers the text datatype. If a fixed size is requested, the char type is used. If the text type is specifically disallowed or there is a size specified, use the varchar type. Otherwise use the text type. | def type_literal_generic_string(column)
if column[:text]
:text
elsif column[:fixed]
"char(#{column[:size]||default_string_column_size})"
elsif column[:text] == false || column[:size]
"varchar(#{column[:size]||default_string_column_size})"
else
:tex... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type_literal_generic_string(column)\n if column[:text]\n uses_clob_for_text? ? :clob : :text\n elsif column[:fixed]\n \"char(#{column[:size]||default_string_column_size})\"\n else\n \"varchar(#{column[:size]||default_string_column_size})\"\n end\n end",
"def revert... | [
"0.7334014",
"0.70625246",
"0.69362247",
"0.6559399",
"0.65411496",
"0.65359974",
"0.6518442",
"0.6473457",
"0.64247924",
"0.637079",
"0.63639545",
"0.6286142",
"0.62203",
"0.6183551",
"0.6152284",
"0.5986913",
"0.59777796",
"0.5955377",
"0.58920866",
"0.58748233",
"0.5829819... | 0.76549566 | 0 |
Return the results of an EXPLAIN ANALYZE query as a string | def analyze
explain(:analyze=>true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def explain(opts=OPTS)\n with_sql((opts[:analyze] ? 'EXPLAIN ANALYZE ' : 'EXPLAIN ') + select_sql).map(:'QUERY PLAN').join(\"\\r\\n\")\n end",
"def explain(arel, binds = [])\n sql = \"EXPLAIN #{to_sql(arel, binds)}\"\n ExplainPrettyPrinter.new.pp(exec_query(sql, 'EXPLAIN', binds))\n... | [
"0.6823953",
"0.6274661",
"0.6253358",
"0.610667",
"0.59947056",
"0.5803804",
"0.5746523",
"0.57279754",
"0.5630922",
"0.54320306",
"0.54110736",
"0.53897107",
"0.5338646",
"0.53190017",
"0.5312021",
"0.5312021",
"0.52763075",
"0.5218137",
"0.5196163",
"0.5192691",
"0.5188185... | 0.65946364 | 1 |
Disables automatic use of INSERT ... RETURNING. You can still use returning manually to force the use of RETURNING when inserting. This is designed for cases where INSERT RETURNING cannot be used, such as when you are using partitioning with trigger functions or conditional rules, or when you are using a PostgreSQL ver... | def disable_insert_returning
clone(:disable_insert_returning=>true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insert(*values)\n if @opts[:returning]\n # Already know which columns to return, let the standard code handle it\n super\n elsif @opts[:sql] || @opts[:disable_insert_returning]\n # Raw SQL used or RETURNING disabled, just use the default behavior\n # and return... | [
"0.7477058",
"0.74615633",
"0.67061794",
"0.67061794",
"0.6439445",
"0.6295529",
"0.6289652",
"0.6255195",
"0.61770976",
"0.61770976",
"0.60041326",
"0.5992589",
"0.591023",
"0.5897336",
"0.58321005",
"0.5752475",
"0.5752475",
"0.5746446",
"0.57223964",
"0.5720864",
"0.568285... | 0.7500883 | 0 |
Return the results of an EXPLAIN query as a string | def explain(opts=OPTS)
with_sql((opts[:analyze] ? 'EXPLAIN ANALYZE ' : 'EXPLAIN ') + select_sql).map(:'QUERY PLAN').join("\r\n")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def explain(arel, binds = [])\n sql = \"EXPLAIN #{to_sql(arel, binds)}\"\n ExplainPrettyPrinter.new.pp(exec_query(sql, 'EXPLAIN', binds))\n end",
"def explain(arel, binds = [])\n sql = \"EXPLAIN #{to_sql(arel, binds)}\"\n exec_query(sql, 'EXPLAIN', binds)\n end",... | [
"0.62896997",
"0.61405456",
"0.6137911",
"0.61045426",
"0.5910226",
"0.5868275",
"0.58225495",
"0.5781028",
"0.5762791",
"0.5762791",
"0.5680385",
"0.55741733",
"0.55477244",
"0.55167836",
"0.54632753",
"0.54311174",
"0.5333425",
"0.53226453",
"0.53095716",
"0.52411693",
"0.5... | 0.68310505 | 0 |
Run a full text search on PostgreSQL. By default, searching for the inclusion of any of the terms in any of the cols. Options: :headline :: Append a expression to the selected columns aliased to headline that contains an extract of the matched text. :language :: The language to use for the search (default: 'simple') :p... | def full_text_search(cols, terms, opts = OPTS)
lang = Sequel.cast(opts[:language] || 'simple', :regconfig)
unless opts[:tsvector]
phrase_cols = full_text_string_join(cols)
cols = Sequel.function(:to_tsvector, lang, phrase_cols)
end
unless opts[:tsquery]
ph... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_text_search(cols, terms, opts = {})\n filter(\"CONTAINS (#{literal(cols)}, #{literal(terms)})\")\n end",
"def fulltext_search(search_string)\n\n # Strip out !, (), &, and |, because these are search vector control characters\n # Remove extra spaces\n search_string = search_str... | [
"0.8264869",
"0.6610546",
"0.6217637",
"0.60479075",
"0.6005078",
"0.59993774",
"0.59954834",
"0.5823916",
"0.5810335",
"0.57882714",
"0.57503736",
"0.57445025",
"0.5727415",
"0.5721591",
"0.5706118",
"0.5620432",
"0.5587604",
"0.55812776",
"0.5575823",
"0.5558891",
"0.555722... | 0.88017637 | 0 |
Support SQL::AliasedExpression as expr to setup a USING join with a table alias for the USING columns. | def join_table(type, table, expr=nil, options=OPTS, &block)
if expr.is_a?(SQL::AliasedExpression) && expr.expression.is_a?(Array) && !expr.expression.empty? && expr.expression.all?
options = options.merge(:join_using=>true)
end
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join_using_clause_using_sql_append(sql, using_columns)\n if using_columns.is_a?(SQL::AliasedExpression)\n super(sql, using_columns.expression)\n sql << ' AS '\n identifier_append(sql, using_columns.alias)\n else\n super\n end\n end",
"def table_al... | [
"0.7116942",
"0.6341112",
"0.6315534",
"0.61744845",
"0.61428946",
"0.5945142",
"0.5900595",
"0.5848707",
"0.5788944",
"0.5637029",
"0.5637029",
"0.55842906",
"0.5584003",
"0.5542869",
"0.55291176",
"0.5422773",
"0.539866",
"0.53588843",
"0.53473353",
"0.5325972",
"0.53084874... | 0.694539 | 1 |
Locks all tables in the dataset's FROM clause (but not in JOINs) with the specified mode (e.g. 'EXCLUSIVE'). If a block is given, starts a new transaction, locks the table, and yields. If a block is not given, just locks the tables. Note that PostgreSQL will probably raise an error if you lock the table outside of an e... | def lock(mode, opts=OPTS)
if defined?(yield) # perform locking inside a transaction and yield to block
@db.transaction(opts){lock(mode, opts); yield}
else
sql = 'LOCK TABLE '.dup
source_list_append(sql, @opts[:from])
mode = mode.to_s.upcase.strip
unless ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock(mode, &block)\n sql = LOCK % [source_list(@opts[:from]), mode]\n @db.synchronize do\n if block # perform locking inside a transaction and yield to block\n @db.transaction {@db.execute(sql); yield}\n else\n @db.execute(sql) # lock without a transaction\... | [
"0.80996597",
"0.79946315",
"0.6768143",
"0.6706339",
"0.6692717",
"0.64592165",
"0.63696915",
"0.6278538",
"0.61654204",
"0.6085429",
"0.5980977",
"0.5813835",
"0.5738062",
"0.5736289",
"0.5650982",
"0.5603849",
"0.5572628",
"0.54926866",
"0.5452597",
"0.54325897",
"0.539995... | 0.8043198 | 1 |
DISTINCT ON is a PostgreSQL extension | def supports_distinct_on?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def distinct\n with_opts(:distinct=>true)\n end",
"def merge_distinct_on\n return if other.distinct_on_values.blank?\n relation.distinct_on_values += other.distinct_on_values\n end",
"def query_all(args = {})\n query(args.merge(select: \"DISTINCT #{model.table_name... | [
"0.67026377",
"0.64181125",
"0.6210453",
"0.6127123",
"0.6123081",
"0.58022785",
"0.57420564",
"0.5667245",
"0.5633823",
"0.556171",
"0.556171",
"0.5497905",
"0.5404564",
"0.54010093",
"0.5378762",
"0.53698623",
"0.53211236",
"0.5319152",
"0.5245783",
"0.52205163",
"0.5183464... | 0.737513 | 0 |
True unless insert returning has been disabled for this dataset. | def supports_insert_select?
!@opts[:disable_insert_returning]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_insert?\n !use_copy?\n end",
"def insertable?\n persistable? && !_assigning? && inserts_valid\n end",
"def _use_insert_select?(ds)\n (!ds.opts[:select] || ds.opts[:returning]) && ds.supports_insert_select? \n end",
"def _use_insert_select?(ds)\n (!ds.opts[:s... | [
"0.68219227",
"0.6537745",
"0.6484788",
"0.6484788",
"0.64069223",
"0.6354706",
"0.6287502",
"0.62571484",
"0.6256194",
"0.62128913",
"0.61805964",
"0.61404204",
"0.61000156",
"0.608905",
"0.60511166",
"0.6009329",
"0.5975124",
"0.5947837",
"0.5921701",
"0.5902638",
"0.589971... | 0.6667171 | 1 |
PostgreSQL supports modifying joined datasets | def supports_modifying_joins?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def def_many_to_many(opts)\n super\n def_association_pks_getter(opts) do\n _join_table_dataset(opts).filter(opts[:left_key]=>send(opts[:left_primary_key])).select_map(opts[:right_key])\n end\n def_association_pks_setter(opts) do |pks|\n checked_transaction ... | [
"0.59809345",
"0.59600765",
"0.58247083",
"0.58247083",
"0.5726891",
"0.5717141",
"0.568549",
"0.5677487",
"0.5632732",
"0.5618993",
"0.5600694",
"0.559718",
"0.55618924",
"0.5530125",
"0.5509987",
"0.54918057",
"0.54159164",
"0.54155934",
"0.5400182",
"0.53923464",
"0.538741... | 0.59849083 | 0 |
PostgreSQL supports timezones in literal timestamps | def supports_timestamp_timezones?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data_timezone(identifier); end",
"def data_timezone(identifier); end",
"def time_zone=(_arg0); end",
"def time_zone=(_arg0); end",
"def timezone(identifier); end",
"def timezone(identifier); end",
"def timezone(identifier); end",
"def data_timezone_identifiers; end",
"def data_timezone_identifi... | [
"0.6196883",
"0.6196883",
"0.61800057",
"0.61800057",
"0.61647296",
"0.61647296",
"0.61647296",
"0.5974996",
"0.5974996",
"0.5974996",
"0.5974996",
"0.5974996",
"0.5974996",
"0.5963424",
"0.5963424",
"0.5963424",
"0.5963424",
"0.5883919",
"0.58165675",
"0.58165675",
"0.581656... | 0.7225166 | 1 |
Append the INSERT sql used in a MERGE | def _merge_insert_sql(sql, data)
sql << " THEN INSERT "
columns, values = _parse_insert_sql_args(data[:values])
_insert_columns_sql(sql, columns)
if override = data[:override]
sql << override
end
_insert_values_sql(sql, values)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_insert(*values, &block)\n h = {:type=>:insert, :values=>values}\n if override = @opts[:override]\n h[:override] = insert_override_sql(String.new)\n end\n _merge_when(h, &block)\n end",
"def insert_conflict_sql(sql)\n if opts = @opts[:insert_conflict]\n ... | [
"0.7337785",
"0.7198908",
"0.71126693",
"0.707527",
"0.68403673",
"0.6808274",
"0.6782001",
"0.65473086",
"0.64943826",
"0.6456124",
"0.6433498",
"0.6402454",
"0.6376985",
"0.63509864",
"0.6320931",
"0.6320931",
"0.626627",
"0.6218312",
"0.621048",
"0.6189745",
"0.61735564",
... | 0.80021787 | 0 |
Format TRUNCATE statement with PostgreSQL specific options. | def _truncate_sql(table)
to = @opts[:truncate_opts] || OPTS
"TRUNCATE TABLE#{' ONLY' if to[:only]} #{table}#{' RESTART IDENTITY' if to[:restart]}#{' CASCADE' if to[:cascade]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notice_nosql_statement(nosql_statement)\n return unless record_sql?\n\n @nosql_statement = Database.truncate_query(nosql_statement)\n nil\n end",
"def truncate_table\n\t\t\t transaction { connection.execute(\"TRUNCATE TABLE #{quoted_table_name};\") }\n\t\t end",
"def exe... | [
"0.5507991",
"0.54600996",
"0.5273651",
"0.5187143",
"0.50678164",
"0.4914534",
"0.48577395",
"0.48543635",
"0.4853718",
"0.4715146",
"0.47071767",
"0.46592757",
"0.46435788",
"0.46198285",
"0.45876056",
"0.45748812",
"0.4544344",
"0.45238018",
"0.4521532",
"0.45109248",
"0.4... | 0.6143214 | 0 |
Use from_self for aggregate dataset using VALUES. | def aggreate_dataset_use_from_self?
super || @opts[:values]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def aggregate_values(rows)\n # Convert rows into hash where each key is a column name and the each\n # value is an array of values for that column\n cols = OrderedHash.new\n rows.each do |row|\n row.each do |k,v|\n cols[k] ||= []\n cols[k] << v\n ... | [
"0.55833846",
"0.55151165",
"0.5500441",
"0.5476202",
"0.54460794",
"0.5347169",
"0.5315667",
"0.5272025",
"0.5245065",
"0.5163853",
"0.51637846",
"0.51460284",
"0.5136454",
"0.5136451",
"0.51340026",
"0.51255244",
"0.5118315",
"0.5113868",
"0.51118565",
"0.5096498",
"0.50929... | 0.64051324 | 0 |
Use USING to specify additional tables in a delete query | def delete_using_sql(sql)
join_from_sql(:USING, sql)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_sql(opts = nil)\n opts = opts ? @opts.merge(opts) : @opts\n\n if opts[:group]\n raise Error::InvalidOperation, \"Grouped datasets cannot be deleted from\"\n elsif opts[:from].is_a?(Array) && opts[:from].size > 1\n raise Error::InvalidOperation, \"Joined datasets cannot be de... | [
"0.63203835",
"0.6251078",
"0.6079405",
"0.60615814",
"0.60326934",
"0.6020745",
"0.6006609",
"0.59675026",
"0.5950655",
"0.5901165",
"0.58806187",
"0.5856725",
"0.5830617",
"0.58274776",
"0.57967013",
"0.5768996",
"0.5765135",
"0.5707902",
"0.56950194",
"0.5692454",
"0.56786... | 0.76211977 | 1 |
Support OVERRIDING SYSTEM|USER VALUE in insert statements | def insert_override_sql(sql)
case opts[:override]
when :system
sql << " OVERRIDING SYSTEM VALUE"
when :user
sql << " OVERRIDING USER VALUE"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login_failure(user=nil)\n blank(\n la_ip: ::GDO::Net::GDT_IP.current,\n la_user: user == nil ? nil : user.get_id,\n ).insert\n end",
"def add_user(db, user_name)\r\nadd_user = '\r\n\r\n\tINSERT INTO users \r\n\r\n\t(name, cache, expected_income, actual_income, expenses, month)\r\n\tVALUES (?... | [
"0.5437121",
"0.54056925",
"0.53587854",
"0.5357034",
"0.53318524",
"0.5330959",
"0.5315511",
"0.5309238",
"0.52904433",
"0.5285804",
"0.5285804",
"0.5282915",
"0.5274498",
"0.52641934",
"0.5258501",
"0.5258501",
"0.5258501",
"0.5237348",
"0.5202416",
"0.5189946",
"0.518118",... | 0.6451863 | 0 |
PostgreSQL quotes NaN and Infinity. | def literal_float(value)
if value.finite?
super
elsif value.nan?
"'NaN'"
elsif value.infinite? == 1
"'Infinity'"
else
"'-Infinity'"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_nan?()\n #This is a stub, used for indexing\n end",
"def ∞ℂ; ::Float::INFINITY_COMPLEX; end",
"def nan\n BigDecimal('0')/BigDecimal('0')\n end",
"def handle_nan(result)\n result.nan? ? 0.0 : result\n end",
"def handle_nan(result)\n result.nan? ? 0.0 : ... | [
"0.675201",
"0.6434023",
"0.63592994",
"0.62690026",
"0.62690026",
"0.5924871",
"0.5916958",
"0.57710654",
"0.5722384",
"0.5592909",
"0.5577168",
"0.555948",
"0.54728085",
"0.54715145",
"0.5422187",
"0.5416626",
"0.5352652",
"0.5331749",
"0.5331749",
"0.53267884",
"0.5315962"... | 0.6937389 | 0 |
Handle Ruby integers outside PostgreSQL bigint range specially. | def literal_integer(v)
if v > 9223372036854775807 || v < -9223372036854775808
literal_integer_outside_bigint_range(v)
else
v.to_s
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def literal_integer_outside_bigint_range(v)\n raise IntegerOutsideBigintRange, \"attempt to literalize Ruby integer outside PostgreSQL bigint range: #{v}\"\n end",
"def test_do_not_raise_when_int_is_not_wider_than_64bit\n value = 9223372036854775807\n assert_equal \"'9223372036854775807'\",... | [
"0.8245709",
"0.6992368",
"0.66835093",
"0.6479705",
"0.64078766",
"0.6316349",
"0.63103896",
"0.62356555",
"0.6216988",
"0.6173353",
"0.6133337",
"0.6091662",
"0.6076664",
"0.6071689",
"0.6012722",
"0.596731",
"0.5948034",
"0.5931467",
"0.5915999",
"0.58987486",
"0.5872905",... | 0.7218923 | 1 |
Raise IntegerOutsideBigintRange when attempting to literalize Ruby integer outside PostgreSQL bigint range, so PostgreSQL doesn't treat the value as numeric. | def literal_integer_outside_bigint_range(v)
raise IntegerOutsideBigintRange, "attempt to literalize Ruby integer outside PostgreSQL bigint range: #{v}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def literal_integer(v)\n if v > 9223372036854775807 || v < -9223372036854775808\n literal_integer_outside_bigint_range(v)\n else\n v.to_s\n end\n end",
"def test_do_not_raise_when_int_is_not_wider_than_64bit\n value = 9223372036854775807\n assert_equal \"'922... | [
"0.70062757",
"0.67205375",
"0.6706813",
"0.63642526",
"0.63092715",
"0.6266042",
"0.62429863",
"0.61111265",
"0.59855026",
"0.5961269",
"0.5949774",
"0.5680745",
"0.567375",
"0.5669552",
"0.56378376",
"0.5611179",
"0.56030303",
"0.55616546",
"0.55498075",
"0.5537962",
"0.552... | 0.8686653 | 0 |
Support FOR SHARE locking when using the :share lock style. Use SKIP LOCKED if skipping locked rows. | def select_lock_sql(sql)
lock = @opts[:lock]
if lock == :share
sql << ' FOR SHARE'
else
super
end
if lock
if @opts[:skip_locked]
sql << " SKIP LOCKED"
elsif @opts[:nowait]
sql << " NOWAIT"
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def for_share\n lock_style(:share)\n end",
"def nolock\n clone(:table_options => \"(NOLOCK)\")\n end",
"def skip_locked\n cached_dataset(:_skip_locked_ds) do\n raise(Error, 'This dataset does not support skipping locked rows') unless supports_skip_locked?\n clone(:ski... | [
"0.70884025",
"0.6361162",
"0.62005144",
"0.6196953",
"0.6189135",
"0.6172573",
"0.6153694",
"0.60519814",
"0.6024574",
"0.6016043",
"0.60124713",
"0.5951911",
"0.5951208",
"0.5945349",
"0.59318465",
"0.59261966",
"0.592478",
"0.59171903",
"0.5903963",
"0.5874665",
"0.5862838... | 0.66496354 | 1 |
Support VALUES clause instead of the SELECT clause to return rows. | def select_values_sql(sql)
sql << "VALUES "
expression_list_append(sql, opts[:values])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_values\n value = nil\n assert_nothing_raised do\n value = ActiveRecord::Base.connection.send(:select_rows, \"VALUES('ur', 'doin', 'it', 'right')\")\n end\n assert_equal [['ur', 'doin', 'it', 'right']], value\n end",
"def select_values(sql, name = nil)\n result = select_rows(sql,... | [
"0.7333736",
"0.6650351",
"0.6242213",
"0.62295794",
"0.6073188",
"0.60719794",
"0.59351194",
"0.59288603",
"0.58959985",
"0.5886909",
"0.58362275",
"0.58324695",
"0.57895106",
"0.5780254",
"0.5780254",
"0.5780254",
"0.57623494",
"0.5755752",
"0.57550055",
"0.5736297",
"0.572... | 0.7835908 | 0 |
Support PostgreSQL 14+ CTE SEARCH/CYCLE clauses | def select_with_sql_cte(sql, cte)
super
select_with_sql_cte_search_cycle(sql, cte)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def immediate_subqueries\n my_nodes_tagged(:subquery)\n end",
"def immediate_subqueries\n my_nodes_tagged(:subquery)\n end",
"def find_related_nodes_via_cypher(query_string, options = {})\n query_string = \"\n #{neo_self_match_clause}\n #{query_string}\n \"\n # t1 =... | [
"0.52050734",
"0.52050734",
"0.5193499",
"0.51634336",
"0.49859515",
"0.49299592",
"0.48931837",
"0.48773682",
"0.48163575",
"0.48068506",
"0.4787729",
"0.477681",
"0.47724617",
"0.4771895",
"0.47612202",
"0.4757136",
"0.4750637",
"0.47494748",
"0.47455943",
"0.47416502",
"0.... | 0.58591795 | 0 |
The version of the database server | def server_version
db.server_version(@opts[:server])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def version\n @version ||= exec('SHOW server_version')[0]['server_version'].split[0]\n end",
"def get_server_version\n server_info[:server_version]\n end",
"def db_version\n migration_meta_node[:_db_version]\n end",
"def server_version; end",
"def server_version\n check_c... | [
"0.85410744",
"0.81251967",
"0.8072402",
"0.8030856",
"0.7889446",
"0.78843343",
"0.7822001",
"0.7734123",
"0.7734123",
"0.76928204",
"0.7673027",
"0.76689583",
"0.76477915",
"0.7637135",
"0.7603097",
"0.7603097",
"0.7603097",
"0.7603097",
"0.7603097",
"0.7603097",
"0.7603097... | 0.8844359 | 0 |
PostgreSQL supports quoted function names. | def supports_quoted_function_names?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def irregular_function_sql(f)\n \"#{f.f}(#{literal(f.arg1)} #{f.joiner} #{literal(f.arg2)})\"\n end",
"def function_sql(f)\n args = f.args\n \"#{f.f}#{args.empty? ? '()' : literal(args)}\"\n end",
"def function(name, *args)\n SQL::Function.new(name, *args)\n end",
"def quoted... | [
"0.6741665",
"0.6719341",
"0.64273614",
"0.64095914",
"0.62986046",
"0.6254364",
"0.61536664",
"0.61536664",
"0.61536664",
"0.61536664",
"0.61536664",
"0.61536664",
"0.61536664",
"0.61536664",
"0.61536664",
"0.61536664",
"0.61536664",
"0.61536664",
"0.61536664",
"0.61536664",
... | 0.7917335 | 1 |
Use FROM to specify additional tables in an update query | def update_from_sql(sql)
join_from_sql(:FROM, sql)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_table_sql(sql)\n sql << ' '\n source_list_append(sql, @opts[:from][0..0])\n end",
"def update_from(from_table, *args, &block)\n\n configure_transfer(from_table, *args) { yield }\n\n @current_operation = StatusReport.instance.add_operation :source => @from_table,\n ... | [
"0.630731",
"0.6088034",
"0.5901598",
"0.5883422",
"0.5592899",
"0.55487484",
"0.5529329",
"0.54990935",
"0.5488189",
"0.5416212",
"0.5406827",
"0.5382143",
"0.5381436",
"0.53802943",
"0.5377935",
"0.5377765",
"0.53237104",
"0.5322136",
"0.5301938",
"0.5299105",
"0.5299105",
... | 0.7206524 | 1 |
allows you to push an array/row to the 2 demensional array. all rows must be the same width | def << (val)
# if this is first row set the width based on size of first array to be pushed
if @h == 0
@w = val.size
elsif val.size != @w or val.class.to_s != 'Array'
raise "Only add rows/arrays the same size as the width(#{@w})"
end
@data[@h] = val
@h += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_array(rows)\n raise ArgumentError, \"Can only work with arrays\" unless rows.is_a?(Array)\n if self.labels.size > 1 and rows.dimensions == 1\n self.add_item(rows)\n else\n # self.items = self.items + rows\n rows.each do |row|\n sel... | [
"0.67068654",
"0.65762824",
"0.6492256",
"0.6334116",
"0.61582327",
"0.6142815",
"0.61379886",
"0.6136306",
"0.6105991",
"0.595282",
"0.59520125",
"0.59357345",
"0.5921715",
"0.5878791",
"0.58428836",
"0.5832875",
"0.58272946",
"0.58116895",
"0.5807732",
"0.5802863",
"0.57928... | 0.72871757 | 0 |
yeilds each row of the slice from position x,y of width w and height h | def slice_rows(x,y,w,h)
(y..y+h-1).each do |i|
yield @data[i][x..x+w-1]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clip_to(x, y, w, h, &rendering_code); end",
"def slice_row inimage, rowbeg, rowend, outimage\n m_begin \"slice_row\"\n img = get_image(inimage)\n slice = img.excerpt(0, rowbeg, img.columns, rowend-rowbeg)\n put_image(outimage, slice)\n m_end \"slice_row\"\n end",
"def cut_white_space_edges\... | [
"0.60578823",
"0.60256624",
"0.6024005",
"0.6016192",
"0.580435",
"0.577119",
"0.5696392",
"0.56555814",
"0.5630477",
"0.5623385",
"0.5590841",
"0.55618393",
"0.5539382",
"0.55052227",
"0.5497365",
"0.54956174",
"0.5484765",
"0.5481666",
"0.5448207",
"0.54435617",
"0.5434807"... | 0.77835596 | 0 |
simplified version of fill that only takes one argument | def fill(x)
@data.each do |a|
a.fill x
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill(*args, &block)\n ary = self.to_a\n ary.fill *args, &block\n self.replace ary\n end",
"def fill(value)\n map! { |_| value }\n self\n end",
"def fill\n \t@fill\n end",
"def new_fill(value)\n self.class.new(*shape).fill(value)\n end",
"def fill\n retu... | [
"0.7889927",
"0.67792344",
"0.6765239",
"0.6664033",
"0.64098614",
"0.6363014",
"0.6114919",
"0.60925",
"0.5948215",
"0.5917927",
"0.58302677",
"0.57890606",
"0.5772848",
"0.5731747",
"0.5695932",
"0.55723214",
"0.55303895",
"0.5490103",
"0.54730046",
"0.5456026",
"0.544089",... | 0.7154743 | 1 |
Returns res directory for the mapped locale Base implementation does nothing | def directory(_mapped_locale, _is_default)
''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_root\n FilePath.new(build_module.root, name + \".resources\").canonicalize\n end",
"def locales_path\n unless defined?(@locales_path)\n self.locales_path = \"#{public_path}/#{DEFAULT_LOCALES_LOCATION}\"\n end\n\n @locales_path\n end",
"def get_resource_path\r\n ... | [
"0.6442619",
"0.6418418",
"0.6209744",
"0.6170908",
"0.60329807",
"0.60329807",
"0.5999955",
"0.59879243",
"0.59687746",
"0.5946484",
"0.59407145",
"0.5913207",
"0.5892395",
"0.5892237",
"0.58596075",
"0.58596075",
"0.58596075",
"0.58596075",
"0.58596075",
"0.58596075",
"0.58... | 0.77760965 | 0 |
Writes the locale to a directory | def write_locale(directory, file, strings, plurals, locale, date); end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write!\n Dir.mkdir @directory unless File.directory? @directory\n\n @locales.each_with_index do |locale, index|\n strings = @strings[locale]\n plurals = @plurals[locale]\n\n l_directory = locale_directory locale, index.zero?\n\n file = @table.to_s.empty? ? @adapter.default... | [
"0.8152813",
"0.7201601",
"0.69882953",
"0.66470236",
"0.65303713",
"0.64872706",
"0.64524055",
"0.6406505",
"0.6266684",
"0.6263246",
"0.6248797",
"0.6108113",
"0.60377336",
"0.60247386",
"0.5920466",
"0.59017855",
"0.57747775",
"0.5753936",
"0.5695618",
"0.5693142",
"0.5692... | 0.8565011 | 0 |
Save the contents of source file into a master_hash hash with the given key, so long as the source file has more action entries in it. Otherwise, remove key from master_hash if the source file has been emptied. | def build_file_into_master_hash(master_hash, key, source_file)
entries = grab_and_hashify(source_file, SIZE_OF_HASH_BLOCKS)
if(!entries.blank?)
master_hash.merge({ key.to_sym => entries })
else
master_hash.delete(key.to_sym)
master_hash
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove filename\n return false unless source_hash.key?(filename)\n source_hash.delete filename\n true\n end",
"def copy_content_to(key, source_root, source_key, metadata = {})\n source_root.with_input_io(source_key) do |io|\n copy_io_to(key, io, source_root.md5_sum(source_key), sour... | [
"0.5886325",
"0.52260816",
"0.5221473",
"0.5177054",
"0.5124466",
"0.49301687",
"0.49288794",
"0.4828572",
"0.47610435",
"0.47589764",
"0.47509995",
"0.47199625",
"0.47199625",
"0.4684239",
"0.46688947",
"0.46670628",
"0.46501485",
"0.46428072",
"0.46243903",
"0.45836744",
"0... | 0.7440597 | 0 |
Grab the time of the next action after our current file position, then return to that position | def get_next_action_time(file)
start_pos = file.pos
next_time = get_next_result_time(file)
file.seek(start_pos, IO::SEEK_SET)
next_time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time_of_last_file_action(file)\r\n\t\tresult_time = nil\r\n\t\tstarting_pos = file.pos\r\n\t\tfile.seek(0, IO::SEEK_END)\r\n\t\tfile.seek(file.pos-[10000, file.pos].min, IO::SEEK_SET)\r\n\t\t\r\n\t\twhile(!file.eof? && (this_line = file.readline))\r\n\t\t\tresult_time = Time.parse($1) if(this_line =~NEW_AC... | [
"0.7225953",
"0.71267027",
"0.66801333",
"0.6642811",
"0.6440103",
"0.6163304",
"0.59265846",
"0.59265846",
"0.5797089",
"0.57644284",
"0.57644284",
"0.57644284",
"0.57404035",
"0.5735688",
"0.56971353",
"0.56480134",
"0.5623349",
"0.5608162",
"0.5608162",
"0.5608162",
"0.559... | 0.7839334 | 0 |
Read backwards through file until we find the time of the last action written to it. | def get_time_of_last_file_action(file)
result_time = nil
starting_pos = file.pos
file.seek(0, IO::SEEK_END)
file.seek(file.pos-[10000, file.pos].min, IO::SEEK_SET)
while(!file.eof? && (this_line = file.readline))
result_time = Time.parse($1) if(this_line =~NEW_ACTION_REGEX)
end
# Reset fi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_seek_to_time(file, time_obj, logger)\r\n\t\tfile.seek(0, IO::SEEK_END)\r\n\t\tend_pos = file.pos\r\n\t\tfile.rewind\r\n\t\tfile = seek_to_time_helper(file, time_obj, 0, end_pos, logger)\r\n\t\tstarting_line_pos = file.pos\r\n\r\n\t\tfile.each do |line|\r\n\t\t\tif(line =~ NEW_ACTION_REGEX)\r\n\t\t\t\tthis... | [
"0.6491861",
"0.63410956",
"0.60770077",
"0.597135",
"0.59708893",
"0.58750296",
"0.58390456",
"0.5772574",
"0.5708681",
"0.56038016",
"0.55556464",
"0.55556464",
"0.55556464",
"0.55556464",
"0.5525236",
"0.5514578",
"0.55058163",
"0.5503089",
"0.5493834",
"0.5468655",
"0.545... | 0.70258874 | 0 |
Do a binary search until we find a file position that is less than MAX_TIME_BETWEEN_CONTROLLER_ACTIONS before the time we seek. | def seek_to_time_helper(file, target_time, start_pos, end_pos, logger)
return nil unless file && target_time
logger.info("Checking between file pos #{start_pos} and #{end_pos}.")
rewind_pos = file.pos
middle_pos = (start_pos+end_pos)/2
file.seek(middle_pos, IO::SEEK_SET)
file.each do |line|
if(l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_seek_to_time(file, time_obj, logger)\r\n\t\tfile.seek(0, IO::SEEK_END)\r\n\t\tend_pos = file.pos\r\n\t\tfile.rewind\r\n\t\tfile = seek_to_time_helper(file, time_obj, 0, end_pos, logger)\r\n\t\tstarting_line_pos = file.pos\r\n\r\n\t\tfile.each do |line|\r\n\t\t\tif(line =~ NEW_ACTION_REGEX)\r\n\t\t\t\tthis... | [
"0.60095817",
"0.53200203",
"0.5279065",
"0.51741594",
"0.51152444",
"0.51143277",
"0.5034979",
"0.50088876",
"0.49413612",
"0.48829132",
"0.47969675",
"0.47834408",
"0.47834408",
"0.47777817",
"0.4761641",
"0.47480258",
"0.47463036",
"0.47145933",
"0.47036147",
"0.46304908",
... | 0.6711165 | 0 |
Recursively builds children until it reaches the max_depth. | def build_children(node, parent = nil)
node.children = get_all_moves(node)
unless node.depth + 1 == @max_depth
node.children.each {|child| build_children(child, node)}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_children(node)\n #return nil if node.depth > @max_depth\n POSSIBLE_MOVES.each do |move|\n if (node.x + move[0] < size && node.y + move[1] < size) &&\n (node.x + move[0] >= 0 && node.y + move[1] >= 0)\n child = Node.new(node.x + move[0], node.y + move[1], node.depth + 1, [], node... | [
"0.65670353",
"0.6157627",
"0.6124455",
"0.6097771",
"0.5991611",
"0.59461516",
"0.59067696",
"0.58819246",
"0.58620787",
"0.58413696",
"0.5836486",
"0.5825835",
"0.58243984",
"0.58111185",
"0.5778077",
"0.5770776",
"0.5704197",
"0.5691301",
"0.5668295",
"0.5658111",
"0.56522... | 0.7432677 | 0 |
Returns TRUE if all of the coordinates fall on the board. Based on BOARD_SIZE | def on_board?(coords)
coords.any? {|coord| coord < 1 || coord > @size } ? false : true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ship_coords_are_all_on_board\n all_aboard = true\n @ship.coords.each do |coord|\n row, col = coord\n # if row & col are NOT between 0 and 9...\n unless row.between?(0,9) && col.between?(0,9)\n # ...then not all the coords are ok.\n all_aboard = false\n end\n break u... | [
"0.80548596",
"0.77984095",
"0.7756664",
"0.7526133",
"0.7440196",
"0.7352483",
"0.73282796",
"0.72934544",
"0.7279896",
"0.7231397",
"0.7217839",
"0.720466",
"0.7139954",
"0.71274424",
"0.7124715",
"0.70857716",
"0.7083321",
"0.70783573",
"0.7077019",
"0.7072715",
"0.7055687... | 0.8310522 | 0 |
Recursively gets the number of children of a node | def count_children(node)
return 0 if node.children.nil?
node.children.count + (node.children.map {|child| count_children(child)}).inject(&:+)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def num_children\n count = 0\n self.children.each do |child|\n count = count + child.num_children\n end\n\n return self.children.size + count\n end",
"def nodeCount\n count = 1\n\n if @children.size\n @children.each do |key, val|\n count += val.nodeCount\n end\n end\n\... | [
"0.8164399",
"0.81610334",
"0.8152095",
"0.80179775",
"0.80056554",
"0.7857073",
"0.7850586",
"0.77509224",
"0.77185154",
"0.7679977",
"0.76256555",
"0.7606697",
"0.7579198",
"0.74554014",
"0.74243027",
"0.7409021",
"0.7337356",
"0.7307475",
"0.72675633",
"0.72146225",
"0.720... | 0.8529156 | 0 |
given the game state as a string (0 represent empty grid, 1 represent X and 2 represent O) determine if the game has a winner by connection a row, column or diagonal outputs either the name of player1 or player2, if the game has no winner return nil | def checkWinner(state, player1, player2)
for i in 0..2
row_candidate = true
column_candidate = true
for j in 1..2
# check rows
if state[i * 3 + j] == '0' || state[i * 3 + j] != state[i * 3 + j - 1] then
row_candidate = false
elsif row_candidate && state[i * 3 ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def winner\n [\n [[0,0],[0,1],[0,2]], # column 0\n [[1,0],[1,1],[1,2]], # column 1\n [[2,0],[2,1],[2,2]], # column 2\n [[0,0],[1,0],[2,0]], # row 0\n [[0,1],[1,1],[2,1]], # row 1\n [[0,2],[1,2],[2,2]], # row 2\n [[0,0],[1,1],[2,2]], # descending diagonal\n [[0,2],[1,1],[2,0]], # ... | [
"0.74219316",
"0.7336712",
"0.7237744",
"0.71878356",
"0.7144838",
"0.7097895",
"0.70918286",
"0.707591",
"0.70042974",
"0.6994823",
"0.69611806",
"0.6950121",
"0.69468296",
"0.6943349",
"0.69373286",
"0.6935397",
"0.6924532",
"0.69238096",
"0.6908051",
"0.69077545",
"0.68777... | 0.77616906 | 0 |
delete the current ongoing game in the channel | def del
channel = params['channel_id']
existing = Board.find_by(:channel => channel)
if existing then
existing.destroy
return render json: { :response_type => 'in_channel',
:text => 'Removed the current game for the channel. It was between *' + existing.player1 + '* a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_game(channel)\n @games.delete(channel)\n end",
"def remove_game(channel)\n if t = @games[channel].join_timer\n @bot.timer.remove(t)\n end\n @games.delete(channel)\n end",
"def remove_game(channel)\n if t = @games[channel].join_timer\n @bot.timer.remove(t)\n end\n @ga... | [
"0.76571417",
"0.7488021",
"0.7488021",
"0.70198894",
"0.6971595",
"0.68607944",
"0.68112344",
"0.6799116",
"0.6789865",
"0.6679612",
"0.65322596",
"0.6526817",
"0.65182793",
"0.65057564",
"0.64897335",
"0.64824367",
"0.64490056",
"0.6448674",
"0.64102656",
"0.64076614",
"0.6... | 0.7840634 | 0 |
POST /dividas POST /dividas.json | def create
@divida = Divida.new(divida_params)
respond_to do |format|
if @divida.save
format.html { redirect_to @divida, notice: 'Divida was successfully created.' }
format.json { render :show, status: :created, location: @divida }
else
format.html { render :new }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dividendo_params\n params.require(:dividendo).permit(:competencia, :descricao, :pago, :valor, :data_vencimento, :categoria_id)\n end",
"def create\n @divisa = Divisa.new(divisa_params)\n\n respond_to do |format|\n if @divisa.save\n format.html { redirect_to @divisa, notice: 'Divisa ... | [
"0.6306471",
"0.61928034",
"0.61587626",
"0.61322737",
"0.6100432",
"0.60633063",
"0.60253465",
"0.6008307",
"0.59889096",
"0.5982501",
"0.5962352",
"0.596177",
"0.59522295",
"0.5925508",
"0.59243524",
"0.5913997",
"0.5902765",
"0.5896074",
"0.58326036",
"0.5818633",
"0.58105... | 0.6542379 | 1 |
Check that required payout details are present (and creates MangoPay benificiary if needed) | def required_payout_details_present?(person)
return false unless person.bank_account_owner_name && person.bank_account_owner_address && person.iban && person.bic.present?
return person.mangopay_beneficiary_id.present? || create_mangopay_beneficiary(person)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @payout = Payout.new(payout_params)\n\n respond_to do |format|\n if @payout.save\n format.html { redirect_to @payout, notice: 'Payout was successfully created.' }\n format.json { render :show, status: :created, location: @payout }\n else\n format.html { render :new... | [
"0.63583624",
"0.63566107",
"0.6131647",
"0.60571337",
"0.59907997",
"0.59208137",
"0.59208137",
"0.5919957",
"0.5873683",
"0.5869971",
"0.5848572",
"0.58260286",
"0.58059704",
"0.5783886",
"0.5783886",
"0.57693124",
"0.5767362",
"0.5764828",
"0.5758694",
"0.5756678",
"0.5746... | 0.76887155 | 0 |
Lists ReservationInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. | def list(reservation_status: :unset, limit: nil, page_size: nil)
self.stream(
reservation_status: reservation_status,
limit: limit,
page_size: page_size
).entries
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list(limit: nil, page_size: nil)\n self.stream(limit: limit, page_size: page_size).entries\n end",
"def list(limit: nil, page_size: nil)\n self.stream(limit: limit, page_size: page_size).entries\n end",
"def list(limit: nil, page_size: nil)\n self.stream... | [
"0.65928",
"0.65928",
"0.65611684",
"0.64563847",
"0.64563847",
"0.64563847",
"0.64563847",
"0.64563847",
"0.64563847",
"0.6360206",
"0.61795986",
"0.59689677",
"0.59689677",
"0.58669424",
"0.57883817",
"0.57568574",
"0.5723503",
"0.5700078",
"0.56211066",
"0.56211066",
"0.56... | 0.6616134 | 0 |
sends all the pages in this message returns the message | def send_pages
Msg.resolve(recipient).each do |user|
next if !user.sms_validated?
p = Page.new_page_to_user(self, user)
end
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_page\n send_message(\"page\")\n end",
"def sent\n @messages = current_user.messages.order('created_at DESC').unarchived.paginate(:page => params[:page], :per_page => 10)\n end",
"def page(message, url)\n recipients message.recipients\n from ADMIN_EMAIL\n subject message.su... | [
"0.6956178",
"0.6514956",
"0.6492343",
"0.63325435",
"0.6324517",
"0.6280375",
"0.62239534",
"0.62089765",
"0.61276126",
"0.60872334",
"0.6085665",
"0.6065085",
"0.606036",
"0.6049398",
"0.60426766",
"0.6028769",
"0.5968318",
"0.5959539",
"0.59392667",
"0.59057176",
"0.589545... | 0.7152458 | 0 |
GET /projectareas/1 GET /projectareas/1.xml | def show
@projectarea = Projectarea.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @projectarea }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @project_areas = ProjectArea.all\n end",
"def index\n @projects = @client.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @projects }\n end\n end",
"def new\n @projectarea = Projectarea.new\n\n respond_to do |format|\n ... | [
"0.66682184",
"0.634664",
"0.62768626",
"0.6212603",
"0.61729914",
"0.6153749",
"0.61136156",
"0.6106011",
"0.61049753",
"0.6101279",
"0.6101279",
"0.6092744",
"0.60809135",
"0.60733116",
"0.60714346",
"0.6058272",
"0.6035322",
"0.60149705",
"0.60101664",
"0.599544",
"0.59675... | 0.7037262 | 0 |
GET /projectareas/new GET /projectareas/new.xml | def new
@projectarea = Projectarea.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @projectarea }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @projectarea = Projectarea.new(params[:projectarea])\n\n respond_to do |format|\n if @projectarea.save\n flash[:notice] = 'Projectarea was successfully created.'\n format.html { redirect_to(@projectarea) }\n format.xml { render :xml => @projectarea, :status => :created... | [
"0.71269447",
"0.702568",
"0.6980662",
"0.6980662",
"0.69217044",
"0.6921029",
"0.6819034",
"0.6819034",
"0.6819034",
"0.6819034",
"0.6819034",
"0.6819034",
"0.6819034",
"0.6819034",
"0.6819034",
"0.6819034",
"0.6819034",
"0.6819034",
"0.6819034",
"0.6819034",
"0.6819034",
... | 0.78220785 | 0 |
POST /projectareas POST /projectareas.xml | def create
@projectarea = Projectarea.new(params[:projectarea])
respond_to do |format|
if @projectarea.save
flash[:notice] = 'Projectarea was successfully created.'
format.html { redirect_to(@projectarea) }
format.xml { render :xml => @projectarea, :status => :created, :location ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @project_area = ProjectArea.new(project_area_params)\n\n respond_to do |format|\n if @project_area.save\n format.html { redirect_to @project_area, notice: 'Project area was successfully created.' }\n format.json { render :show, status: :created, location: @project_area }\n ... | [
"0.6412374",
"0.5897453",
"0.58403254",
"0.5838494",
"0.579858",
"0.57751274",
"0.55490553",
"0.55028486",
"0.54609144",
"0.54419535",
"0.5338592",
"0.53223807",
"0.53205025",
"0.5317225",
"0.5298864",
"0.5267774",
"0.5253832",
"0.5233806",
"0.5231168",
"0.5231168",
"0.523004... | 0.66089976 | 0 |
PUT /projectareas/1 PUT /projectareas/1.xml | def update
@projectarea = Projectarea.find(params[:id])
respond_to do |format|
if @projectarea.update_attributes(params[:projectarea])
flash[:notice] = 'Projectarea was successfully updated.'
format.html { redirect_to(@projectarea) }
format.xml { head :ok }
else
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :descrip... | [
"0.6494426",
"0.61116356",
"0.5929459",
"0.5929459",
"0.5863026",
"0.5863026",
"0.5842453",
"0.5786108",
"0.5738155",
"0.56864125",
"0.56864125",
"0.56864125",
"0.5634796",
"0.5589337",
"0.5588147",
"0.5529578",
"0.55207264",
"0.54972243",
"0.5474664",
"0.54031044",
"0.539676... | 0.66401917 | 0 |
DELETE /projectareas/1 DELETE /projectareas/1.xml | def destroy
@projectarea = Projectarea.find(params[:id])
@projectarea.destroy
respond_to do |format|
format.html { redirect_to(projectareas_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @area = Area.find(params[:id])\n if @area.children.size == 0 and @area.name != \"localhost\"\n @area.destroy\n flash[:notice] = \"Deleted #{@area.to_s}\" \n else\n flash[:notice] = \"#{@area.to_s} not deleted. It has children or is the localhost node.\" \n end\n\n re... | [
"0.67901736",
"0.654388",
"0.654388",
"0.65335155",
"0.6464684",
"0.644625",
"0.644625",
"0.6379995",
"0.62911654",
"0.62151057",
"0.62045926",
"0.6188616",
"0.61597186",
"0.61538047",
"0.613933",
"0.6137967",
"0.61368936",
"0.6126015",
"0.6120021",
"0.61189497",
"0.60846424"... | 0.7297433 | 0 |
There are two situations where we want to avoid checking for an active (ongoing) production deployment: A caller of this trigger could set SKIP_DEPLOYMENT_CHECK to avoid the check, i.e. during feature flag activation When we are checking the status during an ongoing deployment (deployment_check? == true) | def skip_active_deployment_check?
ENV['SKIP_DEPLOYMENT_CHECK'] == 'true' || deployment_check?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deploy_disabled?\n ENV['NO_DEPLOY'] == '1'\nend",
"def deploy_disabled?\n ENV['NO_DEPLOY'] == '1'\nend",
"def deploy_disabled?\n ENV['NO_DEPLOY'] == '1'\nend",
"def deploy_requires_approval?\n super || pipeline_next_stages.any?(&:deploy_requires_approval?)\n end",
"def region_is_available_fo... | [
"0.7550755",
"0.7550755",
"0.7549739",
"0.7073127",
"0.656491",
"0.6546807",
"0.64391065",
"0.63907504",
"0.6372478",
"0.63191116",
"0.6083619",
"0.60770607",
"0.6072778",
"0.6068416",
"0.60591704",
"0.6057308",
"0.6027853",
"0.602724",
"0.6022737",
"0.6004141",
"0.5936783",
... | 0.81786835 | 0 |
GET /users/blocks GET /users/blocks.json | def index
@users_blocks = Block.all.where(user_id: current_user.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block_users\n request('/block/users', {body: {}})\n end",
"def index\n @blocks = Block.all\n\n render json: @blocks\n end",
"def create\n @users_block = Block.new(blocked_id: params[:block][:blocked],\n user_id: current_user.id)\n @users = get_blockable_user... | [
"0.7631785",
"0.7106992",
"0.70535165",
"0.7030853",
"0.69684577",
"0.6933396",
"0.69011587",
"0.6872988",
"0.68617296",
"0.6833513",
"0.6818587",
"0.6693042",
"0.664015",
"0.66317266",
"0.66317266",
"0.6624982",
"0.6579073",
"0.65446943",
"0.652411",
"0.6498027",
"0.64584744... | 0.7533225 | 1 |
POST /users/blocks POST /users/blocks.json | def create
@users_block = Block.new(blocked_id: params[:block][:blocked],
user_id: current_user.id)
@users = get_blockable_users
respond_to do |format|
if @users_block.save
format.html { redirect_to block_path, notice: 'Block was successfully created.' }
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def block(user)\n post \"blocks/create/#{user}\"\n end",
"def create\n @block = Block.new(block_params)\n\n if @block.save\n render json: @block, status: :created, location: @block\n else\n render json: @block.errors, status: :unprocessable_entity\n end\n end",
"def create\n @bloc... | [
"0.8266645",
"0.70048237",
"0.69854116",
"0.69636035",
"0.68545735",
"0.68484443",
"0.68373317",
"0.68008536",
"0.67833334",
"0.6736109",
"0.67128116",
"0.67036885",
"0.66368484",
"0.6614877",
"0.66117805",
"0.65809923",
"0.65646106",
"0.6538575",
"0.6504471",
"0.6360691",
"0... | 0.7893728 | 1 |
DELETE /users/blocks/1 DELETE /users/blocks/1.json | def destroy
@users_block.destroy
respond_to do |format|
format.html { redirect_to block_path, notice: 'Block was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_block(user)\n delete \"blocks/destroy/#{user}\"\n end",
"def destroy\n @block.destroy\n respond_to do |format|\n format.html { redirect_to blocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @block.destroy\n respond_to do |format|\n format... | [
"0.7901728",
"0.7585324",
"0.7585324",
"0.75791234",
"0.75643224",
"0.7525792",
"0.74564135",
"0.74558383",
"0.7440272",
"0.72926694",
"0.7287158",
"0.7286936",
"0.72502226",
"0.7233116",
"0.7218091",
"0.7142713",
"0.7142713",
"0.7088925",
"0.70857775",
"0.70030016",
"0.69459... | 0.7711706 | 1 |
create a method that takes a full name and returns a fake full name | def make_fake_full_name (full_name)
# put names into an array and swap first and last (if you wanted a string instead: name.partition(' ').reverse.join)
full_name = full_name.split(' ').reverse
# for each name, replace it with a fake name
full_name.map! {|name| make_fake_name(name)}
# convert the full name b... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full_name(first_name, last_name)\n # TODO: the method should return the fullname\n #----------------------------\n\n # your code here\n\n #----------------------------\nend",
"def full_name\n get_full_name\n end",
"def fake_name (first_name, last_name)\n \"#{last_name} #{first_name}\"\nend",
"de... | [
"0.7889941",
"0.782253",
"0.78032035",
"0.7752266",
"0.7699821",
"0.76951313",
"0.76771945",
"0.76598346",
"0.76390576",
"0.7635211",
"0.7629882",
"0.7588677",
"0.75661516",
"0.75337845",
"0.75320745",
"0.7521852",
"0.7517981",
"0.7515368",
"0.7512004",
"0.7512004",
"0.751200... | 0.7930022 | 0 |
Returns a hash of protocol => port. | def protocol_ports
(self.overview.listeners || []).
reduce(Hash.new) { |acc, lnr| acc[lnr.protocol] = lnr.port; acc }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n \"#{@ipv4}#{@port}\".hash\n end",
"def to_hash\n thishash = Hash.new()\n thishash['node_number'] = @node_number\n thishash['port'] = @port\n unless @slaveof.nil?\n thishash['slaveof'] = @slaveof['host'] + \":\" + @slaveof['port'].to_s\n end\n return thishash\n end",... | [
"0.8080794",
"0.6304852",
"0.6073284",
"0.6059332",
"0.5995155",
"0.596545",
"0.5949295",
"0.5817943",
"0.5794598",
"0.5765751",
"0.57593197",
"0.5732313",
"0.57077813",
"0.5678648",
"0.5676193",
"0.5670764",
"0.5653143",
"0.56393075",
"0.55943185",
"0.5576942",
"0.5552088",
... | 0.66337043 | 1 |
Return dependencies for an object file. | def obj_dep( o )
deps = []
inc_dirs = [ SRC_DIR, TEST_DIR ]
cpp = o.sub(/\.o$/,'.cpp') \
.sub(/^obj\/src\//, 'src/') \
.sub(/^obj\/test\//, 'test/')
# print cpp, "\n"
headers = cpp_headers( cpp, inc_dirs )
# print headers.join(" "), "\n"
deps << cpp
deps << headers
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(filename = \"dependencies.yml\")\n dependencies = Set.new\n $/=\"\\n\\n\"\n File.open(filename, \"r\").each do |object|\n begin\n dependencies << Dependency.deserialize(object)\n rescue\n raise $!, \"Could not load object from #{filename}\", $!.backtrace\n ... | [
"0.7069585",
"0.69625485",
"0.66465575",
"0.6525914",
"0.64900213",
"0.6469389",
"0.64443696",
"0.64443696",
"0.64443696",
"0.64443696",
"0.63890594",
"0.6342516",
"0.633928",
"0.6333779",
"0.6324865",
"0.63203615",
"0.62962294",
"0.6197755",
"0.61847746",
"0.6172639",
"0.614... | 0.71190846 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.