Arena
1.0
A content management system
|
This class extends ADatabase to allow connections to be made to MySQL databases. More...
Public Member Functions | |
def | __init__ |
Constructor. | |
def | init |
Initializer. | |
def | connect |
Connect to the data source. More... | |
def | disconnect |
Disconnect from the data source. | |
def | open |
Open the specified database. More... | |
def | count |
Count the number of records that would be returned by the specified fetch operation. More... | |
def | fetch |
Fetch data from the data source. More... | |
def | insert |
Insert data into the data source. More... | |
def | update |
Update data in the data source. More... | |
def | delete |
Delete data from the data source. More... | |
def | categories |
Retrieve a list of all tables in the data source. More... | |
def | handle |
Retrieve the handle assigned to the data source connection. More... | |
def | lastMessage |
Retrieve the last status message generated by the host. More... | |
def | queryString |
Retrieve the last query string generated by the host. More... | |
Public Member Functions inherited from Library.DataSource.Databases.ADatabase | |
def | init |
Initializer. | |
def | connect |
Connect to the database. More... | |
def | open |
Open the specified database. More... | |
def | lastMessage |
Return the last message generated by the database. More... | |
Public Member Functions inherited from Library.DataSource.DataSources.ADataSource | |
def | __init__ |
Construct a new data source. More... | |
def | init |
Initializer. | |
def | connect |
Connect to the data source. More... | |
def | disconnect |
Disconnect from the data source. More... | |
def | count |
Count the number of records that would be returned by the specified fetch operation. More... | |
def | fetch |
Fetch data from the data source. More... | |
def | insert |
Insert data into the data source. More... | |
def | update |
Update data in the data source. More... | |
def | delete |
Delete data from the data source. More... | |
def | categories |
Retrieve a list of all categories (or tables) in the data source. More... | |
Public Member Functions inherited from Library.Base.Events.ALoggingEventfulObject | |
def | __init__ |
Constructor. More... | |
def | init |
Initializer. | |
def | error |
Generate an error event. More... | |
def | log |
Log the specified item. More... | |
def | Log |
Retrieve the log used by the class. | |
Public Member Functions inherited from Library.Base.Events.AnEventfulObject | |
def | __init__ |
Constructor. More... | |
def | init |
Initializer. | |
def | __del__ |
Destructor. | |
def | parseParams |
Parse the specified parameters, looking for named events and setting event handlers as appropriate. More... | |
def | generate |
Generate the named event. | |
def | update |
Update the events generated by the object. | |
def | error |
Generate an error event. More... | |
def | toString |
Construct a string representation of the object. More... | |
def | on |
Set the handler for the specified event. More... | |
def | onMultiple |
Set handlers for multiple events. More... | |
def | handlerFor |
Retrieve the handler for the specified event. More... | |
def | generates |
Determine whether or not the object generates the named event. More... | |
def | __getitem__ |
Retrieve the value of the named property. | |
def | __setitem__ |
Set the value of the named property. | |
Public Member Functions inherited from Library.Base.Classwork.AnObject | |
def | init |
Initialize a new object instance. More... | |
def | __init__ |
Construct and initialize a new instance of AnObject. More... | |
def | __del__ |
Destroy the object instance. More... | |
def | displayName |
Construct a "pretty" display name for the class instance, based on the name of its class. More... | |
def | implements |
Determine whether the class instance is related to the specified class. More... | |
def | toString |
Return a string representation of the class, suitable for output to a console or text-based device. More... | |
def | __str__ |
Return a string representation of the class. More... | |
def | classname |
Return the name of the class from which the instance was created. More... | |
def | name |
Return the name of the class. More... | |
Public Member Functions inherited from Library.String.Utilities.IsPrintable | |
def | toString |
Return a string representation of the class conveniently. More... | |
def | __str__ |
Return a string representation of the class. More... | |
def | printTo |
Print a string representation of the class to the specified stream. More... | |
This class extends ADatabase to allow connections to be made to MySQL databases.
def Plugins.DataSource.MySQL.Databases.AMySQLDatabase.categories | ( | Self | ) |
Retrieve a list of all tables in the data source.
def Plugins.DataSource.MySQL.Databases.AMySQLDatabase.connect | ( | Self, | |
params | |||
) |
Connect to the data source.
This routine expects that params
will contain the following items:
host
– The host name or IP address of the MySQL database serveruser
– The username to use when connecting to the database serverIf either parameter is missing, the call will fail.
The following optional parameters may also be specified in params:
port
– The port on the server to which to connect. If this parameter is omitted, the default port (3306) is used.database
– The name of the database on the server to open after the connection is made. If this parameter is omitted, NO database is opened and only a basic connection is made.password
– The password to use when connecting. If this parameter is omitted, an empty password string is sent to the server. def Plugins.DataSource.MySQL.Databases.AMySQLDatabase.count | ( | Self, | |
categoryName, | |||
params | |||
) |
Count the number of records that would be returned by the specified fetch operation.
The parameters supplied to this function have the same meaning as those supplied to AMySQLDatabase.fetch()
This method generates the count
event.
def Plugins.DataSource.MySQL.Databases.AMySQLDatabase.delete | ( | Self, | |
categoryName, | |||
params | |||
) |
Delete data from the data source.
The categoryName
parameter is required; it specifies the category (or table) within the data source where the data to be deleted may be found.
Within params
, the following parameters are expected:
criteria
– A list() of criteria that is used to determine which record will be updated.The following optional parameters may also be specified in params:
immediate
– Whether or not the deletion is to take place immediately. If this parameter is False
, or if it is omitted, the MySQL database may defer deleting the data requested until a suitable time (for instance, until the number of transactions requested of it drop below a certain level). This will potentially improve the responsiveness of the database server, but may cause minor issues related to the fact that the data to be deleted will still exist in the database for a time.Other parameters may also be supplied within params
, but these will have meaning only to descendant classes or event handlers attached to this method.
def Plugins.DataSource.MySQL.Databases.AMySQLDatabase.fetch | ( | Self, | |
categoryName, | |||
params | |||
) |
Fetch data from the data source.
Note that only the categoryName
parameter is required: this is the name of the category (or table) within the data source that will be searched.
The params
passed to this method may include:
fieldNames
– A list() of which fields are to be returnedcriteria
– A list() of filter criteria to apply to the search; only those records that meet the criteria should be returnedsort
– A list() of fields and sort order indicators; the data returned should be sorted based on this criterialimit
– The maximum number of records to returnoffset
– How many records to skip before returning results.The following optional parameters may also be passed in params:
fullText
– Whether or not to perform a full-text search of the MySQL database. If this parameter is omitted, a standard search of the database is performed.This method should generate an error event if the data retrieval fails.
def Plugins.DataSource.MySQL.Databases.AMySQLDatabase.handle | ( | Self | ) |
Retrieve the handle assigned to the data source connection.
def Plugins.DataSource.MySQL.Databases.AMySQLDatabase.insert | ( | Self, | |
categoryName, | |||
params | |||
) |
Insert data into the data source.
The categoryName
parameter is required; it specifies the category (or table) within the data source where the new data is to be stored.
Within params
, the following parameters are expected:
fieldsValues
– A dictionary object that contains the names of fields and their associated values.Other parameters may also be supplied within params
, but these will have meaning only to descendant classes or event handlers attached to this method.
def Plugins.DataSource.MySQL.Databases.AMySQLDatabase.lastMessage | ( | Self | ) |
Retrieve the last status message generated by the host.
def Plugins.DataSource.MySQL.Databases.AMySQLDatabase.open | ( | Self, | |
databaseName, | |||
params | |||
) |
Open the specified database.
This method can be used when connected to a database provider to specify which database to use. For certain database providers, such as sqlite, this method may do nothing at all.
def Plugins.DataSource.MySQL.Databases.AMySQLDatabase.queryString | ( | Self | ) |
Retrieve the last query string generated by the host.
def Plugins.DataSource.MySQL.Databases.AMySQLDatabase.update | ( | Self, | |
categoryName, | |||
params | |||
) |
Update data in the data source.
The categoryName
parameter is required; it specifies the category (or table) within the data source where the data to update may be found.
Within params
, the following parameters are expected:
fieldsValues
– A dictionary object that contains the names of fields and their associated values.criteria
– A list() of criteria that is used to determine which record will be updated.Other parameters may also be supplied within params
, but these will have meaning only to descendant classes or event handlers attached to this method.