I'm trying to use two UPDATE queries on my database:
UPDATE equipment
SET equip_level = 'Hero'
WHERE equip = ('Amulet of Immortality');
UPDATE equipment
SET equip_level = 'Master'
WHERE equip = ('Shield of Pitch Black', 'Blade of MageBane', 'Leggings of Spikes', 'Gloves of Quickling skin', 'Helm of the Fire King', 'Scythe of Death');
The first one works just fine but the second one (with multiple entries) gives me the following error:
[11:37:16] Error while executing SQL query on database 'test': row value misused
The tutorial that I'm looking at (https://digitalfellows.commons.gc.cuny.edu/2016/04/08/fun-times-with-sqlite-or-a-beginners-tutorial-to-data-management-and-databases-with-sql/) uses the following format for the second query:
UPDATE equipment
SET equip_level = 'Master'
WHERE equip = IN ('Shield of Pitch Black', 'Blade of MageBane', 'Leggings of Spikes', 'Gloves of Quickling skin', 'Helm of the Fire King', 'Scythe of Death')
But that gives me a syntax error:
[11:49:48] Error while executing SQL query on database 'test': near "IN": syntax error
How can I correct this?
remove the equals sign:
UPDATE equipment
SET equip_level = 'Master'
WHERE equip IN ('Shield of Pitch Black', 'Blade of MageBane', 'Leggings of Spikes', 'Gloves of Quickling skin', 'Helm of the Fire King', 'Scythe of Death')
Related
Using :
-IronPython
-AutoDesk
-Revit (PyRevit)
-Revit API
-SQLite3
My code is as follows:
try:
conn = sqlite3.connect('SQLite_Python.db')
c = conn.cursor()
print("connected")
Insert_Volume = """INSERT INTO Column_Coordinates
(x, y, z)
VALUES
(1, 2, 3)"""
count = c.execute(Insert_Volume)
conn.commit()
print("Volume values inserted", c.rowcount)
c.close()
except sqlite3.Error as error:
print("Failed to insert data into sqlite table", error)
finally:
if (conn):
conn.close()
print("The SQLite connection is closed")'''
This code used to work within PyRevit, but now does not, with the following error:
Exception : System.IO.IOException: Could not add reference to assembly IronPython.SQLite
Please advise, this is one of the early steps of a large project and therefore is delaying my work quite a bit.
I look forward to your reply.
i got 2 nodes fetching some mqtt data, some temperature and humidity readings. Im trying to pass that info to a sqlite node. On that node i have the following code:
var newMsg = {
"topic": "INSERT INTO ambiente VALUES (null, #thisshouldbetemperature, #thisshouldbehumidity, date('now'), time('now') )"
}
return newMsg;
I try to use a join node but didnt make the work. So, what is the correct way to pass both msg.payload to that function? Thanks!
The join node is the correct way to combine the 2 incoming messages. You should use the manual mode and configure it to create a key value object something like this.
The problem is that your function node is ignoring the incoming data and creating a new message with just a topic set.
The fix for the function node is:
msg.topic = "INSERT INTO ambiente VALUES (null, " + msg.payload.temperature + ", " + msg.payload.humidity + " , date('now'), time('now') )";
return msg;
This will just update the msg.topic and leave the incoming msg.payload intact. This assumes that the MQTT messages arrive on topics temperature and humidity.
I am processing 1k record however I get system violation error after 800 record. Could someone please suggest how can this error be resolved?
There are designated methods for using OQL, you should take care to
Use a cursor variable
Declare a size that makes sense for your query
Open the cursor (allocates memory)
Close the cursor (disposes memory)
procedure ShowMoviesInCategory(theCategory : tCategory)
var Curs : aOQLCursor
var curMovie : aMovie
Curs = Motor.OpenOQLCursor
Curs.BatchSize = 50
OQL select * from x in aMovie++ where x.Category = theCategory using Curs
forEach curMovie in Curs
WriteLn(curMovie)
endFor
Motor.CloseOQLCursor(Curs)
endProc
Please also refer to the eWAM Help under OQL and
wTECH 101 (week1 - day 5 "101A - OQL - Search.pptx"
In Wynsure there is a designated variable for this, please refer to the Wynsure Development Rules.docx
I have an sql command that depends on the results of other sql commands. There are five sql commands in this chain, but the problem occurs in the 4th.
The 5th command must save data to the archive table. When it has to run and take the completion_date value from the 4th command, it throws a null reference exception. Actually it says, that Reader4[0] can't be read because it has null value. That's wrong because it has value, because in the database these queries work fine and also because the condition if (Reader4.HasRows == true) is true, it means that WHERE statement is true in the 4th command, which also includes checking the completion_date! What's wrong with this asp.net?
Command4 = new SqlCommand("SELECT trade_date FROM Schedule WHERE traider_id=#traiderID AND good_id=#goodID AND position_id=#positionID AND status_id=1 AND completion_date IS NOT NULL", Connection4); //note the completion_date check
Command4.Parameters.Add("#traiderID", Convert.ToInt32(Reader3[0]));
Command4.Parameters.Add("#positionID", CurrentPosition);
Command4.Parameters.Add("#goodID", Convert.ToInt32(Reader1[0]));
Reader4 = Command4.ExecuteReader();
if (Reader4.HasRows == true) //this check is done successfully
{
Command5 = new SqlCommand("INSERT INTO Archive (traider_id, good_id, completion_date) VALUES (#traiderID, #goodID, #completionDate)", Connection5);
Command5.Parameters.Add("#traiderID", Convert.ToInt32(Reader3[0]));
Command5.Parameters.Add("#goodID", Convert.ToInt32(Reader1[0]));
Command5.Parameters.Add("#completionDate", Convert.ToDateTime(Reader4[0])); //Here is the problem
Command5.ExecuteNonQuery();
}
Reader4.Close();
Where are you startin to read from the reader?
i.e. where do you call
Reader4.Read();
after
Reader4 = Command4.ExecuteReader();
I want to get the count of status(Pass/Fail) of all testcases present in QC by checking the execution grid.
What is the method to retrieve the status and execution date of a test case ?
Currently I am only able to get the test case name.
Code:
Set treeMgr = gTDConn.TestSetTreeManager
Set tstTree = treeMgr.NodeByPath(TestSetPath)
Set tstFactory = tstTree.testSetFactory
Set tsetList = tstFactory.NewList("")
For Each tset In tsetList
msgbox tset.Name
next