提交 b5bba2f3 编写于 作者: S Serge Rider

Merge remote-tracking branch 'origin/devel' into devel

......@@ -52,6 +52,12 @@
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.jkiss.dbeaver.ext.phoenix"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="org.jkiss.dbeaver.ext.informix"
download-size="0"
......
......@@ -596,6 +596,16 @@
<parameter name="ddl-drop-column-short" value="true"/>
<parameter name="supports-scroll" value="false"/>
</driver>
<driver
id="phoenix"
label="PhoenixHBase"
class="org.apache.phoenix.jdbc.PhoenixDriver"
sampleURL="jdbc:phoenix:{host}"
webURL="http://phoenix.apache.org/"
description="Driver for Phoenix HBase Database">
<parameter name="omit-type-cache" value="true"/>
<file type="jar" path="repo:/drivers/phoeinx/phoenix-4.7.0-HBase-1.1-client.jar.jar"/>
</driver>
<driver
id="csvjdbc"
label="CSV/DBF"
......
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.jkiss.dbeaver.ext.phoenix</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
#Thu Dec 30 16:00:50 MSK 2010
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Phoenix Hbase Plug-in
Bundle-SymbolicName: org.jkiss.dbeaver.ext.phoenix;singleton:=true
Bundle-Version: 1.0.22
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.ui.views,
org.eclipse.jface,
org.eclipse.jface.text,
org.jkiss.dbeaver.core,
org.eclipse.ui.workbench.texteditor,
org.jkiss.dbeaver.ext.generic
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-Vendor: JKISS
Bundle-ClassPath: .
Bundle-Localization: plugin
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
plugin.properties
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension point="org.jkiss.dbeaver.generic.meta">
<meta id="phoenixServer" class="org.jkiss.dbeaver.ext.phoenix.model.PhoenixMetaModel"
driverClass="org.apache.phoenix.jdbc.PhoenixDriver"/>
</extension>
<extension point="org.jkiss.dbeaver.dataTypeProvider">
<provider
class="org.jkiss.dbeaver.ext.phoenix.model.data.PhoenixValueHandlerProvider"
description="phoenix data types provider"
id="org.jkiss.dbeaver.ext.phoenix.model.data.PhoenixValueHandlerProvider"
label="Phoenix data types provider">
<datasource id="generic" />
<type standard="ARRAY"/>
</provider>
</extension>
</plugin>
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jkiss.dbeaver</groupId>
<artifactId>dbeaver</artifactId>
<version>1.0.0</version>
<relativePath>../../</relativePath>
</parent>
<artifactId>org.jkiss.dbeaver.ext.phoenix</artifactId>
<version>1.0.0</version>
<packaging>eclipse-plugin</packaging>
</project>
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2016 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.ext.phoenix;
import org.jkiss.dbeaver.Log;
/**
* VerticaUtils
*/
public class PhoenixUtils {
static final Log log = Log.getLog(PhoenixUtils.class);
}
package org.jkiss.dbeaver.ext.phoenix.model;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.ext.generic.model.GenericDataSource;
import org.jkiss.dbeaver.ext.generic.model.meta.GenericMetaModel;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCDatabaseMetaData;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import org.jkiss.dbeaver.model.sql.SQLDialect;
public class PhoenixDataSource extends GenericDataSource {
public PhoenixDataSource(DBRProgressMonitor monitor, DBPDataSourceContainer container, GenericMetaModel metaModel)
throws DBException {
super(monitor, container, metaModel);
}
@Override
protected SQLDialect createSQLDialect(@NotNull JDBCDatabaseMetaData metaData) {
return new PhoenixSQLDialect(this, metaData);
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2016 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.ext.phoenix.model;
import org.eclipse.core.runtime.IConfigurationElement;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.DBException;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.ext.generic.model.GenericDataSource;
import org.jkiss.dbeaver.ext.generic.model.GenericProcedure;
import org.jkiss.dbeaver.ext.generic.model.GenericTable;
import org.jkiss.dbeaver.ext.generic.model.meta.GenericMetaModel;
import org.jkiss.dbeaver.model.DBPDataSourceContainer;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.exec.DBCQueryTransformProvider;
import org.jkiss.dbeaver.model.exec.DBCQueryTransformType;
import org.jkiss.dbeaver.model.exec.DBCQueryTransformer;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCResultSet;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession;
import org.jkiss.dbeaver.model.impl.sql.QueryTransformerLimit;
import org.jkiss.dbeaver.model.runtime.DBRProgressMonitor;
import java.sql.SQLException;
/**
* PhoenixMetaModel
*/
public class PhoenixMetaModel extends GenericMetaModel implements DBCQueryTransformProvider
{
static final Log log = Log.getLog(PhoenixMetaModel.class);
public PhoenixMetaModel(IConfigurationElement cfg) {
super(cfg);
}
public String getViewDDL(DBRProgressMonitor monitor, GenericTable sourceObject) throws DBException {
return getTableDDL(monitor, sourceObject);
}
@Nullable
@Override
public DBCQueryTransformer createQueryTransformer(@NotNull DBCQueryTransformType type) {
if (type == DBCQueryTransformType.RESULT_SET_LIMIT) {
return new QueryTransformerLimit(false);
}
return null;
}
@Override
public GenericDataSource createDataSource(DBRProgressMonitor monitor, DBPDataSourceContainer container) throws DBException {
return new PhoenixDataSource(monitor, container, this);
}
@Override
public boolean supportsUpsertStatement() {
return true;
}
}
package org.jkiss.dbeaver.ext.phoenix.model;
import org.jkiss.dbeaver.ext.generic.model.GenericDataSource;
import org.jkiss.dbeaver.ext.generic.model.GenericSQLDialect;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCDatabaseMetaData;
import org.jkiss.dbeaver.model.sql.SQLDialect;
public class PhoenixSQLDialect extends GenericSQLDialect {
public PhoenixSQLDialect(GenericDataSource dataSource, JDBCDatabaseMetaData metaData) {
super(dataSource, metaData);
schemaUsage = SQLDialect.USAGE_ALL;
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2016 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.ext.phoenix.model.data;
import org.jkiss.code.NotNull;
import org.jkiss.dbeaver.model.exec.DBCException;
import org.jkiss.dbeaver.model.exec.DBCSession;
import org.jkiss.dbeaver.model.exec.DBCStatement;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCPreparedStatement;
import org.jkiss.dbeaver.model.exec.jdbc.JDBCSession;
import org.jkiss.dbeaver.model.impl.jdbc.data.JDBCArray;
import org.jkiss.dbeaver.model.impl.jdbc.data.handlers.JDBCArrayValueHandler;
import org.jkiss.dbeaver.model.struct.DBSTypedObject;
import java.lang.reflect.Method;
import java.sql.Array;
import java.sql.SQLException;
/**
* PhoenixArrayValueHandler
*/
public class PhoenixArrayValueHandler extends JDBCArrayValueHandler {
public static final PhoenixArrayValueHandler INSTANCE = new PhoenixArrayValueHandler();
public static final String PHOENIX_ARRAY_TYPE = "PhoenixArray";
@Override
public Object getValueFromObject(@NotNull DBCSession session, @NotNull DBSTypedObject type, Object object, boolean copy) throws DBCException
{
if (object != null && object.getClass().getSimpleName().contains(PHOENIX_ARRAY_TYPE)) {
return JDBCArray.makeArray((JDBCSession) session, (Array)object);
}
return super.getValueFromObject(session, type, object, copy);
}
@Override
protected void bindParameter(
JDBCSession session,
JDBCPreparedStatement statement,
DBSTypedObject paramType,
int paramIndex,
Object value)
throws DBCException, SQLException
{
if (value instanceof JDBCArray) {
JDBCArray jdbcArray = (JDBCArray)value;
String elementType = jdbcArray.getComponentType().getTypeName();
Array arrayVal = statement.getConnection().createArrayOf(elementType, (Object [])jdbcArray.getRawValue());
statement.setArray(paramIndex, arrayVal);
} else {
throw new DBCException("Unsupported value type: " + value);
}
}
}
/*
* DBeaver - Universal Database Manager
* Copyright (C) 2010-2016 Serge Rieder (serge@jkiss.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2)
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jkiss.dbeaver.ext.phoenix.model.data;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPImage;
import org.jkiss.dbeaver.model.DBUtils;
import org.jkiss.dbeaver.model.data.DBDPreferences;
import org.jkiss.dbeaver.model.data.DBDValueHandler;
import org.jkiss.dbeaver.model.data.DBDValueHandlerProvider;
import org.jkiss.dbeaver.model.struct.DBSTypedObject;
import java.sql.Types;
/**
* PhoenixValueHandlerProvider
*/
public class PhoenixValueHandlerProvider implements DBDValueHandlerProvider {
@Override
public DBPImage getTypeImage(DBSTypedObject type)
{
return DBUtils.getDataIcon(type);
}
@Nullable
@Override
public DBDValueHandler getHandler(DBPDataSource dataSource, DBDPreferences preferences, DBSTypedObject typedObject)
{
int typeID = typedObject.getTypeID();
if (typeID == Types.ARRAY) {
return PhoenixArrayValueHandler.INSTANCE;
} else {
return null;
}
}
}
\ No newline at end of file
......@@ -49,7 +49,7 @@ public class JDBCSQLDialect extends BasicSQLDialect {
private String catalogSeparator;
private boolean isCatalogAtStart;
private int catalogUsage;
private int schemaUsage;
protected int schemaUsage;
private String validCharacters;
private boolean supportsUnquotedMixedCase;
private boolean supportsQuotedMixedCase;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册