001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.scheduler.quartz;
016    
017    import java.io.ByteArrayOutputStream;
018    
019    import java.sql.PreparedStatement;
020    import java.sql.SQLException;
021    
022    import org.quartz.impl.jdbcjobstore.MSSQLDelegate;
023    
024    import org.slf4j.Logger;
025    
026    /**
027     * <p>
028     * See http://issues.liferay.com/browse/LPS-14611.
029     * </p>
030     *
031     * @author Brian Wing Shun Chan
032     */
033    public class SybaseDelegate extends MSSQLDelegate {
034    
035            public SybaseDelegate(
036                    Logger logger, String tablePrefix, String instanceId) {
037    
038                    super(logger, tablePrefix, instanceId);
039            }
040    
041            public SybaseDelegate(
042                    Logger logger, String tablePrefix, String instanceId,
043                    Boolean useProperties) {
044    
045                    super(logger, tablePrefix, instanceId, useProperties);
046            }
047    
048            @Override
049            protected void setBytes(
050                            PreparedStatement ps, int index, ByteArrayOutputStream baos)
051                    throws SQLException {
052    
053                    if (baos == null) {
054                            ps.setBytes(index, null);
055                    }
056                    else {
057                            ps.setBytes(index, baos.toByteArray());
058                    }
059            }
060    
061    }