{ "db": "PostgreSQL", "08a21d9ae3a6330beee1e74e74d9dcf9ecaf4ca76948339b7b3210fd9507a5fa": { "query": "INSERT INTO\n rate_limit (api_key_id, time_window, group_name, count)\nVALUES\n ($1, $2, $3, $4) ON CONFLICT ON CONSTRAINT unique_window DO\nUPDATE\nset\n count = rate_limit.count + $4 RETURNING rate_limit.count\n", "describe": { "columns": [ { "ordinal": 0, "name": "count", "type_info": "Int2" } ], "parameters": { "Left": [ "Int4", "Int8", "Text", "Int2" ] }, "nullable": [ false ] } }, "56ce1706518e7831d65aa5263bc8968ae8013f29749ddd24105b464182b34d93": { "query": "SELECT\n exists(\n SELECT\n 1\n FROM\n twitter_user\n WHERE\n lower(data ->> 'screen_name') = lower($1)\n ) \"exists!\";\n", "describe": { "columns": [ { "ordinal": 0, "name": "exists!", "type_info": "Bool" } ], "parameters": { "Left": [ "Text" ] }, "nullable": [ null ] } }, "590fc61bba9227b888b22ee4e0654426e0af47dac5bb657382984b1bf25bc558": { "query": "WITH hashes AS (\n SELECT * FROM jsonb_to_recordset($1::jsonb)\n AS hashes(searched_hash bigint, found_hash bigint, distance bigint)\n)\nSELECT\n 'FurAffinity' site,\n submission.id,\n submission.hash_int hash,\n submission.url,\n submission.filename,\n ARRAY(SELECT artist.name) artists,\n submission.file_id,\n null sources,\n submission.rating,\n submission.posted_at,\n hashes.searched_hash,\n hashes.distance\nFROM hashes\nJOIN submission ON hashes.found_hash = submission.hash_int\nJOIN artist ON submission.artist_id = artist.id\nWHERE hash_int IN (SELECT hashes.found_hash)\nUNION ALL\nSELECT\n 'e621' site,\n e621.id,\n e621.hash,\n e621.data->'file'->>'url' url,\n (e621.data->'file'->>'md5') || '.' || (e621.data->'file'->>'ext') filename,\n ARRAY(SELECT jsonb_array_elements_text(e621.data->'tags'->'artist')) artists,\n null file_id,\n ARRAY(SELECT jsonb_array_elements_text(e621.data->'sources')) sources,\n e621.data->>'rating' rating,\n to_timestamp(data->>'created_at', 'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"') posted_at,\n hashes.searched_hash,\n hashes.distance\nFROM hashes\nJOIN e621 ON hashes.found_hash = e621.hash\nWHERE e621.hash IN (SELECT hashes.found_hash)\nUNION ALL\nSELECT\n 'Weasyl' site,\n weasyl.id,\n weasyl.hash,\n weasyl.data->>'link' url,\n null filename,\n ARRAY(SELECT weasyl.data->>'owner_login') artists,\n null file_id,\n null sources,\n weasyl.data->>'rating' rating,\n to_timestamp(data->>'posted_at', 'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"') posted_at,\n hashes.searched_hash,\n hashes.distance\nFROM hashes\nJOIN weasyl ON hashes.found_hash = weasyl.hash\nWHERE weasyl.hash IN (SELECT hashes.found_hash)\nUNION ALL\nSELECT\n 'Twitter' site,\n tweet.id,\n tweet_media.hash,\n tweet_media.url,\n null filename,\n ARRAY(SELECT tweet.data->'user'->>'screen_name') artists,\n null file_id,\n null sources,\n CASE\n WHEN (tweet.data->'possibly_sensitive')::boolean IS true THEN 'adult'\n WHEN (tweet.data->'possibly_sensitive')::boolean IS false THEN 'general'\n END rating,\n to_timestamp(tweet.data->>'created_at', 'DY Mon DD HH24:MI:SS +0000 YYYY') posted_at,\n hashes.searched_hash,\n hashes.distance\nFROM hashes\nJOIN tweet_media ON hashes.found_hash = tweet_media.hash\nJOIN tweet ON tweet_media.tweet_id = tweet.id\nWHERE tweet_media.hash IN (SELECT hashes.found_hash)\n", "describe": { "columns": [ { "ordinal": 0, "name": "site", "type_info": "Text" }, { "ordinal": 1, "name": "id", "type_info": "Int8" }, { "ordinal": 2, "name": "hash", "type_info": "Int8" }, { "ordinal": 3, "name": "url", "type_info": "Text" }, { "ordinal": 4, "name": "filename", "type_info": "Text" }, { "ordinal": 5, "name": "artists", "type_info": "TextArray" }, { "ordinal": 6, "name": "file_id", "type_info": "Int4" }, { "ordinal": 7, "name": "sources", "type_info": "TextArray" }, { "ordinal": 8, "name": "rating", "type_info": "Bpchar" }, { "ordinal": 9, "name": "posted_at", "type_info": "Timestamptz" }, { "ordinal": 10, "name": "searched_hash", "type_info": "Int8" }, { "ordinal": 11, "name": "distance", "type_info": "Int8" } ], "parameters": { "Left": [ "Jsonb" ] }, "nullable": [ null, null, null, null, null, null, null, null, null, null, null, null ] } }, "954a4422cf5a2517ff1af3bb4c1544de2ec392c9b8bcbf6defdeba5ad3727fe4": { "query": "SELECT\n api_key.id,\n api_key.user_id,\n api_key.name_limit,\n api_key.image_limit,\n api_key.hash_limit,\n api_key.name\nFROM\n api_key\nWHERE\n api_key.key = $1\n", "describe": { "columns": [ { "ordinal": 0, "name": "id", "type_info": "Int4" }, { "ordinal": 1, "name": "user_id", "type_info": "Int4" }, { "ordinal": 2, "name": "name_limit", "type_info": "Int2" }, { "ordinal": 3, "name": "image_limit", "type_info": "Int2" }, { "ordinal": 4, "name": "hash_limit", "type_info": "Int2" }, { "ordinal": 5, "name": "name", "type_info": "Text" } ], "parameters": { "Left": [ "Text" ] }, "nullable": [ false, false, false, false, false, true ] } }, "fd604c5df0c2fa6b80dbeed8e5989f01188bb28553ae9b6ca16c5861bacf3118": { "query": "SELECT\n submission.id,\n submission.url,\n submission.filename,\n submission.file_id,\n submission.rating,\n submission.posted_at,\n submission.hash_int hash,\n artist.name artist\nFROM\n submission\n LEFT JOIN artist ON artist.id = submission.artist_id\nWHERE\n file_id = $1\nLIMIT\n 10;\n", "describe": { "columns": [ { "ordinal": 0, "name": "id", "type_info": "Int4" }, { "ordinal": 1, "name": "url", "type_info": "Text" }, { "ordinal": 2, "name": "filename", "type_info": "Text" }, { "ordinal": 3, "name": "file_id", "type_info": "Int4" }, { "ordinal": 4, "name": "rating", "type_info": "Bpchar" }, { "ordinal": 5, "name": "posted_at", "type_info": "Timestamptz" }, { "ordinal": 6, "name": "hash", "type_info": "Int8" }, { "ordinal": 7, "name": "artist", "type_info": "Text" } ], "parameters": { "Left": [ "Int4" ] }, "nullable": [ false, true, true, true, true, true, true, false ] } } }