org.skife.jdbi.v2.sqlobject.SqlUpdate Java Examples

The following examples show how to use org.skife.jdbi.v2.sqlobject.SqlUpdate. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SchemaDao.java    From presto with Apache License 2.0 6 votes vote down vote up
@SqlUpdate("CREATE TABLE IF NOT EXISTS shards (\n" +
        "  shard_id BIGINT PRIMARY KEY AUTO_INCREMENT,\n" +
        "  shard_uuid BINARY(16) NOT NULL,\n" +
        "  table_id BIGINT NOT NULL,\n" +
        "  bucket_number INT,\n" +
        "  create_time DATETIME NOT NULL,\n" +
        "  row_count BIGINT NOT NULL,\n" +
        "  compressed_size BIGINT NOT NULL,\n" +
        "  uncompressed_size BIGINT NOT NULL,\n" +
        "  xxhash64 BIGINT NOT NULL,\n" +
        "  UNIQUE (shard_uuid),\n" +
        // include a covering index organized by table_id
        "  UNIQUE (table_id, bucket_number, shard_id, shard_uuid, create_time, row_count, compressed_size, uncompressed_size, xxhash64),\n" +
        "  FOREIGN KEY (table_id) REFERENCES tables (table_id)\n" +
        ")")
void createTableShards();
 
Example #2
Source File: SchemaDao.java    From presto with Apache License 2.0 6 votes vote down vote up
@SqlUpdate("CREATE TABLE IF NOT EXISTS columns (\n" +
        "  table_id BIGINT NOT NULL,\n" +
        "  column_id BIGINT NOT NULL,\n" +
        "  column_name VARCHAR(255) NOT NULL,\n" +
        "  ordinal_position INT NOT NULL,\n" +
        "  data_type VARCHAR(255) NOT NULL,\n" +
        "  sort_ordinal_position INT,\n" +
        "  bucket_ordinal_position INT,\n" +
        "  PRIMARY KEY (table_id, column_id),\n" +
        "  UNIQUE (table_id, column_name),\n" +
        "  UNIQUE (table_id, ordinal_position),\n" +
        "  UNIQUE (table_id, sort_ordinal_position),\n" +
        "  UNIQUE (table_id, bucket_ordinal_position),\n" +
        "  FOREIGN KEY (table_id) REFERENCES tables (table_id)\n" +
        ")")
void createTableColumns();
 
Example #3
Source File: SchemaDao.java    From presto with Apache License 2.0 6 votes vote down vote up
@SqlUpdate("CREATE TABLE IF NOT EXISTS tables (\n" +
        "  table_id BIGINT PRIMARY KEY AUTO_INCREMENT,\n" +
        "  schema_name VARCHAR(255) NOT NULL,\n" +
        "  table_name VARCHAR(255) NOT NULL,\n" +
        "  temporal_column_id BIGINT,\n" +
        "  compaction_enabled BOOLEAN NOT NULL,\n" +
        "  organization_enabled BOOLEAN NOT NULL,\n" +
        "  distribution_id BIGINT,\n" +
        "  create_time BIGINT NOT NULL,\n" +
        "  update_time BIGINT NOT NULL,\n" +
        "  table_version BIGINT NOT NULL,\n" +
        "  shard_count BIGINT NOT NULL,\n" +
        "  row_count BIGINT NOT NULL,\n" +
        "  compressed_size BIGINT NOT NULL,\n" +
        "  uncompressed_size BIGINT NOT NULL,\n" +
        "  maintenance_blocked DATETIME,\n" +
        "  UNIQUE (schema_name, table_name),\n" +
        "  UNIQUE (distribution_id, table_id),\n" +
        "  UNIQUE (maintenance_blocked, table_id),\n" +
        "  FOREIGN KEY (distribution_id) REFERENCES distributions (distribution_id)\n" +
        ")")
void createTableTables();
 
Example #4
Source File: MetadataDao.java    From presto with Apache License 2.0 6 votes vote down vote up
@SqlUpdate("INSERT INTO tables (\n" +
        "  schema_name, table_name, compaction_enabled, organization_enabled, distribution_id,\n" +
        "  create_time, update_time, table_version,\n" +
        "  shard_count, row_count, compressed_size, uncompressed_size)\n" +
        "VALUES (\n" +
        "  :schemaName, :tableName, :compactionEnabled, :organizationEnabled, :distributionId,\n" +
        "  :createTime, :createTime, 0,\n" +
        "  0, 0, 0, 0)\n")
