Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
2e865375
Commit
2e865375
authored
Dec 15, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 619581: Make contrib/bzdbcopy.pl work again, and also make it work with
SQLite. r=mkanat, a=mkanat
parent
7b48d43d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
11 deletions
+34
-11
Sqlite.pm
Bugzilla/DB/Sqlite.pm
+15
-2
bzdbcopy.pl
contrib/bzdbcopy.pl
+19
-9
No files found.
Bugzilla/DB/Sqlite.pm
View file @
2e865375
...
@@ -235,9 +235,23 @@ sub sql_string_until {
...
@@ -235,9 +235,23 @@ sub sql_string_until {
return
"SUBSTR($string, 1, $position - 1)"
return
"SUBSTR($string, 1, $position - 1)"
}
}
###############
# bz_ methods #
###############
# XXX This needs to be implemented.
# XXX This needs to be implemented.
sub
bz_explain
{
}
sub
bz_explain
{
}
sub
bz_table_list_real
{
my
$self
=
shift
;
my
@tables
=
$self
->
SUPER::
bz_table_list_real
(
@_
);
# SQLite includes a sqlite_sequence table in every database that isn't
# one of our real tables. We exclude any table that starts with sqlite_,
# just to be safe.
@tables
=
grep
{
$_
!~
/^sqlite_/
}
@tables
;
return
@tables
;
}
1
;
1
;
__END__
__END__
...
@@ -252,4 +266,4 @@ This module overrides methods of the Bugzilla::DB module with a
...
@@ -252,4 +266,4 @@ This module overrides methods of the Bugzilla::DB module with a
SQLite-specific implementation. It is instantiated by the Bugzilla::DB module
SQLite-specific implementation. It is instantiated by the Bugzilla::DB module
and should never be used directly.
and should never be used directly.
For interface details see L<Bugzilla::DB> and L<DBI>.
For interface details see L<Bugzilla::DB> and L<DBI>.
\ No newline at end of file
contrib/bzdbcopy.pl
View file @
2e865375
...
@@ -32,14 +32,14 @@ use Bugzilla::Util;
...
@@ -32,14 +32,14 @@ use Bugzilla::Util;
# Settings for the 'Source' DB that you are copying from.
# Settings for the 'Source' DB that you are copying from.
use
constant
SOURCE_DB_TYPE
=>
'Mysql'
;
use
constant
SOURCE_DB_TYPE
=>
'Mysql'
;
use
constant
SOURCE_DB_NAME
=>
'bugs'
;
use
constant
SOURCE_DB_NAME
=>
'bugs
_tip
'
;
use
constant
SOURCE_DB_USER
=>
'bugs'
;
use
constant
SOURCE_DB_USER
=>
'bugs'
;
use
constant
SOURCE_DB_PASSWORD
=>
''
;
use
constant
SOURCE_DB_PASSWORD
=>
'
buGmElateR
'
;
use
constant
SOURCE_DB_HOST
=>
'localhost'
;
use
constant
SOURCE_DB_HOST
=>
'localhost'
;
# Settings for the 'Target' DB that you are copying to.
# Settings for the 'Target' DB that you are copying to.
use
constant
TARGET_DB_TYPE
=>
'
Pg
'
;
use
constant
TARGET_DB_TYPE
=>
'
Sqlite
'
;
use
constant
TARGET_DB_NAME
=>
'bugs'
;
use
constant
TARGET_DB_NAME
=>
'bugs
_tip
'
;
use
constant
TARGET_DB_USER
=>
'bugs'
;
use
constant
TARGET_DB_USER
=>
'bugs'
;
use
constant
TARGET_DB_PASSWORD
=>
''
;
use
constant
TARGET_DB_PASSWORD
=>
''
;
use
constant
TARGET_DB_HOST
=>
'localhost'
;
use
constant
TARGET_DB_HOST
=>
'localhost'
;
...
@@ -50,11 +50,16 @@ use constant TARGET_DB_HOST => 'localhost';
...
@@ -50,11 +50,16 @@ use constant TARGET_DB_HOST => 'localhost';
print
"Connecting to the '"
.
SOURCE_DB_NAME
.
"' source database on "
print
"Connecting to the '"
.
SOURCE_DB_NAME
.
"' source database on "
.
SOURCE_DB_TYPE
.
"...\n"
;
.
SOURCE_DB_TYPE
.
"...\n"
;
my
$source_db
=
Bugzilla::DB::
_connect
(
SOURCE_DB_TYPE
,
SOURCE_DB_HOST
,
my
$source_db
=
Bugzilla::DB::
_connect
({
SOURCE_DB_NAME
,
undef
,
undef
,
SOURCE_DB_USER
,
SOURCE_DB_PASSWORD
);
db_driver
=>
SOURCE_DB_TYPE
,
db_host
=>
SOURCE_DB_HOST
,
db_name
=>
SOURCE_DB_NAME
,
db_user
=>
SOURCE_DB_USER
,
db_pass
=>
SOURCE_DB_PASSWORD
,
});
# Don't read entire tables into memory.
# Don't read entire tables into memory.
if
(
SOURCE_DB_TYPE
eq
'Mysql'
)
{
if
(
SOURCE_DB_TYPE
eq
'Mysql'
)
{
$source_db
->
{
'mysql_use_result'
}
=
1
;
$source_db
->
{
'mysql_use_result'
}
=
1
;
# MySQL cannot have two queries running at the same time. Ensure the schema
# MySQL cannot have two queries running at the same time. Ensure the schema
# is loaded from the database so bz_column_info will not execute a query
# is loaded from the database so bz_column_info will not execute a query
...
@@ -63,8 +68,13 @@ if (SOURCE_DB_TYPE eq 'Mysql') {
...
@@ -63,8 +68,13 @@ if (SOURCE_DB_TYPE eq 'Mysql') {
print
"Connecting to the '"
.
TARGET_DB_NAME
.
"' target database on "
print
"Connecting to the '"
.
TARGET_DB_NAME
.
"' target database on "
.
TARGET_DB_TYPE
.
"...\n"
;
.
TARGET_DB_TYPE
.
"...\n"
;
my
$target_db
=
Bugzilla::DB::
_connect
(
TARGET_DB_TYPE
,
TARGET_DB_HOST
,
my
$target_db
=
Bugzilla::DB::
_connect
({
TARGET_DB_NAME
,
undef
,
undef
,
TARGET_DB_USER
,
TARGET_DB_PASSWORD
);
db_driver
=>
TARGET_DB_TYPE
,
db_host
=>
TARGET_DB_HOST
,
db_name
=>
TARGET_DB_NAME
,
db_user
=>
TARGET_DB_USER
,
db_pass
=>
TARGET_DB_PASSWORD
,
});
my
$ident_char
=
$target_db
->
get_info
(
29
);
# SQL_IDENTIFIER_QUOTE_CHAR
my
$ident_char
=
$target_db
->
get_info
(
29
);
# SQL_IDENTIFIER_QUOTE_CHAR
# We use the table list from the target DB, because if somebody
# We use the table list from the target DB, because if somebody
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment