Commit Graph

81 Commits

Author SHA1 Message Date
Jonas Thelemann
c34f5fd2d4 Use "could not" consistently, instead of "couldn't" which was used in some places. 2017-03-07 10:29:54 +00:00
Ashesh Vashi
f2fc1ceba8 Resolved quite a few file-system encoding/decoding related cases.
In order to resolve the non-ascii characters in path (in user directory,
storage path, etc) on windows, we have converted the path into the
short-path, so that - we don't need to deal with the encoding issues
(specially with Python 2).

We've resolved majority of the issues with this patch.
We still need couple issues to resolve after this in the same area.

TODO
* Add better support for non-ascii characters in the database name on
  windows with Python 3
* Improve the messages created after the background processes by
  different modules (such as Backup, Restore, Import/Export, etc.),
  which does not show short-paths, and xml representable characters for
  non-ascii characters, when found in the database objects, and the file
  PATH.

Fixes #2174, #1797, #2166, #1940

Initial patch by: Surinder Kumar
Reviewed by: Murtuza Zabuawala
2017-03-07 15:31:03 +05:30
Harshal Dhumal
ffa8d94e76 Better handling the non-ascii characters for different database objects.
Using 'psycopg2.extensions.UNICODE' (for Python < 3) in the psycopg2
driver for proper conversation of unicode characters. Also - adjusted
the string typecaster to take care of different character types (char,
character, text, name, character varying, and their array types).

Reviewed by: Dave Page, Murtuza Zabuawala & Akshay Joshi
2017-03-02 15:09:28 +05:30
Murtuza Zabuawala
480e00fddf Query tool efficiency.Convert the data as a 2D array instead of dict. Fixes #2036
Incremental back off when polling. Fixes #2038

Initial Patch By: Dave Page
2017-03-01 16:58:51 +05:30
Surinder Kumar
88cae263b2 Fix display of long integers and decimals. Fixes #2039. Fixes #2119. Fixes #2154 2017-02-24 13:39:40 +00:00
Murtuza Zabuawala
9ad1316990 Various encoding fixes. Fixes #2160 2017-02-16 11:00:40 +00:00
Murtuza Zabuawala
2d442da9ff Properly handle setting comments and other options on databases with allowconn = False. Fixes #2024 2017-02-01 10:23:45 +00:00
Dave Page
f221194bcc Update copyright notices for 2017. 2017-01-04 13:33:32 +00:00
Dave Page
ca333ea6a7 Don't strip \r\n from "Download as CSV" batches of rows, as it leads to malformed data. Fixes #1936 2016-11-07 14:47:50 +00:00
Murtuza Zabuawala
bde3dd845b Fix SSL setup. Fixes #1817 2016-10-05 13:05:10 +01:00
Ashesh Vashi
09c2d605c9 Prevent bigints getting rounded. Fixes #1547 2016-09-26 15:51:01 +01:00
Harshal Dhumal
f117685d77 Drop all connections from the connection manager when a server is dropped to avoid issues if sqlite reuses an ID. Fixes #1720 2016-09-22 12:57:52 +01:00
Surinder Kumar
28ce31a022 Save error details when executing to CSV, if no data is returned. This ensures the user gets some feedback rather than nothing at all. Fixes #1592 2016-09-20 11:57:51 +01:00
Murtuza Zabuawala
881d2a60a4 Fix an exception that could occur when the browser pings the server following a restart. Fixes #1707 2016-09-19 15:57:52 +01:00
Murtuza Zabuawala
42e19d2169 Fix error highlighting, broken in d6391c7e9b. Fixes #1676 2016-09-09 14:45:03 +01:00
Surinder Kumar
da21cabb1e Fix typo in connection handler. 2016-09-07 14:01:56 +01:00
Murtuza Zabuawala
679ad6fca8 Support range types in the query tool. Fixes #1658 2016-09-06 14:26:43 +01:00
Murtuza Zabuawala
1b75679ec4 Python 2.6 fixes. Fixes #1636. Fixes #1659 2016-09-06 14:07:30 +01:00
Ashesh Vashi
8ac65070bc Improve the logic for Bad handling of missing connection database server RM #1387 2016-09-06 15:35:20 +05:30
Ashesh Vashi
f12d981a9d Handling the bad/lost connection of a database server.
Made backend changes for:
* Taking care of the connection status in the psycopg2 driver. And, when
  the connection is lost, it throws a exception with 503 http status
  message, and connection lost information in it.
* Allowing the flask application to propagate the exceptions even in the
  release mode.
* Utilising the existing password (while reconnection, if not
  disconnected explicitly).
* Introduced a new ajax response message 'service_unavailable' (http
  status code: 503), which suggests temporary service unavailable.

Client (front-end) changes:
* To handle the connection lost of a database server for different
  operations by generating proper events, and handle them properly.

Removed the connection status check code from different nodes, so that
- it generates the proper exception, when accessing the non-alive
  connection.

