Changeset 638 for trunk/docs


Ignore:
Timestamp:
Nov 26, 2015, 3:03:45 PM (4 years ago)
Author:
cito
Message:

Update the documentation

Location:
trunk/docs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/changelog.txt

    r636 r638  
    77- Greatly improve unit testing.
    88- Force build to compile with no errors.
    9 - Fix decimal point handling
    10 - Add option to return money as string
     9- Fix decimal point handling.
     10- Add option to return boolean values as bool objects.
     11- Add option to return money values as string.
    1112- Fix notification handler (Thanks Patrick TJ McPhee).
    1213
  • trunk/docs/classic.txt

    r637 r638  
    369369  file('garfield.gif', 'wb').write(picture)
    370370
     371get_decimal
     372-----------
     373get the decimal type to be used for numeric values
     374
     375Syntax::
     376
     377  get_decimal()
     378
     379Parameters:
     380  None
     381
     382Return type:
     383  :cls: the Python class used for PostgreSQL numeric values
     384
     385Description:
     386  This function returns the Python class that is used by PyGreSQL to hold
     387  PostgreSQL numeric values. The default class is decimal.Decimal if
     388  available, otherwise the float type is used.
     389
    371390set_decimal
    372391-----------
     
    384403  used by PyGreSQL to hold PostgreSQL numeric values. The default class
    385404  is decimal.Decimal if available, otherwise the float type is used.
    386  
     405
     406get_decimal_point
     407-----------------
     408get the decimal mark used for monetary values
     409
     410Syntax::
     411
     412  get_decimal_point()
     413
     414Parameters:
     415  None
     416
     417Return type:
     418  :str: string with one character representing the decimal mark
     419
     420Description:
     421  This function returns the decimal mark used by PyGreSQL to interpret
     422  PostgreSQL monetary values when converting them to decimal numbers.
     423  The default setting is '.' as a decimal point. This setting is not
     424  adapted automatically to the locale used by PostGreSQL, but you can
     425  use `set_decimal()` to set a different decimal mark manually. A return
     426  value of `None` means monetary values are not interpreted as decimal
     427  numbers, but returned as strings including the formatting and currency.
     428
     429set_decimal_point
     430-----------------
     431specify which decimal mark is used for interpreting monetary values
     432
     433Syntax::
     434
     435  set_decimal_point(str)
     436
     437Parameters:
     438  :str: string with one character representing the decimal mark
     439
     440Description:
     441  This function can be used to specify the decimal mark used by PyGreSQL
     442  to interpret PostgreSQL monetary values. The default value is '.' as
     443  a decimal point. This value is not adapted automatically to the locale
     444  used by PostGreSQL, so if you are dealing with a database set to a
     445  locale that uses a ',' instead of '.' as the decimal point, then you
     446  need to call `set_decimal(',')` to have PyGreSQL interpret monetary
     447  values correctly. If you don't want money values to be converted to
     448  decimal numbers, then you can call `set_decimal(None)`, which will
     449  cause PyGreSQL to return monetary values as strings including their
     450  formatting and currency.
     451
     452get_bool
     453--------
     454check whether boolean values are returned as bool objects
     455
     456Syntax::
     457
     458  get_bool()
     459
     460Parameters:
     461  None
     462
     463Return type:
     464  :bool: whether or not bool objects will be returned
     465
     466Description:
     467  This function checks whether PyGreSQL returns PostgreSQL boolean
     468  values converted to Python bool objects, or as 'f' and 't' strings
     469  which are the values used internally by PostgreSQL. By default,
     470  conversion to bool objects is not activated, but you can enable
     471  this with the `set_bool()` method.
     472
     473set_bool
     474--------
     475set whether boolean values are returned as bool objects
     476
     477Syntax::
     478
     479  set_bool(bool)
     480
     481Parameters:
     482  :bool: whether or not bool objects shall be returned
     483
     484Description:
     485  This function can be used to specify whether PyGreSQL shall return
     486  PostgreSQL boolean values converted to Python bool objects, or as
     487  'f' and 't' strings which are the values used internally by PostgreSQL.
     488  By default, conversion to bool objects is not activated, but you can
     489  enable this by calling `set_bool(True)`.
     490
     491get_namedresult
     492---------------
     493set a function that will convert to named tuples
     494
     495Syntax::
     496
     497  set_namedresult()
     498
     499Parameters:
     500  None
     501
     502Description:
     503  This function returns the function used by PyGreSQL to construct the
     504  result of the `query.namedresult()` method.
     505
    387506set_namedresult
    388507---------------
     
    397516
    398517Description:
    399   You can use this if you want to create different kinds of named tuples.
     518  You can use this if you want to create different kinds of named tuples
     519  returned by the `query.namedresult()` method.
    400520 
    401521
Note: See TracChangeset for help on using the changeset viewer.