Closed
Description
the example of custom fonction (py_sin) doesn't work.
but this manual program works:
import sqlite3
def _customFun(fstring, dept):
result = 'Welcome ' + fstring + ' your dept is ' + dept
return result
connection = sqlite3.connect(":memory:")
cursor = connection.cursor()
connection.create_function("ROHACK", 2, _customFun)
sql="CREATE TABLE student (First_Name, Department, Student_ID);"
cursor.execute(sql)
sql='INSERT INTO student values("Toto","LLM class", 1)'
cursor.execute(sql)
sqlQuery = "select ROHACK(First_Name,Department) from student where Student_ID = 1"
cursor.execute(sqlQuery)
print(*cursor.fetchone())
cursor.close()
connection.close()
Metadata
Metadata
Assignees
Labels
No labels