我有一个简单的问题。我想列出我们可以使用关键字星号(或星号)* 的所有场景。
我只知道这些场景:
Select * from Customers;
Select Count(*) from Customers;
Select Customers.quantity * Customers.price from Customers;
Run Code Online (Sandbox Code Playgroud)
我在互联网上搜索了所有内容,但没有找到任何其他用例。
此外,我们可以在选择查询中将 * 与列一起使用的场景。
编辑:好的,因为@Lucas Eder 要求知道我的用例,这里是。我有一个接受 SQL 查询并将其存储在数据库中的程序。在存储之前,它会验证不允许创建select *和Count(*)查询。除此之外,它应该允许所有其他查询。所以这就是我想知道其他使用场景的原因,*以便我可以将它们列入白名单。
当我调用函数时出现以下错误mongoTemplate.collectionExists
com.mongodb.MongoCommandException: Command failed with error 2: 'Cannot open a new cursor since too many cursors are already opened' on server documentdb-cluster-dev-2.cipll54l4b4g.eu-central-1.docdb.amazonaws.com:27017. The full response is
{
"ok": 0,
"errmsg": "Cannot open a new cursor since too many cursors are already opened",
"code": 2
}
at org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java:131)
at org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:2589)
at org.springframework.data.mongodb.core.MongoTemplate.execute(MongoTemplate.java:499)
at org.springframework.data.mongodb.core.MongoTemplate.collectionExists(MongoTemplate.java:600)
at sun.reflect.GeneratedMethodAccessor217.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:223)
at org.springframework.cloud.context.scope.GenericScope$LockedScopedProxyFactoryBean.invoke(GenericScope.java:494)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:185)
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)
at org.springframework.data.mongodb.core.MongoTemplate$$EnhancerBySpringCGLIB$$ba89d337.collectionExists(<generated>)
Run Code Online (Sandbox Code Playgroud)
我使用spring框架的MongoTemplate和AWS的DocumentDB作为mongodb(spring-boot-starter-data-mongodb:2.0.10.RELEASE)
有什么办法可以增加光标的限制吗?我看到 ORACLE 有一种方法可以增加打开游标的限制,但没有找到 mongo/documentDb 的任何内容。
我有一个简单的用例:
我想插入一个不存在的实体。
这是实体类,它组合了唯一的列:
@Entity
@Table(uniqueConstraints = {
@UniqueConstraint(columnNames = {
"firstName", "lastName"
})
})
public class Customer {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String firstName;
private String lastName;
Run Code Online (Sandbox Code Playgroud)
这是简单的插入逻辑:
Optional<Customer> customer = customerRepository.findByFirstNameAndLastName("John", "Doe");
if (!customer.isPresent()) {
customerRepository.save(new Customer("John", "Doe"));
}
Run Code Online (Sandbox Code Playgroud)
当我通过并发线程调用它时,我得到了这个ConstraintViolationException,这很明显
insert into customer (first_name, last_name, id) values (?, ?, ?) [23505-200]]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute statement] with root cause
org.h2.jdbc.JdbcSQLIntegrityConstraintViolationException: Unique index or primary key violation: "PUBLIC.UKKIYY7M3FWM4VO5NIL9IBP5846_INDEX_5 ON PUBLIC.CUSTOMER(FIRST_NAME, LAST_NAME) …Run Code Online (Sandbox Code Playgroud) 当我运行时出现vagrant up此错误
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["startvm", "3ae7b70c-8ea1-417a-ab67-99aef96624f8", "--type", "headless"]
Stderr: VBoxManage.exe: error: Failed to open/create the internal network 'HostInterfaceNetworking-VirtualBox Host-Only Ethernet Adapter #2' (VERR_INTNET_FLT_IF_NOT_FOUND).
VBoxManage.exe: error: Failed to attach the network LUN (VERR_INTNET_FLT_IF_NOT_FOUND)
VBoxManage.exe: error: Details: code E_FAIL (0x80004005), component ConsoleWrap, interface IConsole
Run Code Online (Sandbox Code Playgroud)
我在这里找到了解决方案:https : //www.howtoforge.com/setup-a-local-wordpress-development-environment-with-vagrant/这是更新驱动程序VirtualBox Host-Only Ethernet Adapter
但问题是我远程连接到机器。所以我担心网络设置可能会丢失我的远程连接。另外,我无法重新启动机器。
按照上面链接中提到的不应该断开连接的步骤进行操作是否安全?如果没有,有什么替代方法吗?
我想动态呈现vue-bootstrap的模式,而不是通过编写任何html代码。我提到了文档-https: //bootstrap-vue.js.org/docs/components/modal/#modal-message-boxes并将其应用于我的vue项目中,但是当我尝试调用时,它给了我一个错误bvModal.msgBoxOk('sad')-
vue.runtime.esm.js?ff9b:587 [Vue warn]: Property or method "$bvModal" is
not defined on the instance but referenced during render. Make sure that
this property is reactive, either in the data option, or for class-based
components, by initializing the property. See:
https://vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties
Run Code Online (Sandbox Code Playgroud)
我试图在的jsfiddle和工作,但它不是我的项目工作- https://jsfiddle.net/yrb4tcfm/11/
这是我的main.js
import 'babel-polyfill'
import Vue from 'vue'
import App from './App'
import router from './router'
import BootstrapVue from 'bootstrap-vue'
import store from './store/store'
import 'bootstrap/dist/css/bootstrap.css'
import 'bootstrap-vue/dist/bootstrap-vue.css'
import Modal from 'bootstrap-vue/es/components/modal'
Vue.use(BootstrapVue)
Vue.use(Modal)
new Vue({
el: …Run Code Online (Sandbox Code Playgroud) bootstrap-4 ×1
hibernate ×1
java ×1
jpa ×1
mongodb ×1
spring ×1
sql ×1
vagrant ×1
virtualbox ×1
vue.js ×1
windows-10 ×1