Fixes #1387
2016-08-29 12:01:35 +05:30
Murtuza Zabuawala
d6391c7e9b Properly display messages from the server in the query tool. Fixes #1523 2016-08-18 17:08:40 +01:00
Murtuza Zabuawala
01252a13cf Further misc quoting/encoding related fixes. 2016-08-01 15:23:06 +01:00
Murtuza Zabuawala
06e881570a Fix numerous encoding issues. Fixes #1307. Fixes #1479 2016-07-26 15:05:14 +01:00
Dave Page
60659975ed Stop using deprecated imports. 2016-07-22 16:25:23 +01:00
Ashesh Vashi
8b35a60c08 Generate the proper unique name for the duplicate column name.
Thanks Murtuza for reporting the issue.
2016-07-19 11:27:03 +05:30
Harshal Dhumal
83a1535f89 Fix saving of query output as CSV data. Fixes #1405 2016-07-18 15:29:09 +01:00
Murtuza Zabuawala
5560d5b334 Properly support the interval type. Fixes #1437 2016-07-18 09:40:45 +01:00
Ashesh Vashi
9ba6bafb2b Using own version of cursor class to allow us to take care of the
duplicate name in column description.
2016-07-16 10:42:51 +05:30
Dave Page
7d0fe669ca Code tidy. 2016-06-21 14:21:06 +01:00
Dave Page
3026b470e9 Optimise Python imports. 2016-06-21 14:12:14 +01:00
Ashesh Vashi
fc295f94a3 Remove recusive call of _wait_timeout() due to which python server is crashing 2016-06-16 17:49:02 +05:30
Murtuza Zabuawala
a800b19c87 Fix display of NaN and Bytea data. Fixes #1350. Fixes #1309 2016-06-16 11:20:00 +01:00
Surinder Kumar
5dbbd8e638 Resolve problem displaying intervals and timestamps. Fixes #1352
1) No handling for INTERVAL type datetime.
For example: executing query
SELECT INTERVAL '15 minutes';
throws json serialization error, because it returns time in timedelta format which is not handled.

Added support to handle timedelta datetime format in DataTypeJSONEncoder class

2) When we try to get BC dates from database raises ValueError: year is out of range
For eg:
SELECT TIMESTAMP '0044-03-15 10:00:00 BC',
It is because pyscopg2 doesn't handle BC datetime format.

So we have defined our method which type cast the datetime value to string in pyscopg2 overriding default behaviour.

Reference:
http://initd.org/psycopg/docs/advanced.html#type-casting-from-sql-to-python
ccf3693be6/pgcli/pgexecute.py
2016-06-14 17:09:47 +01:00
Ashesh Vashi
7d08e42bbe During encryption password is converted to buffer (instead of
bytearray), and that is causing the issue in Python 2.

This was regress of commit-id: 37e2e1d24b
2016-06-07 13:26:43 +05:30
Ashesh Vashi
37e2e1d24b Fixing the decryption issue during restoring the connection on restart.
As we convert the binary password to string during storing the
connection information, we also need to convert it back to byte-arrays
during restoring the connections.

Hence - decode the passowrd using 'utf-8' encoding during storing the
connection information, and encode it during restoring the connections.
2016-06-06 22:48:53 +05:30
Ashesh Vashi
ca62825c90 Set PGPASSWORD environment variable from the process executor before running
the external utility.
2016-05-15 22:29:17 +05:30
Harshal Dhumal
14839bf5de Always make sure - we convert the psasword to string in the as_dict
function.
2016-05-14 01:14:26 +05:30
Ashesh Vashi
b22d73ec46 Improvise the pgsql driver to keep the utility names used for different
operation like backup, restore, etc within it.

Also:
* improvised the color combination of the background process logger.
* Removed an unnecessary print statement from the
  get_storage_directory(..) function, also return None if STORAGE_DIR
  is set to None.
2016-05-14 00:48:20 +05:30
Ashesh Vashi
7f790a7f49 Use the same cursor object of a connection object only from the same
server.

Current implementation keeps the cursor object in the 'g' (current
request context) object identified by the connection-id.
But - it fails to identify a different connection object request, when
we have same database name in different database server, it does not
able to identify it as separate request, Hence - now we will use
server-id qualified identifier for the same object.

Thanks Neel Patel for pointing out the issue.
2016-05-12 13:08:38 +05:30
Karen Blatchley
949e536bae First round of string review and cleanup. 2016-05-06 13:53:48 +01:00
Ashesh Vashi
26e9ceaf48 Do not reset the driver registry when the 'load_driver' method of
DriverRegistry is executed second time.

Also, initialize the driver before registering different blueprints,
which uses those driver inside them.

Thanks Khushboo for reporting the issue.
2016-04-25 15:33:54 +05:30
Akshay Joshi
03d6fce53c Add support for an affected row count property to the DB interface. 2016-04-12 17:02:54 +01:00
Ashesh Vashi
c304d3e90e Save the database OID of the maintenance database. 2016-04-11 17:15:55 +05:30
Neel Patel
e585ddbdaf Improvise the PostgreSQL driver to fetch the status message.
At the moment, we will only allow to fetch status messages from the
asynchronous connection only, later - we may implement to fetch the
status message from the normal connection too.
2016-04-05 13:29:20 +05:30
Akshay Joshi
5331075ab0 Improvise the psycopg2 wrapped driver for PostgreSQL to show formatted
message on demand.

Also - resolved an issue identifying the aborted transaction while using
the asychronous connection.
2016-04-04 12:29:43 +05:30
Ashesh Vashi
b3c625f135 Graceful server reconnections. 2016-03-22 15:35:11 +00:00
Neel Patel
ff424850f8 Fix a bug in the database drive poll() function where we could try to reference a non-existant variable. 2016-03-15 13:01:28 +00:00
Akshay Joshi
f08aa6a313 Always fetch column info from the server, even if there are no rows. 2016-03-08 15:59:53 +00:00
Dave Page
5ea822f33e Preferences dialogue. Patch by Ashesh and Khushboo Vashi. 2016-03-07 11:48:53 +00:00
Neel Patel
31ab9ebacc Using the correct member variable while fetching the notices/messages
from the psycopg2 connection.
2016-03-06 18:56:42 +05:30