如何支持对SqlServer的".."的支持在HyperSQL中? [英] How to support support SqlServer's ".." in HyperSQL?

查看:66
本文介绍了如何支持对SqlServer的".."的支持在HyperSQL中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

tl; dr:我正在尝试对一些说明数据库名称的SqlServer查询进行单元测试,但它们似乎在HyperSql中不起作用.

tl;dr: I am trying to unit test some SqlServer queries which state the db name but they do not seem to work in HyperSql.

我们正在生产中使用Sql Server,并且我试图将HyperSQL用作单元测试的数据库.我正在尝试测试创建SQL查询的类,因此对数据库进行存根处理不是一种选择,因为由真实数据库解析查询是该测试的一部分.

We are using Sql Server in production and I am trying to use HyperSQL as my database for unit testing. I am trying to test a class that creates SQL queries so stubbing out the database is not an option as having the queries parsed by a real database is part of the test.

应该以SELECT * FROM EntAsdfDb007..Data_Table的形式创建查询,尽管我们可以根据需要使用模式名称('db').

Queries are supposed to be created in the form of SELECT * FROM EntAsdfDb007..Data_Table, although we can use the schema name ( 'db' ) if we wish.

根据我对SqlServer的SELECT格式的了解,它允许您指定数据库名称,然后指定架构名称.另外,您可以删除数据库的名称并进行推断.

From what I understand about the SELECT format for SqlServer, it allows you to specify the name of database followed by the name of schema. Also, you can drop the name of the database and have it inferred.

在HyperSqlDb中,我已经能够创建模式'​​db'并在其中创建必要的表,并且能够在该模式中创建表,但是即使设置了使用.setDatabaseName()的数据库名称.我得到的例外是:

In HyperSqlDb I have been able to create the schema 'db' and create the necessary tables within it, and have been able to create tables within that schema but I have not be able to query with the database name even after setting the DB name using .setDatabaseName(). The exception I get is:

Caused by: org.hsqldb.HsqlException: user lacks privilege or object not found: ENTASDFDB007

只需说明:我正在对使用像SELECT * FROM EntAsdfDb007..Data_Table这样的SQL的类进行单元测试.我正在尝试为单元测试设置HyperSql实例,但是HyperSql似乎拒绝使用所使用的语法.

Just to be clear: I am unit-testing a class that uses SQL like SELECT * FROM EntAsdfDb007..Data_Table. I am trying to set up an instance of HyperSql for unit testing purposes but HyperSql seems to reject the syntax used.

推荐答案

那是不可能的.

HyperSQL不能更改为接受非标准的命名方案.

HyperSQL cannot be changed to accept non-standard naming schemes.

这篇关于如何支持对SqlServer的".."的支持在HyperSQL中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