Giter Site home page Giter Site logo

neurolabs / henplus Goto Github PK

View Code? Open in Web Editor NEW
97.0 97.0 51.0 1.52 MB

HenPlus is a SQL shell that can handle multiple sessions in parallel. The commandline interface with the usual history functions features TAB-completion for commands, tables and columns. Database connect via JDBC.

License: GNU General Public License v2.0

Shell 0.46% Java 99.54%

henplus's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

henplus's Issues

Ability to not show the user name / password

When the user name / password is passed as part of
the URL connect string it will be echoed back as part
of the output. For security reasons it would be nice
to have an option to not show this information.

converting build to maven

the build has no big specialities, so for easy setup and understanding the build can/should be converted to maven, preferable maven3.

How to use Magnitude Simba drivers for BigQuery

👋 Hi -- i'm trying to set up henplus on my MacOS machine to be able to connect to BigQuery. I feel like there is a lot that I don't understand about how this is supposed to work so apologies if it is a dumb question.

I've downloaded and installed bigquery drivers from the google docs.

$ ls -l /Library/simba/googlebigqueryodbc/lib/
total 184016
-rwxrwxrwx  1 root  wheel       320 May  8 15:25 GoogleBigQueryODBC.did
-rwxrwxrwx  1 root  wheel    207949 May  8 15:25 cacerts.pem
-rwxrwxrwx  1 root  wheel  93996224 May  8 15:25 libgooglebigqueryodbc_sbu.dylib
-rwxrwxrwx  1 root  wheel       409 May  8 15:25 simba.googlebigqueryodbc.ini

I can't figure out how to tell henplus about these drivers -- there are no .jar files, so I'm not sure how to apply the directions in the docs to what I have here. Maybe it's impossible because these are .dylib and I need a .jar driver? If I'm just missing something stupid please let me know and I'd be happy to try to update the docs to help future folks avoid this issue.

import command conflicts with luciddb

luciddb has an "import" command that allows data to be imported from a foreign source, e.g.

create or replace server jdbc_link
foreign data wrapper sys_jdbc
options(
driver_class 'org.postgresql.Driver',
url 'jdbc:postgresql://localhost/db',
user_name 'postgres',
table_types 'TABLE',
fetch_size '10000',
autocommit 'false');

import foreign schema "public"
from server jdbc_link
into extraction_schema;

However, as henplus also has an "import" command, the statement above won't be able to execute successfully.

Is there any workaround to this? Thanks.

No completion after /-character

If there is an @-character in connect-strings, no
completion takes place after it. Seems, that the '@' is
some sort of break character.

Unicode input support

Hi, Guys,

Thanks you for your great efforts to develop this tools. It makes remote management of databases possible.

However, some times we need to input Chinese to make some queries. It seems that henplus can not process Unicode characters correctly.

We use set-var to do the test.
Hen*Plus> set-var HELLO 你好

then we read the 'setting' file in .henplus folder, it turns out to be:

HELLO=\u00E4\u00BD\u00A0\u00E5\u00A5\u00BD

actually, there are two characters that we have just inputed. the correct setting should be:

HELLO=\u4f60\u597d

seems that the inputed unicode charaters have been converted into byte array.

Any work around for this issue?

Connection url does not accept ";" (needed for MS SQL Server to specify the instance)

When trying to connect to a sql server (specifying the instance) with a url like jdbc:jtds:sqlserver://localhost/somedb;instance=someinst everything following the semicolon is stripped off, and henplus reports a java.lang.InternalError:

Hen*Plus> connect jdbc:jtds:sqlserver://localhost/somedb;instance=someinst
HenPlus II connecting 
 url 'jdbc:jtds:sqlserver://localhost/somedb'
 driver version 1.3
java.lang.InternalError

This happens with henplus 0.9.8