@GetGeneratedKeys
long insertTable(
        @Bind("schemaName") String schemaName,
        @Bind("tableName") String tableName,
        @Bind("compactionEnabled") boolean compactionEnabled,
        @Bind("organizationEnabled") boolean organizationEnabled,
        @Bind("distributionId") Long distributionId,
        @Bind("createTime") long createTime);
 
Example #5
Source File: MySqlShardDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
// 'order by' is needed in this statement in order to make it compatible with statement-based replication
@SqlUpdate("DELETE FROM transactions\n" +
        "WHERE end_time < :maxEndTime\n" +
        "  AND successful IN (TRUE, FALSE)\n" +
        "  AND transaction_id NOT IN (SELECT transaction_id FROM created_shards)\n" +
        "ORDER BY end_time, transaction_id\n" +
        "LIMIT " + CLEANUP_TRANSACTIONS_BATCH_SIZE)
int deleteOldCompletedTransactions(@Bind("maxEndTime") Timestamp maxEndTime);
 
Example #6
Source File: SchemaDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlUpdate("CREATE TABLE IF NOT EXISTS shard_nodes (\n" +
        "  shard_id BIGINT NOT NULL,\n" +
        "  node_id INT NOT NULL,\n" +
        "  PRIMARY KEY (shard_id, node_id),\n" +
        "  UNIQUE (node_id, shard_id),\n" +
        "  FOREIGN KEY (shard_id) REFERENCES shards (shard_id),\n" +
        "  FOREIGN KEY (node_id) REFERENCES nodes (node_id)\n" +
        ")")
void createTableShardNodes();
 
Example #7
Source File: SchemaDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlUpdate("CREATE TABLE IF NOT EXISTS views (\n" +
        "  schema_name VARCHAR(255) NOT NULL,\n" +
        "  table_name VARCHAR(255) NOT NULL,\n" +
        "  data TEXT NOT NULL,\n" +
        "  PRIMARY KEY (schema_name, table_name)\n" +
        ")")
void createTableViews();
 
Example #8
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 5 votes vote down vote up
@SqlUpdate(SQL_UPDATE_LEAD)
int updateLeaderEntry(
    @Bind("leaderId") UUID leaderId,
    @Bind("reaperInstanceId") UUID reaperInstanceId,
    @Bind("reaperInstanceHost") String reaperInstanceHost,
    @Bind("expirationTime") Instant expirationTime
);
 
Example #9
Source File: SchemaDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlUpdate("CREATE TABLE IF NOT EXISTS created_shards (\n" +
        "  shard_uuid BINARY(16) NOT NULL,\n" +
        "  transaction_id BIGINT NOT NULL,\n" +
        "  PRIMARY KEY (shard_uuid),\n" +
        "  UNIQUE (transaction_id, shard_uuid),\n" +
        "  FOREIGN KEY (transaction_id) REFERENCES transactions (transaction_id)\n" +
        ")")
void createTableCreatedShards();
 
Example #10
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 5 votes vote down vote up
@SqlUpdate(SQL_STORE_NODE_METRICS)
int storeNodeMetrics(
    @Bind("runId") long runId,
    @Bind("node") String node,
    @Bind("cluster") String cluster,
    @Bind("datacenter") String datacenter,
    @Bind("requested") Boolean requested,
    @Bind("pendingCompactions") int pendingCompactions,
    @Bind("hasRepairRunning") Boolean hasRepairRunning,
    @Bind("activeAntiCompactions") int activeAntiCompactions
);
 
Example #11
Source File: MetadataDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlUpdate("INSERT INTO distributions (distribution_name, column_types, bucket_count)\n" +
        "VALUES (:distributionName, :columnTypes, :bucketCount)")
@GetGeneratedKeys
long insertDistribution(
        @Bind("distributionName") String distributionName,
        @Bind("columnTypes") String columnTypes,
        @Bind("bucketCount") int bucketCount);
 
Example #12
Source File: ShardDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlUpdate("UPDATE buckets SET node_id = :nodeId\n" +
        "WHERE distribution_id = :distributionId\n" +
        "  AND bucket_number = :bucketNumber")
void updateBucketNode(
        @Bind("distributionId") long distributionId,
        @Bind("bucketNumber") int bucketNumber,
        @Bind("nodeId") int nodeId);
 
