*dbname*
true
false
utf8
*dbprefix*appconfig
appid
text
true
32
configkey
text
true
64
configvalue
clob
false
appconfig_appid_key_index
true
true
appid
ascending
configkey
ascending
appconfig_config_key_index
configkey
ascending
appconfig_appid_key
appid
ascending
*dbprefix*storages
id
text
false
64
numeric_id
integer
0
true
1
4
available
integer
1
true
last_checked
integer
storages_id_index
true
id
ascending
*dbprefix*mounts
id
integer
0
true
1
4
storage_id
integer
true
root_id
integer
true
user_id
text
true
64
mount_point
text
true
4000
mount_id
integer
mounts_user_index
false
user_id
ascending
mounts_storage_index
false
storage_id
ascending
mounts_root_index
false
root_id
ascending
mounts_mount_id_index
false
mount_id
ascending
mounts_user_root_index
true
user_id
ascending
root_id
ascending
*dbprefix*mimetypes
id
integer
0
true
1
4
mimetype
text
true
255
mimetype_id_index
true
mimetype
ascending
*dbprefix*filecache
fileid
integer
0
true
1
4
storage
integer
true
4
path
text
false
4000
path_hash
text
true
32
parent
integer
true
4
name
text
false
250
mimetype
integer
true
4
mimepart
integer
true
4
size
integer
true
8
mtime
integer
true
4
storage_mtime
integer
true
4
encrypted
integer
0
true
4
unencrypted_size
integer
0
true
8
etag
text
false
40
permissions
integer
0
false
4
checksum
text
false
255
fs_storage_path_hash
true
storage
ascending
path_hash
ascending
fs_parent_name_hash
parent
ascending
name
ascending
fs_storage_mimetype
storage
ascending
mimetype
ascending
fs_storage_mimepart
storage
ascending
mimepart
ascending
fs_storage_size
storage
ascending
size
ascending
fileid
*dbprefix*group_user
gid
text
true
64
uid
text
true
64
gu_gid_uid_index
true
true
gid
ascending
uid
ascending
gu_uid_index
uid
ascending
*dbprefix*group_admin
gid
text
true
64
uid
text
true
64
group_admin_uid
uid
ascending
ga_gid_uid_index
true
true
gid
ascending
uid
ascending
*dbprefix*groups
gid
text
true
64
groups_pKey
true
gid
ascending
*dbprefix*preferences
userid
text
true
64
appid
text
true
32
configkey
text
true
64
configvalue
clob
false
pref_userid_appid_key_index
true
true
userid
ascending
appid
ascending
configkey
ascending
*dbprefix*properties
id
1
integer
0
true
4
userid
text
true
64
propertypath
text
true
255
propertyname
text
true
255
propertyvalue
clob
true
property_index
userid
ascending
*dbprefix*share
id
1
integer
0
true
4
share_type
integer
0
true
1
share_with
text
false
255
password
text
false
255
uid_owner
text
true
64
uid_initiator
text
false
64
parent
integer
false
4
item_type
text
true
64
item_source
text
false
255
item_target
text
false
255
file_source
integer
false
4
file_target
text
false
512
permissions
integer
0
true
1
stime
integer
0
true
8
accepted
integer
0
true
1
expiration
timestamp
false
token
text
false
32
mail_send
integer
0
true
1
share_name
text
false
64
item_share_type_index
item_type
ascending
share_type
ascending
file_source_index
file_source
ascending
token_index
token
ascending
*dbprefix*jobs
id
integer
0
true
1
true
4
class
text
true
255
argument
text
true
4000
last_run
integer
false
last_checked
integer
false
reserved_at
integer
false
execution_duration
integer
true
job_class_index
class
ascending
*dbprefix*users
uid
text
true
64
displayname
text
64
password
text
true
255
users_pKey
true
uid
ascending
*dbprefix*authtoken
id
integer
0
true
1
true
4
uid
text
true
64
login_name
text
true
64
password
clob
false
name
clob
true
token
text
true
200
type
integer
0
true
true
2
remember
integer
0
true
true
1
last_activity
integer
0
true
true
4
last_check
integer
0
true
true
4
scope
clob
false
authtoken_token_index
true
token
ascending
authtoken_last_activity_index
last_activity
ascending
*dbprefix*bruteforce_attempts
id
integer
0
true
1
true
4
action
text
true
64
occurred
integer
0
true
true
4
ip
text
true
255
subnet
text
true
255
metadata
text
true
255
bruteforce_attempts_ip
ip
ascending
bruteforce_attempts_subnet
subnet
ascending
*dbprefix*vcategory
id
integer
0
true
1
true
4
uid
text
true
64
type
text
true
64
category
text
true
255
uid_index
uid
ascending
type_index
type
ascending
category_index
category
ascending
*dbprefix*vcategory_to_object
objid
integer
0
true
true
4
categoryid
integer
0
true
true
4
type
text
true
64
true
true
category_object_index
categoryid
ascending
objid
ascending
type
ascending
vcategory_objectd_index
objid
ascending
type
ascending
*dbprefix*systemtag
id
integer
0
true
1
true
4
name
text
true
64
visibility
integer
1
true
1
editable
integer
1
true
1
tag_ident
true
name
ascending
visibility
ascending
editable
ascending
*dbprefix*systemtag_object_mapping
objectid
text
true
64
objecttype
text
true
64
systemtagid
integer
0
true
true
4
true
mapping
objecttype
ascending
objectid
ascending
systemtagid
ascending
*dbprefix*systemtag_group
systemtagid
integer
0
true
true
4
gid
string
true
systemtag_group
true
true
gid
ascending
systemtagid
ascending
*dbprefix*privatedata
keyid
integer
0
true
true
4
1
user
text
true
64
app
text
true
255
key
text
true
255
value
text
true
255
true
true
keyid_index
keyid
ascending
*dbprefix*file_locks
id
integer
0
true
true
4
1
lock
integer
0
true
4
key
text
true
64
ttl
integer
-1
true
4
true
true
lock_id_index
id
ascending
true
lock_key_index
key
ascending
lock_ttl_index
ttl
ascending
*dbprefix*comments
id
integer
0
true
true
4
1
parent_id
integer
0
true
true
4
topmost_parent_id
integer
0
true
true
4
children_count
integer
0
true
true
4
actor_type
text
true
64
actor_id
text
true
64
message
clob
false
verb
text
false
64
creation_timestamp
timestamp
false
latest_child_timestamp
timestamp
false
object_type
text
true
64
object_id
text
true
64
comments_parent_id_index
false
parent_id
descending
comments_topmost_parent_id_idx
false
topmost_parent_id
descending
comments_object_index
false
object_type
ascending
object_id
ascending
creation_timestamp
descending
comments_actor_index
false
actor_type
ascending
actor_id
ascending
*dbprefix*comments_read_markers
user_id
text
true
64
marker_datetime
timestamp
false
object_type
text
true
64
object_id
text
true
64
comments_marker_object_index
false
object_type
ascending
object_id
ascending
comments_marker_index
true
user_id
descending
object_type
ascending
object_id
ascending
*dbprefix*credentials
user
text
false
64
identifier
text
true
64
credentials
clob
false
credentials_user_id
true
true
user
ascending
identifier
ascending
credentials_user
false
user
ascending
*dbprefix*admin_sections
id
text
false
64
class
text
true
255
priority
integer
true
1
admin_sections_id_index
true
id
ascending
admin_sections_class
true
class
ascending
*dbprefix*admin_settings
id
integer
0
true
1
4
class
text
true
255
section
text
false
64
priority
integer
true
1
admin_settings_id_index
true
id
ascending
admin_settings_class
true
class
ascending
admin_settings_section
false
section
ascending
*dbprefix*personal_sections
id
text
false
64
class
text
true
255
priority
integer
true
1
personal_sections_id_index
true
id
ascending
personal_sections_class
true
class
ascending
*dbprefix*personal_settings
id
integer
0
true
1
4
class
text
true
255
section
text
false
64
priority
integer
true
1
personal_settings_id_index
true
id
ascending
personal_settings_class
true
class
ascending
personal_settings_section
false
section
ascending
*dbprefix*accounts
uid
text
true
64
data
clob
true
uid_index
true
true
uid
ascending
vi">@curdiffs.push ['-', i, elem]
end
def discardb(i, elem)
@curdiffs.push ['+', i, elem]
end
def compact
return Diff.new(compactdiffs)
end
def compact!
@diffs = compactdiffs
end
def inspect
@diffs.inspect
end
end
end
module Diffable
def diff(b)
RedmineDiff::Diff.new(self, b)
end
# Create a hash that maps elements of the array to arrays of indices
# where the elements are found.
def reverse_hash(range = (0...self.length))
revmap = {}
range.each { |i|
elem = self[i]
if revmap.has_key? elem
revmap[elem].push i
else
revmap[elem] = [i]
end
}
return revmap
end
def replacenextlarger(value, high = nil)
high ||= self.length
if self.empty? || value > self[-1]
push value
return high
end
# binary search for replacement point
low = 0
while low < high
index = (high+low)/2
found = self[index]
return nil if value == found
if value > found
low = index + 1
else
high = index
end
end
self[low] = value
# $stderr << "replace #{value} : 0/#{low}/#{init_high} (#{steps} steps) (#{init_high-low} off )\n"
# $stderr.puts self.inspect
#gets
#p length - low
return low
end
def patch(diff)
newary = nil
if diff.difftype == String
newary = diff.difftype.new('')
else
newary = diff.difftype.new
end
ai = 0
bi = 0
diff.diffs.each { |d|
d.each { |mod|
case mod[0]
when '-'
while ai < mod[1]
newary << self[ai]
ai += 1
bi += 1
end
ai += 1
when '+'
while bi < mod[1]
newary << self[ai]
ai += 1
bi += 1
end
newary << mod[2]
bi += 1
else
raise "Unknown diff action"
end
}
}
while ai < self.length
newary << self[ai]
ai += 1
bi += 1
end
return newary
end
end
class Array
include Diffable
end
class String
include Diffable
end
=begin
= Diff
(({diff.rb})) - computes the differences between two arrays or
strings. Copyright (C) 2001 Lars Christensen
== Synopsis
diff = Diff.new(a, b)
b = a.patch(diff)
== Class Diff
=== Class Methods
--- Diff.new(a, b)
--- a.diff(b)
Creates a Diff object which represent the differences between
((|a|)) and ((|b|)). ((|a|)) and ((|b|)) can be either be arrays
of any objects, strings, or object of any class that include
module ((|Diffable|))
== Module Diffable
The module ((|Diffable|)) is intended to be included in any class for
which differences are to be computed. Diffable is included into String
and Array when (({diff.rb})) is (({require}))'d.
Classes including Diffable should implement (({[]})) to get element at
integer indices, (({<<})) to append elements to the object and
(({ClassName#new})) should accept 0 arguments to create a new empty
object.
=== Instance Methods
--- Diffable#patch(diff)
Applies the differences from ((|diff|)) to the object ((|obj|))
and return the result. ((|obj|)) is not changed. ((|obj|)) and
can be either an array or a string, but must match the object
from which the ((|diff|)) was created.
=end