<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>xyz.cofe</groupId>
        <artifactId>cxconsole-parent</artifactId>
        <version>0.2.2</version>
    </parent>
    <artifactId>cxsql</artifactId>
    <packaging>jar</packaging>
    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>cxbootstrap-cp</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>cxconsole-base</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>cxscript</artifactId>
            <version>${project.version}</version>
        </dependency>

        <!-- 
        =====================================================================
        JDBC
        =====================================================================
        -->
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>6.4.0.jre7</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/net.sourceforge.jtds/jtds -->
        <dependency>
            <groupId>net.sourceforge.jtds</groupId>
            <artifactId>jtds</artifactId>
            <version>1.3.1</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.github.noraui/ojdbc7 -->
<!--        <dependency>
            <groupId>com.github.noraui</groupId>
            <artifactId>ojdbc7</artifactId>
            <version>12.1.0.2</version>
        </dependency>-->

        <!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.2.2.jre7</version>
        </dependency>
        
        <!-- 
        https://mariadb.com/kb/en/mariadb/about-mariadb-connector-j/ 
        
        2.2 for java 8 and java 9 (JDBC 1.4.2 compliant)
        1.7 for java 6 and 7 (JDBC 1.4.1 compliant)
        
        driver:
        org.mariadb.jdbc.Driver
        
        Connection Strings
        ==================
        jdbc:(mysql|mariadb):[replication:|failover:|sequential:|aurora:]//<hostDescription>[,<hostDescription>...]/[database][?<key1>=<value1>[&<key2>=<value2>]] 
        
        HostDescription:
        <host>[:<portnumber>]  or address=(host=<host>)[(port=<portnumber>)][(type=(master|slave))]
        
        Failover Parameters:
        ====================
        sequential	
            Failover support for master replication cluster (for example Galera) 
            without High availability. The hosts will be connected in the order in which they were declared.

            Example when using the jdbc url string "jdbc:mysql:replication:host1,host2,host3/testdb" : 
            When connecting, the driver will always first try host1, 
            and if not available host2 and so on. After a host fail, 
            the driver will reconnect according to this order. 
            
            This failover method does not support load-balancing reads on slaves. 
            The first available host is used for all queries.
            since 1.3.0
            
        failover
            High availability (random picking connection initialisation) 
            with failover support for master replication cluster (for example Galera). 
            since 1.2.0
            
        replication
            High availability (random picking connection initialisation) 
            with failover support for master/slave replication cluster (one or multiple masters) 
            since 1.2.0
            
        aurora
            High availability (random picking connection initialisation) 
            with failover support for Amazon Aurora replication cluster 
            since 1.2.0
            
        Essential Options:
        ==================
        user        Database user name. since 1.0.0
        password	Password of database user.since 1.0.0
        rewriteBatchedStatements	
            For insert queries, rewrite batchedStatement to execute in a single executeQuery.
            example:
                insert into ab (i) values (?) with first batch values = 1, second = 2 will be rewritten
                insert into ab (i) values (1), (2). 

            If query cannot be rewriten in "multi-values", 
                rewrite will use multi-queries : 
                INSERT INTO TABLE(col1) VALUES (?) ON DUPLICATE KEY UPDATE col2=? with values [1,2] and [2,3]" will be rewritten
                INSERT INTO TABLE(col1) VALUES (1) ON DUPLICATE KEY UPDATE col2=2;INSERT INTO TABLE(col1) VALUES (3) ON DUPLICATE KEY UPDATE col2=4

                when active, the useServerPrepStmts option is set to false
                Default: false. Since 1.1.8
                
        connectTimeout	The connect timeout value, in milliseconds, or zero for no timeout. Default: 0. Since 1.1.8
        
        useServerPrepStmts	
            PrepareStatement are prepared on the server side before executing. 
            The applications that repeatedly use the same queries have value to activate this option, 
            but the general case is to use the direct command (text protocol).
            
            if rewriteBatchedStatements is set to true, this option will be set to false
            Default: false (was true before 1.6.0). Since 1.3.0
            
        useBatchMultiSend	*Not compatible with aurora*
            Driver will can send queries by batch. 
            If set to false, queries are sent one by one, waiting for the result before sending the next one. 
            If set to true, queries will be sent by batch corresponding 
            to the useBatchMultiSendNumber option value (default 100) 
            or according to the max_allowed_packet server variable 
            if the packet size does not permit sending as many queries. 

            Results will be read later, avoiding a lot of network latency 
            when the client and server aren't on the same host. 

            This option is mainly effective when the client is distant from the server. More information here
            Default: true (false if using aurora failover) . Since 1.5.0
        -->
        <dependency>
            <groupId>org.mariadb.jdbc</groupId>
            <artifactId>mariadb-java-client</artifactId>
            <version>1.7.3</version>
        </dependency>
        
        <!-- <dependency>
            <groupId>com.jslsolucoes</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.1.0</version>
        </dependency>-->
        
        <!-- https://mvnrepository.com/artifact/ojdbc/ojdbc -->
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc</artifactId>
            <version>10.2.0.4.0</version>
        </dependency>
        
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>sql-localds</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <!-- Поддержка Service Provider Interfaces -->
            <plugin>
                <groupId>eu.somatik.serviceloader-maven-plugin</groupId>
                <artifactId>serviceloader-maven-plugin</artifactId>
                <version>1.1.0</version>
                <configuration>
                  <services>
                    <param>xyz.cofe.cxconsole.ConsoleService</param>
                    <!--<param>xyz.cofe.cxconsole.ob.ObjectBrowserPlugin</param>-->
                    <param>xyz.cofe.gui.swing.tree.ob.ObjectBrowserPlugin</param>
                  </services>
                </configuration>
                <executions>
                  <execution>
                    <goals>
                      <goal>generate</goal>
                    </goals>
                  </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
    
    <profiles>
        <profile>
            <id>cxsql_with_groovy</id>
            <dependencies>
                <!--<dependency>-->
                    <!--<groupId>org.codehaus.groovy</groupId>-->
                    <!--<artifactId>${dep.groovy.artid}</artifactId>-->
                    <!--<version>${dep.groovy.version}</version>-->
                    <!--<type>${dep.groovy.type}</type>-->
                    <!--<type>pom</type>-->
                <!--</dependency>-->
                <dependency>
                    <groupId>${project.groupId}</groupId>
                    <artifactId>cxgroovy</artifactId>
                    <version>${project.version}</version>
                </dependency>
            </dependencies>
        </profile>
    </profiles>    
</project>