Cr means a "cursor" which is the concept of SQL. The role of cursor(cr in Odoo) is to enumerate/iterate over each rows in result set one by one.
Hence cursor act like a looping statement to fetch data row by row basis
Enough of theory now , lets take an simple example of sql:
conn = psycopg2.connect(database="mydb", user="postgres", password="postgres", host="127.0.0.1", port="5432")
cur = conn.cursor() #cursor object is created
cur.execute('''select name,date_order from sale.order''')
rows = cur.fetchall()
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 7/25/14, 8:38 AM|
|Seen: 728 times|
|Last updated: 3/16/15, 8:10 AM|