Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

1

mean of cr param

By
Zouhair
on 7/25/14, 8:38 AM 748 views

hi,

what mean the param cr in some or all orm osv functions

thanks in advance

3
shashank verma
On 7/25/14, 11:33 AM

Hello Zouhair,

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:

import psycopg2

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()

cur.close()

 

 

2
Clement Zotti
On 7/25/14, 11:02 AM

Hi, the cr parameters is a cursor to the database,

you can see the class here : https://github.com/odoo/odoo/blob/master/openerp/sql_db.py#L75.

As the class description says it's a wrapper around a psycopg cursor.

Your Answer

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

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 7/25/14, 8:38 AM
Seen: 748 times
Last updated: 3/16/15, 8:10 AM