I just installed a Gerrit server and wish to get rid of the
Need Verified +1 (Verified) permission.
Our team would only like to +2 changes instead of doing both things.
I tried following the steps at http://review.coreboot.org/Documentation/access-control.html#category_CVRW
DELETE FROM approval_categories WHERE category_id = 'VRIF';
DELETE FROM approval_category_values WHERE category_id = 'VRIF';
But I'm running a H2 database and I guess I'm just not sure exactly how to edit it without using Java.
You can use the gerrit gsql command to get interactive query support directly against the underlying SQL database: http://review.coreboot.org/Documentation/cmd-gsql.html
ssh -p 29418 review.example.com gerrit gsql
There you can issue the DELETE commands:
DELETE FROM approval_categories WHERE category_id = 'VRIF';
DELETE FROM approval_category_values WHERE category_id = 'VRIF';
Related
the TL;DR is that I am not able to delete a row previously created with an upsert using Java.
Basically I have a table like this:
CREATE TABLE transactions (
key text PRIMARY KEY,
created_at timestamp
);
Then I execute:
String sql = "update transactions set created_at = toTimestamp(now()) where key = 'test' if created_at = null";
session.execute(sql)
As expected the row is created:
cqlsh:thingleme> SELECT * FROM transactions ;
key | created_at
------+---------------------------------
test | 2018-01-30 16:35:16.663000+0000
But (this is what is making me crazy) if I execute:
sql = "delete from transactions where key = 'test'";
ResultSet resultSet = session.execute(sql);
Nothing happens. I mean: no exception is thrown and the row is still there!
Some other weird stuff:
if I replace the upsert with a plain insert, then the delete works
if I directly run the sql code (update and delete) by using cqlsh, it works
If I run this code against an EmbeddedCassandraService, it works (this is very bad, because my integration tests are just green!)
My environment:
cassandra: 3.11.1
datastax java driver: 3.4.0
docker image: cassandra:3.11.1
Any idea/suggestion on how to tackle this problem is really appreciated ;-)
I think the issue you are encountering might be explained by the mixing of lightweight transactions (LWTs) (update transactions set created_at = toTimestamp(now()) where key = 'test' if created_at = null) and non-LWTs (delete from transactions where key = 'test').
Cassandra uses timestamps to determine which mutations (deletes, updates) are the most recently applied. When using LWTs, the timestamp assignment is different then when not using LWTs:
Lightweight transactions will block other lightweight transactions from occurring, but will not stop normal read and write operations from occurring. Lightweight transactions use a timestamping mechanism different than for normal operations and mixing LWTs and normal operations can result in errors. If lightweight transactions are used to write to a row within a partition, only lightweight transactions for both read and write operations should be used.
Source: How do I accomplish lightweight transactions with linearizable consistency?
Further complicating things is that by default the java driver uses client timestamps, meaning the write timestamp is determined by the client rather than the coordinating cassandra node. However, when you use LWTs, the client timestamp is bypassed. In your case, unless you disable client timestamps, your non-LWT queries are using client timestamps, where your LWT queries are using a timestamp assigned by the paxos logic in cassandra. In any case, even if the driver wasn't assigning client timestamps this still might be a problem because the timestamp assignment logic is different on the C* side for LWT and non-LWT as well.
To fix this, you could alter your delete statement to include IF EXISTS, i.e.:
delete from transactions where key = 'test' if exists
Similar issue from the java driver mailing list
I am importing and exporting between two databases, and the problem when I want to add some tabels to the new it raises the error regarding the constrains.
I know how to turn this directly by using the mySQL:
SET FOREIGN_KEY_CHECKS=0
however, I want to use something like sission or query to send this command to the database.
I have tried something like this:
Query q = session2.createQuery("SET FOREIGN_KEY_CHECKS=0");
and this also didn't work.
To use embedded database I have created hsqldb database connected with java by this tutorial.
In general it is about creating simple table with 3 records through hsqldb manager and connect to this database with java.
Database was created and after exit the manager and connect again I gained my tables. They are recorded in test.script file.
If I try to connect with java by
connection = DriverManager.getConnection("jdbc:hsqldb:file:/db/test;ifexists=true", "SA", "");
then I got connection and can read all tables from it by
resultSet = statement.executeQuery("SELECT TABLE_NAME, COLUMN_NAME, TYPE_NAME, COLUMN_SIZE, DECIMAL_DIGITS, IS_NULLABLE FROM INFORMATION_SCHEMA.SYSTEM_COLUMNS WHERE TABLE_NAME NOT LIKE 'SYSTEM_%'");
But I can't get previous created table in manager even if script file contains that table.
This snippet of create table is placed in test.script file:
CREATE MEMORY TABLE PUBLIC.SALARYDETAILS(EMPID VARCHAR(6) PRIMARY KEY,SALARY INTEGER NOT NULL,BONUS INTEGER NOT NULL,INCREMENT INTEGER NOT NULL)
I was confused by MEMORY command, but maybe it is not what I should to fix. After remove it manager add it there again.
----- update 1 -----
SHUTDOWN command didn't help.
I don't know how HSQLDB store data, but thought that when they are in script file, it is done.
Exception what is see in the command line when running Java is
user lacks privilege or object not found
----- update 2 -----
I have created a table in Java and record data into it and I was available to get these data, but can't see it in the manager. It seems to me like different database, but location is same.
Script file doesn't contain new table and data. I don't know where data are stored.
It seems the database file was not saved. Before you exit the manager, execute this SQL command:
SHUTDOWN
I have created a sample program in which I want to get ddl of all objects like table, trigger etc using get_ddl method. When I tried following queries in oracle it worked.
SELECT DBMS_METADATA.GET_DDL('TABLE', TABLE_NAME) FROM USER_TABLES;
SELECT DBMS_METADATA.GET_DDL('TRIGGER', TRIGGER_NAME) FROM USER_TRIGGERS;
SELECT DBMS_METADATA.GET_DDL('VIEW', VIEW_NAME) FROM USER_VIEWS;
SELECT DBMS_METADATA.GET_DDL('FUNCTION', OBJECT_NAME) FROM USER_PROCEDURES WHERE OBJECT_TYPE = 'FUNCTION';
SELECT DBMS_METADATA.GET_DDL('PROCEDURE', OBJECT_NAME) FROM USER_PROCEDURES WHERE OBJECT_TYPE = 'PROCEDURE';
SELECT DBMS_METADATA.GET_DDL('INDEX', INDEX_NAME) FROM USER_INDEXES ;
But when I try to create same sample for sybase to get ddl or script of all objects it doesn't work.because get_ddl not supported in sybase database. Can anyone help me to know that whether sybase Iq 15 supports get_ddl methods or there are any other method/way or queries for creating ddl/script of all objects.
I want to post it on SAP forums but all sites are unavailable can anyone suggest me link for post my problem.
Thanks in Advance!!
The ddl for triggers, stored procedures, and views can be pulled from sys.syssource. Unfortunately IQ doesn't store ddl for other objects
For ase,
Use sybsystemprocs
Go
sp_helptext (object)
Go
For views, stored procedures, and triggers
I'm currently using Java to access a .sql file (called patient.sql). Running queries and updating the table works well while the program is running, but the changes aren't made on disk.
So, for example, I have a 30 node database with some fields including caseID (primary key) and Hospital. I want to change the Hospital of the node with caseID = Case29. To do this, I use the following code:
// Prepare a statement to update a record
String sql = "UPDATE patient SET Hospital='CX' WHERE caseID = 'Case29'";
// Execute the insert statement
stmt.executeUpdate(sql);
I have checked this and seen that it works (using a quick System.out.println()). However, when I finish the program and open the patient.sql, my change has not been registered. How can I save this change made?
Cheers
EDIT: I'm using HSQLDB
If you are using HSQLDB changes are stored in a .log file until SHUTDOWN is called.
After a SHUTDOWN, all changes are moved to a .script file.
One description of HSQLDB files here:
http://hsqldb.org/doc/guide/ch01.html
In your case I suspect no SHUTDOWN has been called.