Ok, Ill give it a try again, I was a bit uncertain on the "= ?" Insert for the 
file name. Now I just construct the whole query as a string, and execute that 
string. It works fine, but I had to implement a function that deleted the 
current file if there already is a file with the same name in the folder, to 
prevent crashing :)

Regards
Tor

Sendt fra min iPhone

> Den 7. mai 2014 kl. 15:40 skrev Wim Dumon <w...@emweb.be>:
> 
> Tor,
> 
> That should work (the binding part), but I don't know if the query is
> correct, I've never used 'into outfile'.
> 
> BR,
> Wim.
> 
> 
> 2014-05-07 15:34 GMT+02:00 Tor Arne Fallingen <fallin...@gmail.com>:
>> Hey Wim,
>> I already figured the std::endl error. But reminding me about the .str() was 
>> perfect, it solved everything else that was driving me crazy.
>> The stringsstream >> string method Ive stumbled upon rather often while 
>> searching for how to use C++ stringstream, but its goddamn unreliable, so is 
>> also std::to_string(stringstream), especially when Im using special 
>> characters like / or * in the sentences.
>> 
>> Thanks for your input.
>> 
>> By the way, how would I be able to:
>> 
>>>> execute("SELECT * INTO OUTFILE = ? FIELDS TERMINATED BY ' ,'LINES 
>>>> TERMINATED
>>>> BY '\n' FROM sre_db.gsa_table and sre_db.gga_table WHERE job_number = ? and
>>>> point_number = ? ").bind(s).bind(jobnumber).bind(point number);
>> 
>> and use the ? variable to bind to a file name? is this even possible?
>> 
>> Regards,
>> Tor
>> 
>> 
>> 
>>> 7. mai 2014 kl. 15:16 skrev Wim Dumon <w...@emweb.be>:
>>> 
>>> Hi Tor,
>>> 
>>> I don't think newlines are allowed in filenames, did you try without
>>> the std::endl?
>>> Also I usually use ss.str() to convert a stringstream to a string but
>>> I may simply be unaware of the >> method you're using.
>>> 
>>> Wim.
>>> 
>>> 
>>> 2014-05-07 10:19 GMT+02:00 Tor Arne Fallingen <fallin...@gmail.com>:
>>>> Hey guys,
>>>> 
>>>> You probably have the answer to this for me. Im trying to dump selected 
>>>> data
>>>> from one or more tables into a file for export via email. I try this
>>>> sentence:
>>>> 
>>>> execute("SELECT * INTO OUTFILE = ? FIELDS TERMINATED BY ' ,'LINES 
>>>> TERMINATED
>>>> BY '\n' FROM sre_db.gsa_table and sre_db.gga_table WHERE job_number = ? and
>>>> point_number = ? ").bind(s).bind(jobnumber).bind(point number);
>>>> 
>>>> 
>>>> 
>>>> where I try to create the file name(s):
>>>> 
>>>> std::stringstream ss;
>>>> 
>>>>   ss << "/Users/taf/downloads/Jobnumber_" << jobnumber << "_pointnumber_"
>>>> << pointnumber << ".csv" << std::endl;
>>>> 
>>>>   ss >> s;
>>>> 
>>>> 
>>>> based on the input of the method:
>>>> 
>>>> void dbHandler::sqlQuery(int jobnumber, int pointnumber)
>>>> 
>>>> 
>>>> 
>>>> The method doesn’t fail, but it doesn’t seem to create a file. Anyone have 
>>>> a
>>>> hint on what Im doing wrong here?
>>>> 
>>>> 
>>>> Regards,
>>>> Tor
>>>> 
>>>> ------------------------------------------------------------------------------
>>>> Is your legacy SCM system holding you back? Join Perforce May 7 to find 
>>>> out:
>>>> &#149; 3 signs your SCM is hindering your productivity
>>>> &#149; Requirements for releasing software faster
>>>> &#149; Expert tips and advice for migrating your SCM now
>>>> http://p.sf.net/sfu/perforce
>>>> _______________________________________________
>>>> witty-interest mailing list
>>>> witty-interest@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/witty-interest
>>> 
>>> ------------------------------------------------------------------------------
>>> Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
>>> &#149; 3 signs your SCM is hindering your productivity
>>> &#149; Requirements for releasing software faster
>>> &#149; Expert tips and advice for migrating your SCM now
>>> http://p.sf.net/sfu/perforce
>>> _______________________________________________
>>> witty-interest mailing list
>>> witty-interest@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/witty-interest
>> 
>> 
>> ------------------------------------------------------------------------------
>> Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
>> &#149; 3 signs your SCM is hindering your productivity
>> &#149; Requirements for releasing software faster
>> &#149; Expert tips and advice for migrating your SCM now
>> http://p.sf.net/sfu/perforce
>> _______________________________________________
>> witty-interest mailing list
>> witty-interest@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/witty-interest
> 
> ------------------------------------------------------------------------------
> Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
> &#149; 3 signs your SCM is hindering your productivity
> &#149; Requirements for releasing software faster
> &#149; Expert tips and advice for migrating your SCM now
> http://p.sf.net/sfu/perforce
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest

------------------------------------------------------------------------------
Is your legacy SCM system holding you back? Join Perforce May 7 to find out:
&#149; 3 signs your SCM is hindering your productivity
&#149; Requirements for releasing software faster
&#149; Expert tips and advice for migrating your SCM now
http://p.sf.net/sfu/perforce
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to