MCPcopy
hub / github.com/django/django / get_connection_params

Method get_connection_params

django/db/backends/mysql/base.py:214–251  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

212 return self.mysql_version
213
214 def get_connection_params(self):
215 kwargs = {
216 "conv": django_conversions,
217 "charset": "utf8mb4",
218 }
219 settings_dict = self.settings_dict
220 if settings_dict["USER"]:
221 kwargs["user"] = settings_dict["USER"]
222 if settings_dict["NAME"]:
223 kwargs["database"] = settings_dict["NAME"]
224 if settings_dict["PASSWORD"]:
225 kwargs["password"] = settings_dict["PASSWORD"]
226 if settings_dict["HOST"].startswith("/"):
227 kwargs["unix_socket"] = settings_dict["HOST"]
228 elif settings_dict["HOST"]:
229 kwargs["host"] = settings_dict["HOST"]
230 if settings_dict["PORT"]:
231 kwargs["port"] = int(settings_dict["PORT"])
232 # We need the number of potentially affected rows after an
233 # "UPDATE", not the number of changed rows.
234 kwargs["client_flag"] = CLIENT.FOUND_ROWS
235 # Validate the transaction isolation level, if specified.
236 options = settings_dict["OPTIONS"].copy()
237 isolation_level = options.pop("isolation_level", "read committed")
238 if isolation_level:
239 isolation_level = isolation_level.lower()
240 if isolation_level not in self.isolation_levels:
241 raise ImproperlyConfigured(
242 "Invalid transaction isolation level '%s' specified.\n"
243 "Use one of %s, or None."
244 % (
245 isolation_level,
246 ", ".join("'%s'" % s for s in sorted(self.isolation_levels)),
247 )
248 )
249 self.isolation_level = isolation_level
250 kwargs.update(options)
251 return kwargs
252
253 @async_unsafe
254 def get_new_connection(self, conn_params):

Callers 4

test_service_nameMethod · 0.45

Calls 5

copyMethod · 0.45
popMethod · 0.45
joinMethod · 0.45
updateMethod · 0.45

Tested by 4

test_service_nameMethod · 0.36