Files
ROC/library/persistence/implementation/mysql/src/cms_storage_mysql.e

103 lines
2.1 KiB
Plaintext

note
description: "Summary description for {CMS_STORAGE_MYSQL}."
date: "$Date$"
revision: "$Revision$"
class
CMS_STORAGE_MYSQL
inherit
CMS_STORAGE
CMS_USER_STORAGE_MYSQL
CMS_NODE_STORAGE_MYSQL
REFACTORING_HELPER
create
make
feature {NONE} -- Initialization
make (a_connection: DATABASE_CONNECTION)
--
require
is_connected: a_connection.is_connected
do
connection := a_connection
log.write_information (generator + ".make - is database connected? "+ a_connection.is_connected.out )
create {DATABASE_HANDLER_IMPL} db_handler.make (a_connection)
create error_handler.make
end
db_handler: DATABASE_HANDLER
connection: DATABASE_CONNECTION
-- Current database connection.
feature -- Query
sql_post_execution
-- Post database execution.
do
-- error_handler.add_synchronization (db_handler.database_error_handler)
if error_handler.has_error then
log.write_critical (generator + ".post_execution " + error_handler.as_string_representation)
end
end
sql_begin_transaction
do
connection.begin_transaction
end
sql_commit_transaction
do
connection.commit
end
sql_query (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY])
do
db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, Void))
db_handler.execute_query
end
sql_change (a_sql_statement: STRING; a_params: detachable STRING_TABLE [detachable ANY])
do
db_handler.set_query (create {DATABASE_QUERY}.data_reader (a_sql_statement, Void))
db_handler.execute_change
end
sql_rows_count: INTEGER
-- Number of rows for last sql execution.
do
Result := db_handler.count
end
sql_after: BOOLEAN
-- Are there no more items to iterate over?
do
Result := db_handler.after
end
sql_forth
-- Fetch next row from last sql execution, if any.
do
db_handler.forth
end
sql_item (a_index: INTEGER): detachable ANY
do
if attached {DB_TUPLE} db_handler.item as l_item and then l_item.count >= a_index then
Result := l_item.item (a_index)
else
check has_item_at_index: False end
end
end
end