Die nachfolgenden Inhalte sind nur in englischer Sprache verfügbar.
The sql module provides helper functions for working with the database directly.
Functions
|
Function |
Parameters |
Return Value |
Description |
|---|---|---|---|
|
convert_date_to_planta_time |
date: String containing a date
date format string |
The date converted to amount of days since 01.01.1970 |
Converts a readable date into the format used by PLANTA date fields |
|
convert_planta_time_to_date |
planta_time: Days since 01.01.1970
date format string |
A readable date as defined by the format |
Converts the PLANTA internal date format to a readable string |
|
get_sql_date_format |
planta_time: Days since 01.01.1970 |
Returns a string to be used in an sql statement |
Converts the days since 01.01.1970 to a proper date string and then adds the dbms related code to make it valid sql |
|
sanitize_value |
value: A value you want to insert into a SQL statement |
A sanitized version of the value |
Sanitizes a string that will later be formatted into an sql statement. Useful for preventing SQL injections or putting |
Examples
Converting a planta time to a date string
from ppms.sql import convert_planta_time_to_date
from ppms.constants import SYS_VAR_TODAY
today = ppms.uvar_get(SYS_VAR_TODAY)
today_as_date_string = convert_planta_time_to_date(planta_time=today)
ppms.ui_message_box('Today is {}'.format(today_as_date_string))