00001 #include <grass/dbmi.h> 00002 #include "macros.h" 00003 00010 int 00011 db_execute_immediate (dbDriver *driver, dbString *SQLstatement) 00012 { 00013 int ret_code; 00014 00015 /* start the procedure call */ 00016 db__set_protocol_fds (driver->send, driver->recv); 00017 DB_START_PROCEDURE_CALL(DB_PROC_EXECUTE_IMMEDIATE); 00018 00019 /* send the argument(s) to the procedure */ 00020 DB_SEND_STRING (SQLstatement); 00021 00022 /* get the return code for the procedure call */ 00023 DB_RECV_RETURN_CODE(&ret_code); 00024 00025 if (ret_code != DB_OK) 00026 return ret_code; /* ret_code SHOULD == DB_FAILED */ 00027 00028 /* no results */ 00029 return DB_OK; 00030 } 00031 00038 int 00039 db_begin_transaction (dbDriver *driver ) 00040 { 00041 int ret_code; 00042 00043 /* start the procedure call */ 00044 db__set_protocol_fds (driver->send, driver->recv); 00045 DB_START_PROCEDURE_CALL(DB_PROC_BEGIN_TRANSACTION); 00046 00047 /* get the return code for the procedure call */ 00048 DB_RECV_RETURN_CODE(&ret_code); 00049 00050 if (ret_code != DB_OK) 00051 return ret_code; 00052 00053 /* no results */ 00054 return DB_OK; 00055 } 00056 00063 int 00064 db_commit_transaction (dbDriver *driver ) 00065 { 00066 int ret_code; 00067 00068 /* start the procedure call */ 00069 db__set_protocol_fds (driver->send, driver->recv); 00070 DB_START_PROCEDURE_CALL(DB_PROC_COMMIT_TRANSACTION); 00071 00072 /* get the return code for the procedure call */ 00073 DB_RECV_RETURN_CODE(&ret_code); 00074 00075 if (ret_code != DB_OK) 00076 return ret_code; 00077 00078 /* no results */ 00079 return DB_OK; 00080 } 00081