Refactored persistence with mysql and sqlite to factorize more things with a CMS_STORAGE_SQL .. based only on sql statement execution.

Various changes
This commit is contained in:
2015-01-21 12:02:36 +01:00
parent 4dcc1b0e04
commit bba0364a2c
43 changed files with 1545 additions and 2350 deletions

View File

@@ -33,10 +33,65 @@ feature -- Access
connection_string: READABLE_STRING_32
-- Connection string
do
Result := "Driver={"+driver+"};" + database_string;
Result := "Driver={" + driver + "};" + database_string
end
item (a_param: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
local
s: READABLE_STRING_32
lower_s: READABLE_STRING_32
i,j: INTEGER
k: STRING_32
do
create k.make_from_string_general (a_param)
k.to_lower
s := database_string
lower_s := s.as_lower
i := lower_s.substring_index (k + {STRING_32} "=", 1)
if i > 0 then
if i = 1 or else s[i-1] = ';' then
j := s.index_of (';', i + k.count + 1)
if j = 0 then
j := s.count + 1
end
Result := s.substring (i + k.count + 1, j - 1)
end
end
end
server_name: detachable READABLE_STRING_32
do
Result := item ("Server")
end
port: INTEGER
do
if
attached item ("Port") as l_port and then
l_port.is_integer
then
Result := l_port.to_integer
end
end
database_name: detachable READABLE_STRING_32
do
Result := item ("Database")
end
user_id: detachable READABLE_STRING_32
do
Result := item ("Uid")
end
user_password: detachable READABLE_STRING_32
do
Result := item ("Pwd")
end
note
copyright: "2011-2014, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
copyright: "2011-2015, Javier Velilla, Jocelyn Fiat, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end