Skip to content

Commit c954307

Browse files
committed
Merge branch 'master' into develop
2 parents 343268e + 4fcb2ff commit c954307

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ RUN dotnet publish --no-restore -c Release ./Web/QueryTree.csproj -o /dist
77
FROM microsoft/dotnet:2.2-aspnetcore-runtime as runtime
88
WORKDIR /app
99
COPY --from=builder /dist .
10-
COPY ./Web/EmailTemplates ./EmailTemplates
10+
COPY --from=builder /build/Web/EmailTemplates ./EmailTemplates
1111
VOLUME /var/lib/querytree
1212
ENV ConnectionStrings__DefaultConnection="Filename=/var/lib/querytree/querytree.db;"
1313
ENV Passwords__Keyfile="/var/lib/querytree/querytree.key"

Engine/NodeBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protected bool IsNumberType(string colType)
9191

9292
protected bool IsTextType(string colType)
9393
{
94-
var quotedTypes = new List<string>() { "VARCHAR", "NVARCHAR", "CHAR", "NCHAR", "ENUM", "XML", "CHARACTER VARYING", "CHARACTER", "TEXT", "USER-DEFINED" };
94+
var quotedTypes = new List<string>() { "VARCHAR", "NVARCHAR", "CHAR", "NCHAR", "ENUM", "XML", "CHARACTER VARYING", "CHARACTER", "TEXT", "USER-DEFINED", "LONGTEXT" };
9595

9696
switch (DatabaseType)
9797
{

Web/Managers/DbManager.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Microsoft.Extensions.Caching.Memory;
1313
using QueryTree.Enums;
1414
using QueryTree.ViewModels;
15+
using System.Text.RegularExpressions;
1516

1617

1718
namespace QueryTree.Managers
@@ -648,6 +649,14 @@ public static DbCommand CreateCommand(DatabaseType type, DbConnection conn, stri
648649
return cmd;
649650
}
650651

652+
// Sometimes DbDataReader.GetDataTypeName returns a length specifier, which isn't useful
653+
// to QueryTree, is different to the GetDbModel data and breaks things. This removes it
654+
private string RemoveLengthSpecifier(string databaseType)
655+
{
656+
var re = new Regex("\\([0-9]*\\)$");
657+
return re.Replace(databaseType, "");
658+
}
659+
651660
public QueryResponse GetData(DatabaseConnection connection, string nodes, string nodeId, int? startRow, int? rowCount)
652661
{
653662
var data = new QueryResponse() { Status = "ok" };
@@ -671,7 +680,7 @@ public QueryResponse GetData(DatabaseConnection connection, string nodes, string
671680
for (int i = 0; i < reader.FieldCount; i++)
672681
{
673682
data.Columns.Add(reader.GetName(i));
674-
data.ColumnTypes.Add(reader.GetDataTypeName(i));
683+
data.ColumnTypes.Add(RemoveLengthSpecifier(reader.GetDataTypeName(i)));
675684
}
676685

677686
while (reader.Read())

Web/Scripts/tools.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ tools.IsTextType = function (theType) {
367367
case "CHARACTER VARYING":
368368
case "CHARACTER":
369369
case "TEXT":
370+
case "LONGTEXT":
370371
case "USER-DEFINED": // Treat any user defined columns as text
371372
return true;
372373
default:

docs/customizing.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ The [appsettings.json](/Web/appsettings.json) file contains a section titled “
1111
"ExtraCSS": "",
1212
"AllowAdvancedQuery": false,
1313
"DataStore": "Sqlite",
14+
"BaseUri": "",
1415
"AuthenticationMode": "Forms"
1516
}
1617
```
@@ -22,4 +23,5 @@ The following section details what each of the settings do:
2223
* *ExtraCSS*: points to a .css file that will be referenced by all the QueryTree pages, after it’s own CSS. This file does not necessarily need to be located inside QueryTree’s wwwroot folder. It could potentially be hosted at a different domain.
2324
* *AllowAdvancedQuery*: indicated whether users will be given the option to use the advanced query builder. See [here](/docs/advanced.md) for more information.
2425
* *DataStore*: Controls what kind of database QueryTree will store it's configuration data in. Valid options are 'MSSqlServer' or 'Sqlite'. The contents of the ConnectionString setting in the [appsettings.json](/Web/appsettings.json) should be set to an appropriate connection string for this database type.
26+
* *BaseUri*: If you want to run QueryTree from a subfolder on your webserver, e.g. http://my.app.com/reports/, the BaseUri setting should be used to tell QueryTree what location it is running from, e.g. "/reports".
2527
* *AuthenticationMode*: Valid options are "Forms" or "Windows". The default value is "Forms". "Forms" means that users will see "sign up", "sign in" and "sign out" pages. If "Windows" is enabled, those pages will be hidden and users will be automatically signed in using their Windows accounts. This option will only work for Windows clients, and when QueryTree is hosted using IIS, with "Windows Authentication" enabled and "Anonymous Authentication" disabled. See [https://docs.microsoft.com/en-us/iis/configuration/system.webserver/security/authentication/windowsauthentication/]() for more information on configuring IIS.

0 commit comments

Comments
 (0)