Re: Embed SQL in C
От | Michael Fuhr |
---|---|
Тема | Re: Embed SQL in C |
Дата | |
Msg-id | 20050307040807.GA23291@winnie.fuhr.org обсуждение исходный текст |
Ответ на | Embed SQL in C (GMX <baldauf_m@gmx.at>) |
Ответы |
Re: Embed SQL in C
|
Список | pgsql-novice |
On Wed, Mar 02, 2005 at 06:46:10PM +0100, GMX wrote: > I need a C-program that goes something like this: Why the requirement to use C? Many tasks are easier in and can be adequately written with higher-level languages like Perl, Python, Ruby, Tcl, etc. > 1) Check how much devices are in the database and look up the IP and > the Port from them from the database. Make an appropriate SELECT query against the table that contains this information. If you need help with SQL in general or with PostgreSQL in particular, see the Tutorial and other parts of the the PostgreSQL documentation. http://www.postgresql.org/docs/ > 2) Connect to the computer using the IP and the Port and send a > certain string to this computer. This isn't a PostgreSQL issue. Use an appropriate library/module or write the socket code yourself. The socket programming bible is _UNIX Network Programming_, Volume 1, by W. Richard Stevens. > [the computer echoes to this certain string with another string that > contains 3 values] > > 3) The received string should be split and each value should be > written in the right field of the SQL database. Split the string using whatever facilities your programming language provides and do an INSERT or UPDATE into the desired table. PostgreSQL also has some string-handling functions -- see "String Functions and Operators" in the "Functions and Operators" chapter in the documentation. If you're having a specific problem, then please post what you've tried, explain what you'd like to happen, and describe what actually does happen, including the exact text of any errors or warnings. -- Michael Fuhr http://www.fuhr.org/~mfuhr/
В списке pgsql-novice по дате отправления: