MCPcopy
hub / github.com/django/django / BoundVar

Class BoundVar

django/db/backends/oracle/utils.py:7–41  ·  view source on GitHub ↗

A late-binding cursor variable that can be passed to Cursor.execute as a parameter, in order to receive the id of the row created by an insert statement.

Source from the content-addressed store, hash-verified

5
6
7class BoundVar:
8 """
9 A late-binding cursor variable that can be passed to Cursor.execute
10 as a parameter, in order to receive the id of the row created by an
11 insert statement.
12 """
13
14 types = {
15 "AutoField": int,
16 "BigAutoField": int,
17 "SmallAutoField": int,
18 "IntegerField": int,
19 "BigIntegerField": int,
20 "SmallIntegerField": int,
21 "PositiveBigIntegerField": int,
22 "PositiveSmallIntegerField": int,
23 "PositiveIntegerField": int,
24 "BooleanField": int,
25 "FloatField": Database.DB_TYPE_BINARY_DOUBLE,
26 "DateTimeField": Database.DB_TYPE_TIMESTAMP,
27 "DateField": datetime.date,
28 "DecimalField": decimal.Decimal,
29 }
30
31 def __init__(self, field):
32 internal_type = getattr(field, "target_field", field).get_internal_type()
33 self.db_type = self.types.get(internal_type, str)
34 self.bound_param = None
35
36 def bind_parameter(self, cursor):
37 self.bound_param = cursor.cursor.var(self.db_type)
38 return self.bound_param
39
40 def get_value(self):
41 return self.bound_param.getvalue()
42
43
44class Oracle_datetime(datetime.datetime):

Callers 1

returning_columnsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected