Skip to content

Commit

Permalink
warning fixed for linux
Browse files Browse the repository at this point in the history
  • Loading branch information
c-bik committed Feb 3, 2014
1 parent 6ec15f6 commit 90e96e6
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 50 deletions.
16 changes: 8 additions & 8 deletions c_src/erloci_drv/cmd_processors.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,9 @@ bool cmd_describe(ETERM * command)
resp = erl_format((char*)"{~w,~i,{desc,[]}}", args[0], CMD_DSCRB);
} catch (intf_ret r) {
resp = erl_format((char*)"{~w,~i,{error,{~i,~s}}}", args[0], CMD_DSCRB, r.gerrcode, r.gerrbuf);
if (r.fn_ret == CONTINUE_WITH_ERROR)
if (r.fn_ret == CONTINUE_WITH_ERROR) {
if(!resp) REMOTE_LOG(INF, "Continue with ERROR Execute SQL \"%.*s;\" -> %s\n", ERL_BIN_SIZE(args[2]), ERL_BIN_PTR(args[2]), r.gerrbuf);
else {
} else {
if(!resp) REMOTE_LOG(ERR, "ERROR %s\n", r.gerrbuf);
ret = true;
}
Expand Down Expand Up @@ -374,9 +374,9 @@ bool cmd_prep_sql(ETERM * command)
erl_free_term(stmth);
} catch (intf_ret r) {
resp = erl_format((char*)"{~w,~i,{error,{~i,~s}}}", args[0], PREP_STMT, r.gerrcode, r.gerrbuf);
if (r.fn_ret == CONTINUE_WITH_ERROR)
if (r.fn_ret == CONTINUE_WITH_ERROR) {
if(!resp) REMOTE_LOG(INF, "Continue with ERROR Execute SQL \"%.*s;\" -> %s\n", ERL_BIN_SIZE(args[2]), ERL_BIN_PTR(args[2]), r.gerrbuf);
else {
} else {
if(!resp) REMOTE_LOG(ERR, "ERROR %s\n", r.gerrbuf);
ret = true;
}
Expand Down Expand Up @@ -519,9 +519,9 @@ bool cmd_exec_stmt(ETERM * command)
}
} catch (intf_ret r) {
resp = erl_format((char*)"{~w,~i,{error,{~i,~s}}}", args[0], EXEC_STMT, r.gerrcode, r.gerrbuf);
if (r.fn_ret == CONTINUE_WITH_ERROR)
if (r.fn_ret == CONTINUE_WITH_ERROR) {
if(!resp) REMOTE_LOG(INF, "Continue with ERROR Execute STMT %s\n", r.gerrbuf);
else {
} else {
if(!resp) REMOTE_LOG(ERR, "ERROR %s\n", r.gerrbuf);
ret = true;
}
Expand Down Expand Up @@ -600,9 +600,9 @@ bool cmd_fetch_rows(ETERM * command)
}
} catch (intf_ret r) {
resp = erl_format((char*)"{~w,~i,{error,{~i,~s}}}", args[0], FTCH_ROWS, r.gerrcode, r.gerrbuf);
if (r.fn_ret == CONTINUE_WITH_ERROR)
if (r.fn_ret == CONTINUE_WITH_ERROR) {
if(!resp) REMOTE_LOG(INF, "Continue with ERROR fetch STMT %s\n", r.gerrbuf);
else {
} else {
if(!resp) REMOTE_LOG(ERR, "ERROR %s\n", r.gerrbuf);
ret = true;
}
Expand Down
25 changes: 0 additions & 25 deletions c_src/erloci_drv/cmd_thread_pool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,29 +44,6 @@
static UINT rollback = 0;
#else
static threadpool_t *pTp = NULL;
static struct event ev;
static struct timeval tv;
#endif

#ifndef __WIN32__
unsigned long timeout_remaining()
{
struct timeval t;
struct timeval now;
memset(&t, 0, sizeof(struct timeval));
event_pending(&ev, EV_TIMEOUT, &t);
gettimeofday(&now, NULL);
return (t.tv_sec - now.tv_sec);
}

void timer_thread_start_function(void *ptr)
{
event_init();
event_set(&ev, 0, EV_TIMEOUT, IdleTimerCb, NULL);
event_add(&ev, &tv);
REMOTE_LOG(DBG, "IdleTimerCb firing if idle for %d sec\n", timeout_remaining());
event_dispatch();
}
#endif

void InitializeThreadPool(void)
Expand Down Expand Up @@ -218,10 +195,8 @@ ProcessCommandCb(
ProcessCommand();

void * cmd_tuple = NULL;
int indx = 0;
cmd_tuple = erl_decode((unsigned char *)rxpkt.buf);
if (!cmd_tuple) {
//if (ei_decode_term(rxpkt.buf, &indx, &cmd_tuple) < 0) {
REMOTE_LOG(CRT, "Term (%d) decoding failed...", rxpkt.len);
DUMP("rxpkt.buf", rxpkt.len, rxpkt.buf);
if(NULL != rxpkt.buf) delete rxpkt.buf;
Expand Down
1 change: 0 additions & 1 deletion c_src/erloci_drv/erloci_drv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ int main(int argc, char * argv[])
}*/
}

error_exit:
CleanupThreadPool();
REMOTE_LOG(DBG, "Port: Thread pool destroyed");

Expand Down
1 change: 1 addition & 0 deletions c_src/erloci_drv/oci_marshal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#else
#include <netinet/in.h>
#include <pthread.h>
#include <stdlib.h>
#endif

#include<iostream>
Expand Down
20 changes: 10 additions & 10 deletions c_src/erloci_lib/ocistmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ unsigned int ocistmt::execute(void * column_list,

/* bind variables if any */
size_t dat_len = 0;
for(int i = 0; i < _argsin.size(); ++i) {
for(int j = 0; j < _argsin[i].alen.size(); ++j) {
unsigned short * alenarr = &_argsin[i].alen[0];
for(unsigned int i = 0; i < _argsin.size(); ++i) {
for(unsigned int j = 0; j < _argsin[i].alen.size(); ++j) {
//unsigned short * alenarr = &_argsin[i].alen[0];
void ** valueparr = &_argsin[i].valuep[0];
switch(_argsin[i].dty) {
case SQLT_BFLOAT:
Expand All @@ -176,7 +176,7 @@ unsigned int ocistmt::execute(void * column_list,

if(_argsin.size() > 0)
_iters = _argsin[0].valuep.size();
for(int i = 0; i < _argsin.size(); ++i) {
for(unsigned int i = 0; i < _argsin.size(); ++i) {
checkerr(&r, OCIBindByName((OCIStmt*)_stmthp, (OCIBind**)(&_argsin[i].ocibind), (OCIError*)_errhp,
(text*)(_argsin[i].name), -1,
_argsin[i].datap, _argsin[i].value_sz,
Expand All @@ -191,7 +191,7 @@ unsigned int ocistmt::execute(void * column_list,
}
}

ub4 mode = (auto_commit ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT);
//ub4 mode = (auto_commit ? OCI_COMMIT_ON_SUCCESS : OCI_DEFAULT);
#ifdef FETCH_ROWIDS
#ifdef PRINT_ROWIDS
vector<char*> rowids;
Expand Down Expand Up @@ -289,7 +289,7 @@ unsigned int ocistmt::execute(void * column_list,
REMOTE_LOG("Inserted row id %s\n", rowids[__i]);
#endif

for(int i = 0; i < _argsin.size(); ++i) {
for(unsigned int i = 0; i < _argsin.size(); ++i) {
if(_argsin[i].datap) {
free(_argsin[i].datap);
_argsin[i].datap = NULL;
Expand Down Expand Up @@ -320,8 +320,8 @@ unsigned int ocistmt::execute(void * column_list,
/* Loop only if a descriptor was successfully retrieved for
* current position, starting at 1
*/
text *col_name, *schm_name;
ub4 len = 0, schm_len = 0;
text *col_name;
ub4 len = 0;
_columns.clear();

while (parm_status == OCI_SUCCESS) {
Expand Down Expand Up @@ -533,7 +533,7 @@ intf_ret ocistmt::rows(void * row_list,

row = NULL;
if (res != OCI_NO_DATA) {
for (int i = 0; i < _columns.size(); ++i)
for (unsigned int i = 0; i < _columns.size(); ++i)
switch (_columns[i].dtype) {
case SQLT_NUM:
(*string_append)((char*)_columns[i].row_valp, _columns[i].dlen, &row);
Expand Down Expand Up @@ -603,7 +603,7 @@ ocistmt::~ocistmt(void)
intf_ret r;

/* Release the bound variables memeory */
for (int i = 0; i < _columns.size(); ++i) {
for (unsigned int i = 0; i < _columns.size(); ++i) {
if(_columns[i].rtype == LCL_DTYPE_NONE)
delete (char*)(_columns[i].row_valp);
else
Expand Down
2 changes: 1 addition & 1 deletion src/oci_logger.erl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ handle_info({tcp, Socket, Data}, #state{sock = Socket, logfun = LogFun} = State)
end,
{noreply, State#state{buf = <<>>}}
end;
handle_info({tcp_closed, Socket}, #state{sock = Socket, logfun = LogFun} = State) ->
handle_info({tcp_closed, Socket}, #state{sock = Socket} = State) ->
io:format(user, "~p TCP closed~n", [{?MODULE, ?LINE}]),
{stop, normal, State};
handle_info(Msg, State) ->
Expand Down
6 changes: 3 additions & 3 deletions src/oci_port.erl
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,12 @@ handle_call(close, _From, #state{port=Port} = State) ->
_:R -> error_logger:error_report("Port close failed with reason: ~p~n", [R])
end,
{stop, normal, ok, State};
handle_call({port_call, Msg}, From, #state{port=Port, logger=PortLogger} = State) ->
handle_call({port_call, Msg}, From, #state{port=Port, logger=_PortLogger} = State) ->
Cmd = [From | Msg],
CmdTuple = list_to_tuple(Cmd),
BTerm = term_to_binary(CmdTuple),
%%?Debug(PortLogger, "TX (~p):~n---~n~s~n---", [byte_size(BTerm), oci_logger:bin2str(BTerm)]),
%?Debug(PortLogger, "TX (~p)", [integer_to_list(byte_size(BTerm),16)]),
%%?Debug(_PortLogger, "TX (~p):~n---~n~s~n---", [byte_size(BTerm), oci_logger:bin2str(BTerm)]),
%?Debug(_PortLogger, "TX (~p)", [integer_to_list(byte_size(BTerm),16)]),
true = port_command(Port, BTerm),
{noreply, State#state{waiting_resp=true, lastcmd=CmdTuple}}.

Expand Down
4 changes: 2 additions & 2 deletions start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ else
fi
case "$1" in
test)
$exename -pa deps/*/ebin -pa ebin -eval "oci_test:start(20,10000)."
$exename -pa ebin -eval "oci_test:start(20,10000)."
;;
*)
echo "To run throughput tests use 'test' option"
$exename -pa deps/*/ebin -pa ebin
$exename -pa ebin
;;
esac

0 comments on commit 90e96e6

Please sign in to comment.