For those also running into this: as a workaround the connection can be added to ~/.henplus/connections with an alias (e.g. as jdbc:jtds:sqlserver://localhost/somedb;user=someUser;password=secret;instance=someInst somedb).
After starting henplus it's possible to connect somedb.

Own classloaders for drivers and plugins

Right now, the jdbc-drivers and plugins are loaded by
the system classloader. This should be replaced by
classloaders that can load/unload these parts at runtime.

no possibility to cancel the loading of an sql script sanely

when loading an sql script via the 'load' command,
there seems to be no mechanism to cancel/interrupt the
load process except hitting control-c to kill henplus.
This would be nice, though, since if one has a big
script to load which has some errors/incompatibilities
in it, one has to either wait for the loading to finish
or kill henplus, start it, connect and type in the load
command again.

completing with tab leads to second-to-last line executed

under certain circumstances not the last line, but the second to last line is executed. Reproduction:

rollback;
select * from person where person_id = 1; # press tab anywhere after the table name, e.g. in the where or after the 1...

result:
rollback is executed twice, the select statement is not executed.

Add Event Listener structure

We need an Event Listener structure, that allows plugins
to register for certain events like dispatched commands
or start/exit of HenPlus.

Alright. The first event listener is available. An
ExecutionListener can be added to the CommandDispatcher. It
is now used in EchoCommandProperty that uses it to write out
commands when this property is changed to 'true'.

I'll leave this bug open, since other listeners need to be
added..

Dump drops time from DATE type with Oracle

I have a DB using Oracle's DATE type which contains times as well as dates (as of 9.2). If I dump a table, the column is listed as type DATE and only the date is shown; the time data is lost.

Is this able to be handled or just tough luck that Oracle couldn't play nice with the standard?

Patch: Multiple result set support

Hi Everyone,

I am using HenPlus with MS SQL database and need to get multiple result sets with a single SQL query at times
It is fairly easy to fix, just add a loop in the SQLCommand class.

As a result of that the following things started to work correctly:

  • sp_help MS SQL function shows all information about tables
  • Stored procs would return all results now
  • Multiline queries like:
    SELECT 1
    SELECT 'asdf'
    SELECT CURRENT_TIMESTAMP
    /
    return multiple result sets.

Kind regards,
Evgeny.

https://gist.github.com/759814

Add "sql-result-nowrap" global property

Doing "select _" from a table with many columns results in lots of
line wrapping. It would be nice if henplus had a feature similar to
SQL_PLUS's "set wrap off", which truncates each row returned to
the width of the terminal. The resulting output is much more
readable. Thanks!

Enhance the availability of rpm packages

Right now the rpm is only available for download but not to be used by package managers like e.g. yum.

To enhance the availability of henplus for rpm-based distributions there could be set up a repo together with an .repo file that can be put into the yum.repos.d folder.
An even better alternative would be to pull it into the fedora distro, so that users have henplus available without doing anything.

For other rpm-based distros the package management must be checked out on what's required for integration.

derby JDBC urls fail

Hello, derby uses semicolons in the JDBC URL. This
confuses henplus and it truncates the URL. escaping
via ; does not work, either.
EX: jdbc:derby://localhost:1527/foo;var=val;var2=val2

Unexpected exit - no Hen*Plus prompt shown

Hey folks,

I once again ended up trying to make henplus work on my laptop but I got the same problem again. After installation (through dist. Ubunutu 11.04) I provided the JDBC driver in home config and types henplus in a shell. I get the wellcome prompt

using GNU readline (Brian Fox, Chet Ramey), Java wrapper by Bernhard Bablok
henplus config at /home/jan/.henplus
---------------------------------------------------------------------------
 HenPlus II 0.9.7-2 Debian
 Copyright(C) 1997..2006 Henner Zeller <[email protected]>
 HenPlus is provided AS IS and comes with ABSOLUTELY NO WARRANTY
 This is free software, and you are welcome to redistribute it under the
 conditions of the GNU Public License <http://www.gnu.org/licenses/gpl.txt>
---------------------------------------------------------------------------
usage: henplus
 -h,--help <arg>            print this message
 -J,--url <jdbc:...>        JDBC URL to connect to
 -P,--password <password>   Password to connect with
 -U,--username <username>   Username to connect with

I tried to provide URL, user and password using parameters. They are recognised correctly but after all I directly be back in the shell. No prompt Hen*Plus like in the docs ever shown up. As far as I know this is a more or less known issue running a 64bit system. I run:

$uname -a
Linux ist286 2.6.38-13-generic #55-Ubuntu SMP Tue Jan 24 15:34:24 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux

Any questions or suggestions ?

Greets from Sweden
Jan

Tab completition troubles

Hi,

as I'm not able to find some contact on devs I'm putting this as a bug here.
Thanks for the henplus. It's very nice tool.

To my problem: in short tab completion does not work for me.
I've tried to investigate a bit around and the problem is that readline library on call here
https://github.com/neurolabs/henplus/blob/master/src/henplus/HenPlus.java#L400
returns all the time empty string. It does not matter what resides on the input line.

I'm not sure whether there is not some settings in my environment that could stop the readline proceeding correctly. Or just things changed after the last readline release?

I'm running Fedora 20, KDE.

Thanks for any hint
Ondra

dump-in / dump-out not aware of boolean columns

some databases know boolean columns.
dump-out extracts these as numeric, but uses
rs.getObject(col).toString() for output. so the output
in this cases might read "true" or "false".
sadly, dump-in cannot read this dumps, as it tries to
read these values as numeric or pass them as number to
the database, which in turn, has trouble converting
"true" or "false".

SIGINT (Ctrl-C) end program

I use HenPlus II 0.9.7 with sun java 1.4.2_06.
When I press Ctrl-C in line (empty as well as not
empty) henplus write the message:
..discard current line; press [RETURN]
after my RETURN henplus ... store settings and finish :(

I think shell-like program should not stop after Ctrl-C
only discard current line...

I comment 432 line as bellow:

432c432
< _terminated = true; // terminate if we press
CTRL on empty line.

---
> //_terminated = true; // terminate if we press
CTRL on empty line.

and (Ctrl-C) works as I expect (after RETURN program
continue work). Perhaps is it good idea to apply
similar above patch to henplus?

Patch: set_var_from_query command

help set-var-from-query
SYNOPSIS: set-var-from-query [ ]

DESCRIPTION: Wit is retrieved from the sql query. The first colomn from the first row is used to set the variable. Variables are expanded in any command you issue on the commandline. Variable expansion works like on the shell with the dollarsign. Both forms, $VARNAME and ${VARNAME}, are supported. If the variable is not set, then the text is left untouched. So if there is no variable $VARNAME, then it is not replaced by an empty string but stays '$VARNAME'. This is because some scripts use wierd identifiers containting dollars (esp. Oracle scripts) If you want to quote the dollarsign explicitly, write two dollars: $$FOO means $FOO Requires valid session.

https://gist.github.com/759803

Silent feature similar to SQLPlus

It would be of great help if there was a -silent or -s
option on the comand line like in SQLPlus that would
remove all the gratuitous output like the startup
output, the prompt and the timing so that it only
outputs the result of the query, nothing else.

I mainly need this so I can select a value from a
database column directly into a Unix environment
variable. This would be an example -

!/bin/sh

VALUE=henplus -silent user/password@instance <<END set-property sql-result-showheader off set-property sql-result-showfooter off set-property column-delimiter "" select max(c1) from t1; exit END
if [ -z "$VALUE" ]; then
echo "No rows returned from database"
exit 0
else
echo $VALUE
fi

TAB-completion through schema doesn't work

First thanks for henplus - it's very nice tool.
However it doesn't complete table names when I use
schema prefix e.g.:
select * from myschema.t

It doesn't trace current schema too. When I change
schema (e.g. in hsqldb: set schema myschema) and
command rehash, henplus complete names from default
(public) schema, but they are not actual...

I observe above troubles with hsqldb.

Regards
Marek

Do dependency reordering for dump-out

The dump-out command takes a list of tables that are
exported in that sequence. It would be nice however if
the sequence would be re-ordered before export so
that dependencies are minimized.
This allows to dump-in the tables without having to
drop constraints.
Ok, this cannot help for cyclic dependencies
(which still requires switching off constraints for the
import) but for many schemas this would help definitly.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.