Re: Programming MySQL in C
From: Jerry Stuckle <jstucklex_at_attglobal.net>
Date: Wed, 17 May 2017 19:38:25 -0400
Message-ID: <ofimmq$tbs$1_at_jstuckle.eternal-september.org>
>> On 5/16/2017 2:31 AM, bit-naughty_at_hotmail.com wrote:
>>> I'd like some info on this - my book has a little, so I was just wondering - does anyone do this these days? Is like, the mysql C library included with a modern, say, CentOS?
>>> And, most importantly - what's a quick n easy way to print HTML in C? For a page that will have normal HTML interspersed with DB output, do I have to put a slash before every quote mark if I haave a PRINT statement with HTML in it? I suppose I could do a search-and-repace in my text editor to replace every " with a \", but - IS THERE A BETTER WAY? One other way I guess would be to put every separate little bit of HTML in a separate file, and pull it up and print it in the C proggy, but - that would be Bloody Slow!
>>>
>>> Anything else?
>>>
>>>
>>> Thanks.
>>>
>>
>> I do a fair amount of C work with MySQL. It works well (although for
>> more critical code I generally use DB2 or Oracle - both have free
>> versions available but you have to install them yourself).
>>
>> When you say "print HTML in C", are you talking about to a browser? Are
>> you trying to do it with a web server? Neither is easy to do in C; for
>> the former you need to open a TCP/IP port and wait for a connection
>> request from the browser, then decode the request and process it. And
>> to work with a web server, you'll need to find some third-party libraries.
Date: Wed, 17 May 2017 19:38:25 -0400
Message-ID: <ofimmq$tbs$1_at_jstuckle.eternal-september.org>
On 5/17/2017 12:08 PM, J.O. Aho wrote: > On 05/17/17 17:47, Jerry Stuckle wrote:
>> On 5/16/2017 2:31 AM, bit-naughty_at_hotmail.com wrote:
>>> I'd like some info on this - my book has a little, so I was just wondering - does anyone do this these days? Is like, the mysql C library included with a modern, say, CentOS?
>>> And, most importantly - what's a quick n easy way to print HTML in C? For a page that will have normal HTML interspersed with DB output, do I have to put a slash before every quote mark if I haave a PRINT statement with HTML in it? I suppose I could do a search-and-repace in my text editor to replace every " with a \", but - IS THERE A BETTER WAY? One other way I guess would be to put every separate little bit of HTML in a separate file, and pull it up and print it in the C proggy, but - that would be Bloody Slow!
>>>
>>> Anything else?
>>>
>>>
>>> Thanks.
>>>
>>
>> I do a fair amount of C work with MySQL. It works well (although for
>> more critical code I generally use DB2 or Oracle - both have free
>> versions available but you have to install them yourself).
>>
>> When you say "print HTML in C", are you talking about to a browser? Are
>> you trying to do it with a web server? Neither is easy to do in C; for
>> the former you need to open a TCP/IP port and wait for a connection
>> request from the browser, then decode the request and process it. And
>> to work with a web server, you'll need to find some third-party libraries.
> > Nah, you can use cgi, the web server handles the connections. You still > need to keep track of content headers. >
Yes, which was my point - it's not easy to do in C, but it is easy to screw up. If I were doing it, I'd use PHP, Python or other web-directed language.
The right tool for the right job. Seldom is C by itself the right tool for web work (although I have written PHP extensions in C to perform certain functions not easily done in PHP).
-- ================== Remove the "x" from my email address Jerry Stuckle jstucklex_at_attglobal.net ==================Received on Thu May 18 2017 - 01:38:25 CEST