Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
293 views
in Technique[技术] by (71.8m points)

python - Robot framework, DatabaseLibrary insert into PASS but no new entry

step 1: created a mysql database on db4free.net

step 2: tested select from query's, worked.

step 3: test insert into query... PASS, but no new entry

TC check database
 DatabaseLibrary.Connect To Database  dbapiModuleName=MySQLdb  dbName=Specimen  dbUsername=adminSpecimen  dbPassword=P@ssword1  dbHost=db4free.net  dbPort=3306  dbCharset=utf8mb4  dbConfigFile=db.cfg
    ${test}=  DatabaseLibrary.Query    INSERT INTO Devices (DeviceID, StatusDevice, TimeSet, Location, Latitude, Longitude, Altitude) VALUES (3, 1, '2019-1-1', 'Soest', 1, 2, 3);
 Log to Console  ${test}  console=yes

It passes, gives no errors, but there is no new entry... How can I figure out what went wrong? nothing in the logging. :(

logging is:

KEYWORD ${test} = DatabaseLibrary . Query INSERT INTO Devices (DeviceID, StatusDevice, TimeSet, Location, Latitude, Longitude, Altitude) VALUES (4, 1, '2020-2-2', 'Amstelveen', 1, 2, 3); 

    Start / End / Elapsed:
    20210112 11:23:26.881 / 20210112 11:23:27.056 / 00:00:00.175 
    
    11:23:26.882 INFO Executing : Query  |  INSERT INTO Devices (DeviceID, StatusDevice, TimeSet, Location, Latitude, Longitude, Altitude) VALUES (4, 1, '2020-2-2', 'Amstelveen', 1, 2, 3);  
     
    
    11:23:27.055 INFO ${test} = () 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

solution:

mind that you are using Execute Sql String instead of Query

${test}= DatabaseLibrary.Execute Sql String

(! query in combination with insert into should not PASS (to my opinion) but that's a whole different topic !)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...