GRASS Programmer's Manual 6.4.1(2011)
|
00001 00015 #include <grass/dbmi.h> 00016 #include "macros.h" 00017 00027 int db_execute_immediate(dbDriver * driver, dbString * SQLstatement) 00028 { 00029 int ret_code; 00030 00031 /* start the procedure call */ 00032 db__set_protocol_fds(driver->send, driver->recv); 00033 DB_START_PROCEDURE_CALL(DB_PROC_EXECUTE_IMMEDIATE); 00034 00035 /* send the argument(s) to the procedure */ 00036 DB_SEND_STRING(SQLstatement); 00037 00038 /* get the return code for the procedure call */ 00039 DB_RECV_RETURN_CODE(&ret_code); 00040 00041 if (ret_code != DB_OK) 00042 return ret_code; /* ret_code SHOULD == DB_FAILED */ 00043 00044 /* no results */ 00045 return DB_OK; 00046 } 00047 00056 int db_begin_transaction(dbDriver * driver) 00057 { 00058 int ret_code; 00059 00060 /* start the procedure call */ 00061 db__set_protocol_fds(driver->send, driver->recv); 00062 DB_START_PROCEDURE_CALL(DB_PROC_BEGIN_TRANSACTION); 00063 00064 /* get the return code for the procedure call */ 00065 DB_RECV_RETURN_CODE(&ret_code); 00066 00067 if (ret_code != DB_OK) 00068 return ret_code; 00069 00070 /* no results */ 00071 return DB_OK; 00072 } 00073 00082 int db_commit_transaction(dbDriver * driver) 00083 { 00084 int ret_code; 00085 00086 /* start the procedure call */ 00087 db__set_protocol_fds(driver->send, driver->recv); 00088 DB_START_PROCEDURE_CALL(DB_PROC_COMMIT_TRANSACTION); 00089 00090 /* get the return code for the procedure call */ 00091 DB_RECV_RETURN_CODE(&ret_code); 00092 00093 if (ret_code != DB_OK) 00094 return ret_code; 00095 00096 /* no results */ 00097 return DB_OK; 00098 }