Example #13
Source File: MetadataDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlUpdate("UPDATE tables SET\n" +
        "  shard_count = shard_count + :shardCount \n" +
        ", row_count = row_count + :rowCount\n" +
        ", compressed_size = compressed_size + :compressedSize\n" +
        ", uncompressed_size = uncompressed_size + :uncompressedSize\n" +
        "WHERE table_id = :tableId")
void updateTableStats(
        @Bind("tableId") long tableId,
        @Bind("shardCount") long shardCount,
        @Bind("rowCount") long rowCount,
        @Bind("compressedSize") long compressedSize,
        @Bind("uncompressedSize") long uncompressedSize);
 
Example #14
Source File: MetadataDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlUpdate("INSERT INTO columns (table_id, column_id, column_name, ordinal_position, data_type, sort_ordinal_position, bucket_ordinal_position)\n" +
        "VALUES (:tableId, :columnId, :columnName, :ordinalPosition, :dataType, :sortOrdinalPosition, :bucketOrdinalPosition)")
void insertColumn(
        @Bind("tableId") long tableId,
        @Bind("columnId") long columnId,
        @Bind("columnName") String columnName,
        @Bind("ordinalPosition") int ordinalPosition,
        @Bind("dataType") String dataType,
        @Bind("sortOrdinalPosition") Integer sortOrdinalPosition,
        @Bind("bucketOrdinalPosition") Integer bucketOrdinalPosition);
 
Example #15
Source File: MetadataDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlUpdate("UPDATE tables SET\n" +
        "  schema_name = :newSchemaName\n" +
        ", table_name = :newTableName\n" +
        "WHERE table_id = :tableId")
void renameTable(
        @Bind("tableId") long tableId,
        @Bind("newSchemaName") String newSchemaName,
        @Bind("newTableName") String newTableName);
 
Example #16
Source File: TestingShardDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlUpdate("INSERT INTO shards (shard_uuid, table_id, bucket_number, create_time, row_count, compressed_size, uncompressed_size, xxhash64)\n" +
        "VALUES (:shardUuid, :tableId, :bucketNumber, CURRENT_TIMESTAMP, :rowCount, :compressedSize, :uncompressedSize, :xxhash64)")
@GetGeneratedKeys
long insertShard(
        @Bind("shardUuid") UUID shardUuid,
        @Bind("tableId") long tableId,
        @Bind("bucketNumber") Integer bucketNumber,
        @Bind("rowCount") long rowCount,
        @Bind("compressedSize") long compressedSize,
        @Bind("uncompressedSize") long uncompressedSize,
        @Bind("xxhash64") long xxhash64);
 
Example #17
Source File: ShardOrganizerDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlUpdate("UPDATE shard_organizer_jobs SET last_start_time = :lastStartTime\n" +
        "   WHERE node_identifier = :nodeIdentifier\n" +
        "     AND table_id = :tableId")
void updateLastStartTime(
        @Bind("nodeIdentifier") String nodeIdentifier,
        @Bind("tableId") long tableId,
        @Bind("lastStartTime") long lastStartTime);
 
Example #18
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 5 votes vote down vote up
@SqlUpdate(SQL_INSERT_OPERATIONS)
int insertOperations(
    @Bind("cluster") String cluster,
    @Bind("type") String operationType,
    @Bind("host") String host,
    @Bind("data") String data
);
 
Example #19
Source File: SchemaDao.java    From presto with Apache License 2.0 5 votes vote down vote up
@SqlUpdate("CREATE TABLE IF NOT EXISTS buckets (\n" +
        "  distribution_id BIGINT NOT NULL,\n" +
        "  bucket_number INT NOT NULL,\n" +
        "  node_id INT NOT NULL,\n" +
        "  PRIMARY KEY (distribution_id, bucket_number),\n" +
        "  UNIQUE (node_id, distribution_id, bucket_number),\n" +
        "  FOREIGN KEY (distribution_id) REFERENCES distributions (distribution_id),\n" +
        "  FOREIGN KEY (node_id) REFERENCES nodes (node_id)\n" +
        ")")
void createTableBuckets();
 
Example #20
Source File: MonitorTaskDao.java    From SAPNetworkMonitor with GNU General Public License v3.0 4 votes vote down vote up
@SqlUpdate("DELETE FROM SNM_MONITOR_TASK WHERE TASK_ID = :taskId")
void removeMonitorTask(@Bind("taskId") String taskId);
 
