Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
c7297eba
Commit
c7297eba
authored
Sep 06, 2003
by
hf@deer.(none)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for LOAD DATA to work with embedded library
parent
548d7dc9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
10 deletions
+25
-10
libmysqld/lib_sql.cc
libmysqld/lib_sql.cc
+0
-1
sql/sql_load.cc
sql/sql_load.cc
+23
-7
sql/sql_parse.cc
sql/sql_parse.cc
+2
-2
No files found.
libmysqld/lib_sql.cc
View file @
c7297eba
...
@@ -34,7 +34,6 @@ static char inited, org_my_init_done;
...
@@ -34,7 +34,6 @@ static char inited, org_my_init_done;
#include "../sql/mysqld.cc"
#include "../sql/mysqld.cc"
#endif
#endif
#define SCRAMBLE_LENGTH 8
C_MODE_START
C_MODE_START
#include <mysql.h>
#include <mysql.h>
#include "errmsg.h"
#include "errmsg.h"
...
...
sql/sql_load.cc
View file @
c7297eba
...
@@ -77,9 +77,6 @@ static int read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
...
@@ -77,9 +77,6 @@ static int read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
List
<
Item
>
&
fields
,
READ_INFO
&
read_info
,
List
<
Item
>
&
fields
,
READ_INFO
&
read_info
,
String
&
enclosed
);
String
&
enclosed
);
#ifndef EMBEDDED_LIBRARY
int
mysql_load
(
THD
*
thd
,
sql_exchange
*
ex
,
TABLE_LIST
*
table_list
,
int
mysql_load
(
THD
*
thd
,
sql_exchange
*
ex
,
TABLE_LIST
*
table_list
,
List
<
Item
>
&
fields
,
enum
enum_duplicates
handle_duplicates
,
List
<
Item
>
&
fields
,
enum
enum_duplicates
handle_duplicates
,
bool
read_file_from_client
,
thr_lock_type
lock_type
)
bool
read_file_from_client
,
thr_lock_type
lock_type
)
...
@@ -91,7 +88,9 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -91,7 +88,9 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
String
*
field_term
=
ex
->
field_term
,
*
escaped
=
ex
->
escaped
,
String
*
field_term
=
ex
->
field_term
,
*
escaped
=
ex
->
escaped
,
*
enclosed
=
ex
->
enclosed
;
*
enclosed
=
ex
->
enclosed
;
bool
is_fifo
=
0
;
bool
is_fifo
=
0
;
#ifndef EMBEDDED_LIBRARY
LOAD_FILE_INFO
lf_info
;
LOAD_FILE_INFO
lf_info
;
#endif
char
*
db
=
table_list
->
db
;
// This is never null
char
*
db
=
table_list
->
db
;
// This is never null
/* If no current database, use database where table is located */
/* If no current database, use database where table is located */
char
*
tdb
=
thd
->
db
?
thd
->
db
:
db
;
char
*
tdb
=
thd
->
db
?
thd
->
db
:
db
;
...
@@ -184,6 +183,17 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -184,6 +183,17 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
}
}
else
else
{
{
#ifdef EMBEDDED_LIBRARY
char
*
chk_name
=
ex
->
file_name
;
while
((
*
chk_name
==
' '
)
||
(
*
chk_name
==
't'
))
chk_name
++
;
if
(
*
chk_name
==
FN_CURLIB
)
{
sprintf
(
name
,
"%s%s"
,
mysql_data_home
,
ex
->
file_name
);
unpack_filename
(
name
,
name
);
}
else
#endif
/*EMBEDDED_LIBRARY*/
unpack_filename
(
name
,
ex
->
file_name
);
unpack_filename
(
name
,
ex
->
file_name
);
#if !defined(__WIN__) && !defined(OS2) && ! defined(__NETWARE__)
#if !defined(__WIN__) && !defined(OS2) && ! defined(__NETWARE__)
MY_STAT
stat_info
;
MY_STAT
stat_info
;
...
@@ -225,6 +235,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -225,6 +235,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
DBUG_RETURN
(
-
1
);
// Can't allocate buffers
DBUG_RETURN
(
-
1
);
// Can't allocate buffers
}
}
#ifndef EMBEDDED_LIBRARY
if
(
!
opt_old_rpl_compat
&&
mysql_bin_log
.
is_open
())
if
(
!
opt_old_rpl_compat
&&
mysql_bin_log
.
is_open
())
{
{
lf_info
.
thd
=
thd
;
lf_info
.
thd
=
thd
;
...
@@ -238,6 +249,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -238,6 +249,8 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
lf_info
.
log_delayed
=
log_delayed
;
lf_info
.
log_delayed
=
log_delayed
;
read_info
.
set_io_cache_arg
((
void
*
)
&
lf_info
);
read_info
.
set_io_cache_arg
((
void
*
)
&
lf_info
);
}
}
#endif
/*!EMBEDDED_LIBRARY*/
restore_record
(
table
,
default_values
);
restore_record
(
table
,
default_values
);
thd
->
count_cuted_fields
=
1
;
/* calc cuted fields */
thd
->
count_cuted_fields
=
1
;
/* calc cuted fields */
...
@@ -293,6 +306,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -293,6 +306,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
{
{
if
(
transactional_table
)
if
(
transactional_table
)
ha_autocommit_or_rollback
(
thd
,
error
);
ha_autocommit_or_rollback
(
thd
,
error
);
#ifndef EMBEDDED_LIBRARY
if
(
!
opt_old_rpl_compat
&&
mysql_bin_log
.
is_open
())
if
(
!
opt_old_rpl_compat
&&
mysql_bin_log
.
is_open
())
{
{
if
(
lf_info
.
wrote_create_file
)
if
(
lf_info
.
wrote_create_file
)
...
@@ -315,6 +329,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -315,6 +329,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
mysql_bin_log
.
write
(
&
d
);
mysql_bin_log
.
write
(
&
d
);
}
}
}
}
#endif
/*!EMBEDDED_LIBRARY*/
error
=
-
1
;
// Error on read
error
=
-
1
;
// Error on read
goto
err
;
goto
err
;
}
}
...
@@ -327,6 +342,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -327,6 +342,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
if
(
!
log_delayed
)
if
(
!
log_delayed
)
thd
->
options
|=
OPTION_STATUS_NO_TRANS_UPDATE
;
thd
->
options
|=
OPTION_STATUS_NO_TRANS_UPDATE
;
#ifndef EMBEDDED_LIBRARY
if
(
mysql_bin_log
.
is_open
())
if
(
mysql_bin_log
.
is_open
())
{
{
if
(
opt_old_rpl_compat
)
if
(
opt_old_rpl_compat
)
...
@@ -348,6 +364,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
...
@@ -348,6 +364,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
}
}
}
}
}
}
#endif
/*!EMBEDDED_LIBRARY*/
if
(
transactional_table
)
if
(
transactional_table
)
error
=
ha_autocommit_or_rollback
(
thd
,
error
);
error
=
ha_autocommit_or_rollback
(
thd
,
error
);
err:
err:
...
@@ -359,8 +376,6 @@ err:
...
@@ -359,8 +376,6 @@ err:
DBUG_RETURN
(
error
);
DBUG_RETURN
(
error
);
}
}
#endif
/* EMBEDDED_LIBRARY */
/****************************************************************************
/****************************************************************************
** Read of rows of fixed size + optional garage + optonal newline
** Read of rows of fixed size + optional garage + optonal newline
****************************************************************************/
****************************************************************************/
...
@@ -640,11 +655,12 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs,
...
@@ -640,11 +655,12 @@ READ_INFO::READ_INFO(File file_par, uint tot_length, CHARSET_INFO *cs,
mysys/mf_iocache.c. So we work around the problem with a
mysys/mf_iocache.c. So we work around the problem with a
manual assignment
manual assignment
*/
*/
need_end_io_cache
=
1
;
#ifndef EMBEDDED_LIBRARY
if
(
get_it_from_net
)
if
(
get_it_from_net
)
cache
.
read_function
=
_my_b_net_read
;
cache
.
read_function
=
_my_b_net_read
;
need_end_io_cache
=
1
;
#ifndef EMBEDDED_LIBRARY
if
(
!
opt_old_rpl_compat
&&
mysql_bin_log
.
is_open
())
if
(
!
opt_old_rpl_compat
&&
mysql_bin_log
.
is_open
())
cache
.
pre_read
=
cache
.
pre_close
=
cache
.
pre_read
=
cache
.
pre_close
=
(
IO_CACHE_CALLBACK
)
log_loaded_block
;
(
IO_CACHE_CALLBACK
)
log_loaded_block
;
...
...
sql/sql_parse.cc
View file @
c7297eba
...
@@ -2755,7 +2755,7 @@ mysql_execute_command(THD *thd)
...
@@ -2755,7 +2755,7 @@ mysql_execute_command(THD *thd)
case
SQLCOM_CHANGE_DB
:
case
SQLCOM_CHANGE_DB
:
mysql_change_db
(
thd
,
select_lex
->
db
);
mysql_change_db
(
thd
,
select_lex
->
db
);
break
;
break
;
#ifndef EMBEDDED_LIBRARY
case
SQLCOM_LOAD
:
case
SQLCOM_LOAD
:
{
{
uint
privilege
=
(
lex
->
duplicates
==
DUP_REPLACE
?
uint
privilege
=
(
lex
->
duplicates
==
DUP_REPLACE
?
...
@@ -2782,7 +2782,7 @@ mysql_execute_command(THD *thd)
...
@@ -2782,7 +2782,7 @@ mysql_execute_command(THD *thd)
lex
->
duplicates
,
(
bool
)
lex
->
local_file
,
lex
->
lock_option
);
lex
->
duplicates
,
(
bool
)
lex
->
local_file
,
lex
->
lock_option
);
break
;
break
;
}
}
#endif
/* EMBEDDED_LIBRARY */
case
SQLCOM_SET_OPTION
:
case
SQLCOM_SET_OPTION
:
if
(
tables
&&
((
res
=
check_table_access
(
thd
,
SELECT_ACL
,
tables
))
||
if
(
tables
&&
((
res
=
check_table_access
(
thd
,
SELECT_ACL
,
tables
))
||
(
res
=
open_and_lock_tables
(
thd
,
tables
))))
(
res
=
open_and_lock_tables
(
thd
,
tables
))))
...
...
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