- Common Function
cursor | Ä¿¼¸¦ »ý¼ºÇÑ´Ù. |
SQLTable | ÇØ´ç SQL¹®À» ½ÇÇàÇÏ¿© HTMLÀÇ table·Î Ãâ·ÂÇÑ´Ù. |
execute | SQL¹®ÀåÀ» ½ÇÇàÇÑ´Ù. |
connected | db¿¡ Á¢¼ÓµÇ¾îÀÖÀ¸¸é true |
release | dbÁ¢¼Ó Á¾·á |
beginTransaction | transactionÀÇ ±â·ÏÀ» ½ÃÀÛÇÑ´Ù. |
commitTransaction | transactionÀÇ ³»¿ëÀ» commitÇÑ´Ù.(ÀúÀå) |
rollbackTransaction | transactionÀÇ ³»¿ëÀ» rollbackÇÑ´Ù.(Ãë¼Ò) |
storedProc | Stored Procedure¸¦ È£ÃâÇÒ ¶§ »ç¿ëÇÑ´Ù. |
- database object
¾Õ¿¡¼ ¼³¸íÇÑ ³»¿ëµéÀÌ ¾î·Á¿üÀ¸¶ó º»´Ù. µû¶ó¼, À̹øÀå¿¡¼´Â ÀÌÇØ½±°í, »ç¿ëÇϱ⠽¬¿î
database°´Ã¼¿¡ ´ëÇÑ ¿¹¸¦ ƯÁ¤ ±â´ÉÀ̳ª ÇÔ¼öº°·Î ¼³¸íÅä·Ï ÇϰڴÙ.
1) connect : ¸ÕÀú Database¿¡ Á¢¼ÓºÎÅÍ ÇÏÀÚ.
database.connect("ORACLE","servername","userid","password","dbname");
if( database.connected() ){
....................
} |
2) SQLTable : ¸ðµç °á°ú¸¦ HTMLÀÇ Table·Î Ç¥ÇöÇØº¸ÀÚ.
database.SQLTable("select * from usertable");
|
3) execute : insert, delete, dropµî°ú °°Àº SQL¹®ÀåÀ» Áï½Ã ½ÇÇà½Ãų ¼ö ÀÖ´Ù.
database.execute("insert into usertable values(111) ");
|
4) cursor : Ä¿¼¶õ, SQL¹®ÀåÀ» ½ÇÇàÇÏ°í ³ª¼ Çѹø¿¡ ÇÑÁÙ¾¿ ÀڷḦ °¡Á®¿Ã ¶§ »ç¿ëµÇ´Â °ÍÀ» ¸»ÇÑ´Ù.
usr = database.cursor("select * from usertable where id = " + k);
if( usr && database.majorErrorCode() == 0 ){
while(usr.next() ){
for(i = 0;i < usr.columns();i++){
write(" name : " + usr.name);
write(" Id : " + usr.id);
}
}
}
|
* cursor °´Ã¼ÀÇ ±âŸ ¸Þ¼Òµå
columns() | columnÀÇ °³¼ö |
columnName(i) | i¹øÂ° columnÀÇ ¸íĪ |
insertRow("table") | table¿¡ 1ÁÙÀ» Ãß°¡ÇÑ´Ù. |
updateRow("table") | table°ªÀ» updateÇÑ´Ù. |
deleteRow("table") | table¿¡¼ ÇöÀçÁÙÀ» »èÁ¦ÇÑ´Ù. |
5) transaction
database.beginTransaction();
emp = database.cursor("select * from usrtable where id='11'");
if ( emp && database.majorErrorCode() == 0 ){
while(emp.next() ){
if( emp.id == "KIM" ){
emp.sum = 100;
emp.updateRow("usertable");
}
}
emp.close();
database.commitTransaction();
}else
database.rollbackTransaction();
|
- Last Update : 2001.7.5 by Deadfire(http://www.deadfire.net)
|
|
|