go to: HOME, PLUGINS or MESSAGES
CONSTANTS
The constants was created to identify the values and actions for some
options.
sql_save option
The parameters can be used to enable the Save SQL Command Process. This process write on local disks the SQL Command when you can use
for Debuging or Recover Database.
SQL_SIMPLE_CMD_OFF # Save Command is disabled (default)
SQL_SIMPLE_CMD_ON # Save Command is enabled for update
SQL_SIMPLE_CMD_ALL # Save Command is enabled for update/read
my $mymod = SQL::SimpleOps->new( sql_save => SQL_SIMPLE_CMD_OFF | SQL_SIMPLE_CMD_ON | SQL_SIMPLE_CMD_ALL, ... );
Default: "SQL_SIMPLE_CMD_OFF"
NOTE: You can override (temporary) this option on each SQL execution (valid for all commands).
SQL::SimpleOps->Select( sql_save => 1, ... ); # (if global disabled)
or
SQL::SimpleOps->Select( sql_save => 0, ... ); # (if global enabled)
message_log option
The parameters can be used to enable the Log Process. This process send the conditional message on "STDERR" and/or Syslog Service. The send messages does not abort the module.
We recommended using the Syslog Service for complexed applications.
SQL_SIMPLE_LOG_OFF # Log is disabled
SQL_SIMPLE_LOG_SYS # Log is enabled for syslog service
SQL_SIMPLE_LOG_STD # Log is enabled for STDERR (default)
SQL_SIMPLE_LOG_ALL # Log is enabled for STDERR/Syslog
my $mymod = SQL::SimpleOps->new
(
message_log => SQL_SIMPLE_LOG_OFF | SQL_SIMPLE_LOG_SYS |
SQL_SIMPLE_LOG_STD | SQL_SIMPLE_LOG_ALL,
...
);
The "SQL_SIMPLE_LOG_OFF" is recomended for high intensive transactional, like webservices. The "SQL_SIMPLE_LOG_SYS" is recomended for application services, like daemons. The "SQL_SIMPLE_LOG_STD" is recomended for iteractive Command Line Interfaces. However, you can do anything.
Default: "SQL_SIMPLE_LOG_STD"
NOTE: You can override (temporary) this option on each SQL execution (valid for all command).
SQL::SimpleOps->Select( message_log => 1, ... ); # (if global disabled)
or
SQL::SimpleOps->Select( message_log => 0, ... ); # (if global enabled)
cursor_command option
The parameters can be used to establish the operations on extract list.
SQL_SIMPLE_CURSOR_TOP # Cursor Command Top of List (ascending order)
SQL_SIMPLE_CURSOR_BACK # Cursor Command Backward (descending order)
SQL_SIMPLE_CURSOR_NEXT # Cursor Command Forward (ascending order)
SQL_SIMPLE_CURSOR_LAST # Cursor Command Bottom of List (descending order)
SQL_SIMPLE_CURSOR_RELOAD # Cursor Command Reload the Current Page (ascending order)
Default: no defaults
order_by option
The parameters can be used to determine the sort ordered on columns.
SQL_SIMPLE_ORDER_OFF # Order is disabled (for SelectCursor only)
SQL_SIMPLE_ORDER_ASC # Order is Ascending
SQL_SIMPLE_ORDER_DESC # Order is Descending
Default: "SQL_SIMPLE_ORDER_ASC"
NOTE: The value "SQL_SIMPLE_ORDER_OFF" is onle valid for the SelectCursor Command. This value disables the sorting process. The
command, by default, does the sorting using the "cursor_key" option.
Return Codes (all methods)
This values estabilish the termination code after the method has been done.
SQL_SIMPLE_RC_SYNTAX # Return Code Syntax Error
SQL_SIMPLE_RC_OK # Return Code Execution SQL Successful
SQL_SIMPLE_RC_ERROR # Return Code Execution SQL with errors
SQL_SIMPLE_RC_EMPTY # Return Code Execution SQL Successful with no Rows
NOTE: If you run queries with no results (no rows found), the termination code will be "SQL_SIMPLE_RC_EMPTY". However, you can use the "notfound" option to force this query to be "SQL_SIMPLE_RC_OK".
SQL::SimpleOps->Select( ..., where [ id => 'i not exists' ], notfound => 1, ... );
BEWARE: In this case, you must validade the Number of Rows ("getRows" method) or Number of Extracted Data in Buffer to verify whether exists data to be processed.
...
if (SQL::SimpleOps->Select( ..., notfound => 1, buffer => \@mybuffer, ... ))
{
## here your code to process sql condition error.
}
elsif (!SQL::SimpleOps->Rows() || !@mybyffer)
{
## here your code to process no data on query.
}
else
{
## here your code for process the data.
}
...
Command Alias Process
This values are used with "getAliasCols" to define how to translate the name to a real name, where the translation depends on the action
in question in the command, some parts of command the aliases is allowed and an others not.
SQL_SIMPLE_ALIAS_INSERT - used as: INSERT INTO ... (field) ...
SQL_SIMPLE_ALIAS_UPDATE - used as: UPDATE ... SET field = ...
SQL_SIMPLE_ALIAS_DELETE - not applied
SQL_SIMPLE_ALIAS_SELECT - used as: SELECT field .... FROM ....
SQL_SIMPLE_ALIAS_WHERE - used as: ... WHERE field ....
SQL_SIMPLE_ALIAS_ORDERBY - used as: ... ORDER BY field ...
SQL_SIMPLE_ALIAS_GROUPBY - used as: ... GROUP BY fild ...
ENDED