<commit_before>/*
 ************************************************************************
 ****  C A N A D I A N   A S T R O N O M Y   D A T A   C E N T R E  *****
 *
 * (c) 2015.                            (c) 2015.
 * National Research Council            Conseil national de recherches
 * Ottawa, Canada, K1A 0R6              Ottawa, Canada, K1A 0R6
 * All rights reserved                  Tous droits reserves
 *
 * NRC disclaims any warranties         Le CNRC denie toute garantie
 * expressed, implied, or statu-        enoncee, implicite ou legale,
 * tory, of any kind with respect       de quelque nature que se soit,
 * to the software, including           concernant le logiciel, y com-
 * without limitation any war-          pris sans restriction toute
 * ranty of merchantability or          garantie de valeur marchande
 * fitness for a particular pur-        ou de pertinence pour un usage
 * pose.  NRC shall not be liable       particulier.  Le CNRC ne
 * in any event for any damages,        pourra en aucun cas etre tenu
 * whether direct or indirect,          responsable de tout dommage,
 * special or general, consequen-       direct ou indirect, particul-
 * tial or incidental, arising          ier ou general, accessoire ou
 * from the use of the software.        fortuit, resultant de l'utili-
 *                                      sation du logiciel.
 *
 ****  C A N A D I A N   A S T R O N O M Y   D A T A   C E N T R E  *****
 ************************************************************************
 */

package ca.nrc.cadc.caom2.harvester.state;

import ca.nrc.cadc.caom2.util.CaomUtil;

import javax.sql.DataSource;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;
import java.util.UUID;

public class SybaseHarvestStateDAO extends HarvestStateDAO
{
    public SybaseHarvestStateDAO(DataSource dataSource, String database, String schema)
    {
        super(dataSource, database, schema);
    }

    protected String getTable(String database, String schema)
    {
        StringBuilder sb = new StringBuilder();
//        sb.append(schema);
        sb.append("caom2");
        sb.append("_");
        sb.append("HarvestState");
        return sb.toString();
    }

    protected void setUUID(PreparedStatement ps, int col, UUID uuid)
        throws SQLException
    {
        if (uuid != null)
        {
            Long val = CaomUtil.uuidToLong(uuid);
            ps.setLong(col, val);
        }
        else
        {
            ps.setNull(col++, Types.BIGINT);<commit_msg>ac2release: removed auth stored procedure and directly query caom2 tables, properties file to replace authorization_config table, new class to run archive is_public stored procedures<commit_after>/*
 ************************************************************************
 ****  C A N A D I A N   A S T R O N O M Y   D A T A   C E N T R E  *****
 *
 * (c) 2015.                            (c) 2015.
 * National Research Council            Conseil national de recherches
 * Ottawa, Canada, K1A 0R6              Ottawa, Canada, K1A 0R6
 * All rights reserved                  Tous droits reserves
 *
 * NRC disclaims any warranties         Le CNRC denie toute garantie
 * expressed, implied, or statu-        enoncee, implicite ou legale,
 * tory, of any kind with respect       de quelque nature que se soit,
 * to the software, including           concernant le logiciel, y com-
 * without limitation any war-          pris sans restriction toute
 * ranty of merchantability or          garantie de valeur marchande
 * fitness for a particular pur-        ou de pertinence pour un usage
 * pose.  NRC shall not be liable       particulier.  Le CNRC ne
 * in any event for any damages,        pourra en aucun cas etre tenu
 * whether direct or indirect,          responsable de tout dommage,
 * special or general, consequen-       direct ou indirect, particul-
 * tial or incidental, arising          ier ou general, accessoire ou
 * from the use of the software.        fortuit, resultant de l'utili-
 *                                      sation du logiciel.
 *
 ****  C A N A D I A N   A S T R O N O M Y   D A T A   C E N T R E  *****
 ************************************************************************
 */

package ca.nrc.cadc.caom2.harvester.state;

import ca.nrc.cadc.caom2.util.CaomUtil;
import ca.nrc.cadc.util.HexUtil;

import javax.sql.DataSource;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;
import java.util.UUID;

public class SybaseHarvestStateDAO extends HarvestStateDAO
{
    public SybaseHarvestStateDAO(DataSource dataSource, String database, String schema)
    {
        super(dataSource, database, schema);
    }

    protected String getTable(String database, String schema)
    {
        StringBuilder sb = new StringBuilder();
//        sb.append(schema);
        sb.append("caom2");
        sb.append("_");
        sb.append("HarvestState");
        return sb.toString();
    }

    protected void setUUID(PreparedStatement ps, int col, UUID uuid)
        throws SQLException
    {
        if (uuid != null)
        {
//            Long val = CaomUtil.uuidToLong(uuid);
//            ps.setLong(col, val);
            ps.setBytes(col, HexUtil.toBytes(CaomUtil.uuidToLong(uuid)));
        }
        else
        {
            ps.setNull(col++, Types.BINARY);
{'fraction_non_alphanumeric': 0.12834323922734026, 'fraction_numerical': 0.006686478454680535, 'mean_word_length': 2.3302411873840447, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3637008', 'n_tokens_mistral': 1558, 'n_tokens_neox': 1487, 'n_words': 568}