|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
mysql++ load local infileI am using mysql++ to access mySQL from a C++ program.
I am able execute various queries except LOAD DATA LOCAL INFILE. How do I go about doing this? I have not seen an implementation in any of the examples provided in the mysql++ download. This is what I am doing right now: #define HOST "localhost" #define DB "databse_name" #define USER "anonymous" #define PASS "" . . . mysqlpp::Connection con(DB, HOST, USER, PASS); mysqlpp::NoExceptions ne(con); mysqlpp::Query query = con.query(); CString command; command = "LOAD DATA LOCAL INFILE \"file_location\" into TABLE name_of_table;"; query = con.query(command); query.execute(); Is there anything else that needs to be done for this to work, or do I have my query set up incorrectly? Thanks! _________________________________________________________________ Need to know now? Get instant answers with Windows Live Messenger. http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_062008 |
|
|
Re: mysql++ load local infileWhat exactly is failing with your program?
I do this: try { ... string statement = "load data infile '" + fullFileName; statement += "' into table daytypes "; statement += "fields terminated by ',' enclosed by '' "; statement += "lines terminated by '\\r\\n'"; executeSQLStatement(statement); } catch (const mysqlpp::Exception& er) { ...stuff } executeSQLStatement() simply invokes: mysqlpp::Query query = mySQLConn->query(); query << SQLStatement; query.execute(); I'd have to double check, but I believe that it is important that the slashes in the file name are forward slashes. Dennis M. wrote: > I am using mysql++ to access mySQL from a C++ program. > > I am able execute various queries except LOAD DATA LOCAL INFILE. > > How do I go about doing this? I have not seen an implementation in any of the examples provided in the mysql++ download. > > This is what I am doing right now: > > #define HOST "localhost" > #define DB "databse_name" > #define USER "anonymous" > #define PASS "" > > . > . > . > > mysqlpp::Connection con(DB, HOST, USER, PASS); > mysqlpp::NoExceptions ne(con); > mysqlpp::Query query = con.query(); > > CString command; > command = "LOAD DATA LOCAL INFILE \"file_location\" into TABLE name_of_table;"; > query = con.query(command); > query.execute(); > > > > Is there anything else that needs to be done for this to work, or do I have my query set up incorrectly? > > > Thanks! > > _________________________________________________________________ > Need to know now? Get instant answers with Windows Live Messenger. > http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_062008 > -- MySQL++ Mailing List For list archives: http://lists.mysql.com/plusplus To unsubscribe: http://lists.mysql.com/plusplus?unsub=lists@... |
|
|
|
| Free Forum Powered by Nabble | Forum Help |