#
# Copyright (c) 2019, 2020 Oracle and/or its affiliates. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

server:
  port: 8079
  host: 0.0.0.0
  features:
    print-details: true

tracing:
  service: jdbc-db

db:
  source: jdbc
  connection:
    url: jdbc:h2:tcp://localhost:9092//tmp/test
    username: sa
    password:
    poolName: h2
#    url: jdbc:mysql://127.0.0.1:3306/pokemon?useSSL=false
#    username: user
#    password: password
#    poolName: mysql
#    url: jdbc:oracle:thin:@localhost:11521/XE
#    username: "sys as sysdba"
#    password: testing12345
#    poolName: oracle
    initializationFailTimeout: -1
    connectionTimeout: 2000
    helidon:
      pool-metrics:
        enabled: true
        # name prefix defaults to "db.pool." - if you have more than one client within a JVM, you may want to distinguish between them
        name-prefix: "hikari."
  services:
    tracing:
      # would trace all statement names that start with select-
      - statement-names: ["select-.*"]
      # would trace all delete statements
      - statement-types: ["DELETE"]
    metrics:
      - type: METER
        name-format: "db.meter.overall"
      - type: METER
        # meter per statement name (default name format)
      - type: METER
        # meter per statement type
        name-format: "db.meter.%1$s"
      - type: TIMER
        errors: false
        statement-names: ["select-.*"]
        description: "Timer for successful selects"
      - type: COUNTER
        errors: false
        statement-types: ["DELETE", "UPDATE", "INSERT", "DML"]
        name-format: "db.counter.%s.success"
        description: "Counter of successful DML statements"
      - type: COUNTER
        statement-types: ["DELETE", "UPDATE", "INSERT", "DML"]
        success: false
        name-format: "db.counter.%s.error"
        description: "Counter of failed DML statements"
  statements:
    # required ping statement
    ping: "DO 0"
    # Insert new pokemon
    create-table: "CREATE TABLE pokemons (name VARCHAR(64) NOT NULL PRIMARY KEY, type VARCHAR(32))"
    insert1: "INSERT INTO pokemons VALUES(?, ?)"
    insert2: "INSERT INTO pokemons VALUES(:name, :type)"
    select-by-type: "SELECT * FROM pokemons WHERE type = ?"
    select-one: "SELECT * FROM pokemons WHERE name = ?"
    select-all: "SELECT * FROM pokemons"
    select-for-update: "SELECT * FROM pokemons WHERE name = :name for UPDATE"
    update: "UPDATE pokemons SET type = :type WHERE name = :name"
    delete: "DELETE FROM pokemons WHERE name = ?"
