|
|
Ŭ¶ó¿ìµåű×
javascript PHP ASP CSS mysql HTML jquery image Mobile API slide °Ô½ÃÆÇ ¸Þ´º
|
|
ÇöÀçÁ¢¼ÓÀÚ ¸í |
|
|
|
|
|
|
25 |
| |
502 |
| |
2000-11-21 11:01:47 |
|
|
|
´Ð³×ÀÓ
|
Anonymous |
À̸ÞÀÏ
|
|
Á¦¸ñ
|
[´äº¯] pgsql¹®¹ý ¾Ë°í½Í¾î¿ä |
³»¿ë
|
|
#include
#include
#include
#include
void db_connection()
{
conn = PQsetdb(NULL,NULL,NULL,NULL,"exam"); //examÀ̶ó´Â db¿¡ ¿¬°á
if (PQstatus(conn) == CONNECTION_BAD){
printf("error : %s", PQerrorMessage(conn));
}
}
main()
{
db_connection();
PGresult *result,*result1;
char query[200],query1[200];
int row,i;
=============== aaa¶ó´Â Å×ÀÌºí¿¡ °ª Áý¾î³Ö±â =====================
sprintf(query, "insert into aaa(a01,a02,a03,a04)
values (1,
asdf
,
qwer
,
sadf
)");
result = PQexec(conn, query);
============= aaa¶ó´Â Å×À̺íÀÇ °ª »Ñ·ÁÁÖ±â ======================
sprintf(query1, "select a01,a02,a03,a04 from aaa");
result1 = PQexec(conn, query1);
row = PQntuples(result1); // °Ë»öÇÑ µ¥ÀÌŸÀÇ ÁÙ¼ö(?)
printf("Content-Type:text/html
");
printf("
");
printf("
");
printf("¹øÈ£ |
");
printf("ÀÚ·á4 |
");
printf("ÀÚ·á2 |
");
printf("ÀÚ·á3 |
");
printf("
");
for (i = 0; i < row; i++){
printf("
");
printf("%s |
", PQgetvalue(result1, i, 0));
printf("%s |
", PQgetvalue(result1, i, 1));
printf("%s |
", PQgetvalue(result1, i, 2));
printf("%s |
", PQgetvalue(result1, i, 3));
printf("
");
}
printf("
");
}
insert, select ó·³ delete, update µÎ ±ÛÄÉ »ç¿ëÇÏ¸é µË´Ï´Ù...
delete from aaa where a01=3
ÀÌ·±½ÄÀ¸·Î ³ÖÀ¸¸é aaaÅ×ÀÌºí¿¡¼ a01ÀÌ 3ÀÎ Çุ Áö¿ì°Ô ÇÏ´Â °ÍÀ̱¸..
update aaa set a01=2, a02=
ruru
, a03=
cucu
, a04=
tutu
where a01=3
ÀÌ·±½ÄÀ¸·Î ³ÖÀ¸¸é aaaÅ×ÀÌºí¿¡¼ a01ÀÌ 3ÀÎ Çุ ¼öÁ¤Çϴ°ű¸¿©
Áú¹®¿¡ ¸Â´Â ´äÀÎÁö Àß ¸ð¸£°Ú³×¿©...
±×³É ÁÖ¼¶ ÁÖ¼¶ ÀûÀº°Å¶ó¼ Ʋ¸±ÁöµÎ ¸Ö¶ó¿©...
Áñ°ÇÇÏ·ç µÇ¼¼¿©
|
|
|
|
|
|
|
|
|
| |