1 56 package org.objectstyle.cayenne.dba.sybase; 57 58 import java.sql.PreparedStatement ; 59 import java.sql.SQLException ; 60 import java.sql.Types ; 61 62 import org.objectstyle.cayenne.access.types.ByteArrayType; 63 import org.objectstyle.cayenne.access.types.ByteType; 64 import org.objectstyle.cayenne.access.types.CharType; 65 import org.objectstyle.cayenne.access.types.ExtendedTypeMap; 66 import org.objectstyle.cayenne.access.types.ShortType; 67 import org.objectstyle.cayenne.dba.JdbcAdapter; 68 import org.objectstyle.cayenne.dba.PkGenerator; 69 70 75 public class SybaseAdapter extends JdbcAdapter { 76 77 82 public String getBatchTerminator() { 83 return "go"; 84 } 85 86 90 protected void configureExtendedTypes(ExtendedTypeMap map) { 91 super.configureExtendedTypes(map); 92 93 map.registerType(new CharType(true, false)); 95 96 map.registerType(new ByteArrayType(true, false)); 98 99 map.registerType(new ShortType(true)); 101 map.registerType(new ByteType(true)); 102 } 103 104 109 protected PkGenerator createPkGenerator() { 110 return new SybasePkGenerator(); 111 } 112 113 public void bindParameter( 114 PreparedStatement statement, 115 Object object, 116 int pos, 117 int sqlType, 118 int precision) 119 throws SQLException , Exception { 120 121 if (object == null) { 123 if (sqlType == Types.CLOB) { 124 sqlType = Types.VARCHAR; 125 } 126 else if (sqlType == Types.BLOB) { 127 sqlType = Types.VARBINARY; 128 } 129 } 130 131 super.bindParameter(statement, object, pos, sqlType, precision); 132 } 133 } | Popular Tags |