Example #21
Source File: MonitorTaskDao.java    From SAPNetworkMonitor with GNU General Public License v3.0 4 votes vote down vote up
@SqlUpdate("UPDATE SNM_MONITOR_TASK SET REDISPATCHER = :redispatchered WHERE TASK_ID = :taskId AND MONITOR_ID = :monitorId")
void updateMonitorTaskRedispatcher(@Bind("taskId") String taskId, @Bind("monitorId") String monitorId, @Bind("redispatchered") int redispatchered);
 
Example #22
Source File: MonitorTaskDao.java    From SAPNetworkMonitor with GNU General Public License v3.0 4 votes vote down vote up
@SqlUpdate("UPDATE SNM_MONITOR_TASK SET REDISPATCHER = :needRedispatcher WHERE TASK_ID = :taskId")
void updateMonitorTaskRedispatcher(@Bind("taskId") String taskId, @Bind("needRedispatcher") int needRedispatcher);
 
Example #23
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlUpdate(SQL_UPDATE_REPAIR_SCHEDULE)
int updateRepairSchedule(
    @BindBean RepairSchedule newRepairSchedule);
 
Example #24
Source File: MonitorDao.java    From SAPNetworkMonitor with GNU General Public License v3.0 4 votes vote down vote up
@SqlUpdate("UPDATE SNM_MONITOR SET ACCOUNT_ID = :accountId, VERSION = :version, NAME = :name, COUNTRY = :country, PROVINCE = :province, CITY = :city, ISP = :isp, AREA = :area, " +
        " IP = :ip, NIPING_T = :nipingT, MODIFIED_TIME = :modifiedTime WHERE MONITOR_ID = :monitorId")
void updateMonitorNiping(@BindBean Monitor monitor);
 
Example #25
Source File: MonitorDao.java    From SAPNetworkMonitor with GNU General Public License v3.0 4 votes vote down vote up
@SqlUpdate("UPDATE SNM_MONITOR SET STATUS = :status, MODIFIED_TIME = :modifiedTime")
void updateAllMonitorsStatus(@Bind("status") int status, @Bind("modifiedTime") Date modifiedTime);
 
Example #26
Source File: TestShardCleaner.java    From presto with Apache License 2.0 4 votes vote down vote up
@SqlUpdate("UPDATE transactions SET end_time = :endTime WHERE transaction_id = :transactionId")
int updateTransactionEndTime(@Bind("transactionId") long transactionId, @Bind("endTime") Timestamp endTime);
 
Example #27
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlUpdate(SQL_INSERT_EVENT_SUBSCRIPTION)
@GetGeneratedKeys
long insertDiagEventSubscription(
        @BindBean DiagEventSubscription subscription);
 
Example #28
Source File: MonitorDao.java    From SAPNetworkMonitor with GNU General Public License v3.0 4 votes vote down vote up
@SqlUpdate("INSERT INTO SNM_MONITOR (MONITOR_ID, VERSION, ACCOUNT_ID, NAME, COUNTRY, PROVINCE, CITY, ISP, AREA, IP, NIPING_T, STATUS, CREATION_TIME, MODIFIED_TIME) " +
        " VALUES (:monitorId, :version, :accountId, :name, :country, :province, :city, :isp, :area, :ip, :nipingT, :status, :creationTime, :modifiedTime)")
void insertMonitor(@BindBean Monitor monitor);
 
Example #29
Source File: IStoragePostgreSql.java    From cassandra-reaper with Apache License 2.0 4 votes vote down vote up
@SqlUpdate(SQL_FORCE_RELEASE_LEAD)
int forceReleaseLead(
    @Bind("leaderId") UUID leaderId
);
 
Example #30
Source File: TaskDao.java    From SAPNetworkMonitor with GNU General Public License v3.0 4 votes vote down vote up
@SqlUpdate("INSERT INTO SNM_TASK (TASK_ID, ACCOUNT_ID, NAME, TASK_INTERVAL, CONFIG_JSON, STATUS, CREATION_TIME, MODIFIED_TIME)" +
        " VALUES (:taskId, :accountId, :name, :interval, :configJson, :status, :creationTime, :modifiedTime)")
void insertTask(@BindBean Task task);