#include <switch.h>Include dependency graph for switch_odbc.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
| #define DEFAULT_ODBC_RETRIES 120 |
| #define switch_odbc_handle_callback_exec | ( | handle, | |||
| sql, | |||||
| callback, | |||||
| pdata, | |||||
| err | ) |
Value:
switch_odbc_handle_callback_exec_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, \ handle, sql, callback, pdata, err)
| handle | the ODBC handle | |
| sql | the sql string to execute | |
| callback | the callback function to execute | |
| pdata | the state data passed on each callback invocation |
Definition at line 92 of file switch_odbc.h.
Referenced by switch_cache_db_execute_sql_callback().
| typedef void* switch_odbc_statement_handle_t |
Definition at line 39 of file switch_odbc.h.
| enum switch_odbc_state_t |
| SWITCH_ODBC_STATE_INIT | |
| SWITCH_ODBC_STATE_DOWN | |
| SWITCH_ODBC_STATE_CONNECTED | |
| SWITCH_ODBC_STATE_ERROR |
Definition at line 42 of file switch_odbc.h.
00042 { 00043 SWITCH_ODBC_STATE_INIT, 00044 SWITCH_ODBC_STATE_DOWN, 00045 SWITCH_ODBC_STATE_CONNECTED, 00046 SWITCH_ODBC_STATE_ERROR 00047 } switch_odbc_state_t;
| enum switch_odbc_status_t |
Definition at line 49 of file switch_odbc.h.
00049 { 00050 SWITCH_ODBC_SUCCESS = 0, 00051 SWITCH_ODBC_FAIL = -1 00052 } switch_odbc_status_t;
| switch_bool_t switch_odbc_available | ( | void | ) |
Definition at line 710 of file switch_odbc.c.
References SWITCH_FALSE, and SWITCH_TRUE.
Referenced by _switch_cache_db_get_db_handle(), and switch_load_core_config().
00711 { 00712 #ifdef SWITCH_HAVE_ODBC 00713 return SWITCH_TRUE; 00714 #else 00715 return SWITCH_FALSE; 00716 #endif 00717 }
| int switch_odbc_handle_affected_rows | ( | switch_odbc_handle_t * | handle | ) |
Definition at line 701 of file switch_odbc.c.
Referenced by switch_cache_db_affected_rows().
00702 { 00703 #ifdef SWITCH_HAVE_ODBC 00704 return handle->affected_rows; 00705 #else 00706 return 0; 00707 #endif 00708 }
| switch_odbc_status_t switch_odbc_handle_callback_exec_detailed | ( | const char * | file, | |
| const char * | func, | |||
| int | line, | |||
| switch_odbc_handle_t * | handle, | |||
| const char * | sql, | |||
| switch_core_db_callback_func_t | callback, | |||
| void * | pdata, | |||
| char ** | err | |||
| ) |
Execute the sql query and issue a callback for each row returned.
| file | the file from which this function is called | |
| func | the function from which this function is called | |
| line | the line from which this function is called | |
| handle | the ODBC handle | |
| sql | the sql string to execute | |
| callback | the callback function to execute | |
| pdata | the state data passed on each callback invocation |
Definition at line 512 of file switch_odbc.c.
References switch_assert, SWITCH_CHANNEL_ID_LOG, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_ODBC_FAIL, switch_odbc_handle_get_error(), SWITCH_ODBC_SUCCESS, switch_str_nil, and zstr.
00516 { 00517 #ifdef SWITCH_HAVE_ODBC 00518 SQLHSTMT stmt = NULL; 00519 SQLSMALLINT c = 0, x = 0; 00520 SQLLEN m = 0; 00521 char *x_err = NULL, *err_str = NULL; 00522 int result; 00523 int err_cnt = 0; 00524 int done = 0; 00525 00526 handle->affected_rows = 0; 00527 00528 switch_assert(callback != NULL); 00529 00530 if (!db_is_up(handle)) { 00531 x_err = "DB is not up!"; 00532 goto error; 00533 } 00534 00535 if (SQLAllocHandle(SQL_HANDLE_STMT, handle->con, &stmt) != SQL_SUCCESS) { 00536 x_err = "Unable to SQL allocate handle!"; 00537 goto error; 00538 } 00539 00540 if (SQLPrepare(stmt, (unsigned char *) sql, SQL_NTS) != SQL_SUCCESS) { 00541 x_err = "Unable to prepare SQL statement!"; 00542 goto error; 00543 } 00544 00545 result = SQLExecute(stmt); 00546 00547 if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO && result != SQL_NO_DATA) { 00548 x_err = "execute error!"; 00549 goto error; 00550 } 00551 00552 SQLNumResultCols(stmt, &c); 00553 SQLRowCount(stmt, &m); 00554 handle->affected_rows = (int) m; 00555 00556 00557 while (!done) { 00558 int name_len = 256; 00559 char **names; 00560 char **vals; 00561 int y = 0; 00562 00563 result = SQLFetch(stmt); 00564 00565 if (result != SQL_SUCCESS) { 00566 if (result != SQL_NO_DATA) { 00567 err_cnt++; 00568 } 00569 break; 00570 } 00571 00572 names = calloc(c, sizeof(*names)); 00573 vals = calloc(c, sizeof(*vals)); 00574 00575 switch_assert(names && vals); 00576 00577 for (x = 1; x <= c; x++) { 00578 SQLSMALLINT NameLength = 0, DataType = 0, DecimalDigits = 0, Nullable = 0; 00579 SQLULEN ColumnSize = 0; 00580 names[y] = malloc(name_len); 00581 memset(names[y], 0, name_len); 00582 00583 SQLDescribeCol(stmt, x, (SQLCHAR *) names[y], (SQLSMALLINT) name_len, &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable); 00584 00585 if (!ColumnSize) { 00586 ColumnSize = 255; 00587 } 00588 ColumnSize++; 00589 00590 vals[y] = malloc(ColumnSize); 00591 memset(vals[y], 0, ColumnSize); 00592 SQLGetData(stmt, x, SQL_C_CHAR, (SQLCHAR *) vals[y], ColumnSize, NULL); 00593 y++; 00594 } 00595 00596 if (callback(pdata, y, vals, names)) { 00597 done = 1; 00598 } 00599 00600 for (x = 0; x < y; x++) { 00601 free(names[x]); 00602 free(vals[x]); 00603 } 00604 free(names); 00605 free(vals); 00606 } 00607 00608 SQLFreeHandle(SQL_HANDLE_STMT, stmt); 00609 stmt = NULL; /* Make sure we don't try to free this handle again */ 00610 00611 if (!err_cnt) { 00612 return SWITCH_ODBC_SUCCESS; 00613 } 00614 00615 error: 00616 00617 if (stmt) { 00618 err_str = switch_odbc_handle_get_error(handle, stmt); 00619 } 00620 00621 if (zstr(err_str) && !zstr(x_err)) { 00622 err_str = strdup(x_err); 00623 } 00624 00625 if (err_str) { 00626 switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str)); 00627 if (err) { 00628 *err = err_str; 00629 } else { 00630 free(err_str); 00631 } 00632 } 00633 00634 if (stmt) { 00635 SQLFreeHandle(SQL_HANDLE_STMT, stmt); 00636 } 00637 00638 00639 #endif 00640 return SWITCH_ODBC_FAIL; 00641 }
| switch_odbc_status_t switch_odbc_handle_connect | ( | switch_odbc_handle_t * | handle | ) |
Definition at line 333 of file switch_odbc.c.
References SWITCH_CHANNEL_LOG, SWITCH_FALSE, SWITCH_LOG_DEBUG1, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_ODBC_FAIL, switch_odbc_handle_disconnect(), switch_odbc_handle_get_error(), SWITCH_ODBC_STATE_CONNECTED, SWITCH_TRUE, and TRUE.
Referenced by _switch_cache_db_get_db_handle().
00334 { 00335 #ifdef SWITCH_HAVE_ODBC 00336 int result; 00337 SQLINTEGER err; 00338 int16_t mlen; 00339 unsigned char msg[200], stat[10]; 00340 SQLSMALLINT valueLength = 0; 00341 int i = 0; 00342 00343 init_odbc_handles(handle, SWITCH_FALSE); /* Init ODBC handles, if they are already initialized, don't do it again */ 00344 00345 if (handle->state == SWITCH_ODBC_STATE_CONNECTED) { 00346 switch_odbc_handle_disconnect(handle); 00347 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Re-connecting %s\n", handle->dsn); 00348 } 00349 00350 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Connecting %s\n", handle->dsn); 00351 00352 if (!strstr(handle->dsn, "DRIVER")) { 00353 result = SQLConnect(handle->con, (SQLCHAR *) handle->dsn, SQL_NTS, (SQLCHAR *) handle->username, SQL_NTS, (SQLCHAR *) handle->password, SQL_NTS); 00354 } else { 00355 SQLCHAR outstr[1024] = { 0 }; 00356 SQLSMALLINT outstrlen = 0; 00357 result = 00358 SQLDriverConnect(handle->con, NULL, (SQLCHAR *) handle->dsn, (SQLSMALLINT) strlen(handle->dsn), outstr, sizeof(outstr), &outstrlen, 00359 SQL_DRIVER_NOPROMPT); 00360 } 00361 00362 if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) { 00363 char *err_str; 00364 if ((err_str = switch_odbc_handle_get_error(handle, NULL))) { 00365 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "%s\n", err_str); 00366 free(err_str); 00367 } else { 00368 SQLGetDiagRec(SQL_HANDLE_DBC, handle->con, 1, stat, &err, msg, 100, &mlen); 00369 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error SQLConnect=%d errno=%d %s\n", result, (int) err, msg); 00370 } 00371 00372 /* Deallocate handles again, more chanses to succeed when reconnecting */ 00373 init_odbc_handles(handle, SWITCH_TRUE); /* Reinit ODBC handles */ 00374 return SWITCH_ODBC_FAIL; 00375 } 00376 00377 result = SQLGetInfo(handle->con, SQL_DRIVER_NAME, (SQLCHAR *) handle->odbc_driver, 255, &valueLength); 00378 if (result == SQL_SUCCESS || result == SQL_SUCCESS_WITH_INFO) { 00379 for (i = 0; i < valueLength; ++i) 00380 handle->odbc_driver[i] = (char) toupper(handle->odbc_driver[i]); 00381 } 00382 00383 if (strstr(handle->odbc_driver, "FIREBIRD") != 0 || strstr(handle->odbc_driver, "FB32") != 0 || strstr(handle->odbc_driver, "FB64") != 0) { 00384 handle->is_firebird = TRUE; 00385 } else { 00386 handle->is_firebird = FALSE; 00387 } 00388 00389 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Connected to [%s]\n", handle->dsn); 00390 handle->state = SWITCH_ODBC_STATE_CONNECTED; 00391 return SWITCH_ODBC_SUCCESS; 00392 #else 00393 return SWITCH_ODBC_FAIL; 00394 #endif 00395 }
| void switch_odbc_handle_destroy | ( | switch_odbc_handle_t ** | handlep | ) |
Definition at line 643 of file switch_odbc.c.
References switch_odbc_handle_disconnect(), and switch_safe_free.
Referenced by _switch_cache_db_get_db_handle(), and sql_close().
00644 { 00645 #ifdef SWITCH_HAVE_ODBC 00646 00647 switch_odbc_handle_t *handle = NULL; 00648 00649 if (!handlep) { 00650 return; 00651 } 00652 handle = *handlep; 00653 00654 if (handle) { 00655 switch_odbc_handle_disconnect(handle); 00656 00657 if (handle->env != SQL_NULL_HANDLE) { 00658 SQLFreeHandle(SQL_HANDLE_DBC, handle->con); 00659 SQLFreeHandle(SQL_HANDLE_ENV, handle->env); 00660 } 00661 switch_safe_free(handle->dsn); 00662 switch_safe_free(handle->username); 00663 switch_safe_free(handle->password); 00664 free(handle); 00665 } 00666 *handlep = NULL; 00667 #else 00668 return; 00669 #endif 00670 }
| switch_odbc_status_t switch_odbc_handle_disconnect | ( | switch_odbc_handle_t * | handle | ) |
Definition at line 118 of file switch_odbc.c.
References SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_ODBC_FAIL, SWITCH_ODBC_STATE_CONNECTED, SWITCH_ODBC_STATE_DOWN, and SWITCH_ODBC_SUCCESS.
Referenced by switch_odbc_handle_connect(), and switch_odbc_handle_destroy().
00119 { 00120 #ifdef SWITCH_HAVE_ODBC 00121 00122 int result; 00123 00124 if (!handle) { 00125 return SWITCH_ODBC_FAIL; 00126 } 00127 00128 if (handle->state == SWITCH_ODBC_STATE_CONNECTED) { 00129 result = SQLDisconnect(handle->con); 00130 if (result == SWITCH_ODBC_SUCCESS) { 00131 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG10, "Disconnected %d from [%s]\n", result, handle->dsn); 00132 } else { 00133 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Disconnecting [%s]\n", handle->dsn); 00134 } 00135 } 00136 00137 handle->state = SWITCH_ODBC_STATE_DOWN; 00138 00139 return SWITCH_ODBC_SUCCESS; 00140 #else 00141 return SWITCH_ODBC_FAIL; 00142 #endif 00143 }
| switch_odbc_status_t switch_odbc_handle_exec | ( | switch_odbc_handle_t * | handle, | |
| const char * | sql, | |||
| switch_odbc_statement_handle_t * | rstmt, | |||
| char ** | err | |||
| ) |
Definition at line 441 of file switch_odbc.c.
References SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, switch_log_printf(), SWITCH_ODBC_FAIL, switch_odbc_handle_get_error(), SWITCH_ODBC_SUCCESS, switch_str_nil, switch_stristr(), and zstr.
Referenced by switch_cache_db_execute_sql_real(), switch_cache_db_test_reactive(), and switch_odbc_handle_exec_string().
00443 { 00444 #ifdef SWITCH_HAVE_ODBC 00445 SQLHSTMT stmt = NULL; 00446 int result; 00447 char *err_str = NULL; 00448 SQLLEN m = 0; 00449 00450 handle->affected_rows = 0; 00451 00452 if (!db_is_up(handle)) { 00453 goto error; 00454 } 00455 00456 if (SQLAllocHandle(SQL_HANDLE_STMT, handle->con, &stmt) != SQL_SUCCESS) { 00457 goto error; 00458 } 00459 00460 if (SQLPrepare(stmt, (unsigned char *) sql, SQL_NTS) != SQL_SUCCESS) { 00461 goto error; 00462 } 00463 00464 result = SQLExecute(stmt); 00465 00466 if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO && result != SQL_NO_DATA) { 00467 goto error; 00468 } 00469 00470 SQLRowCount(stmt, &m); 00471 handle->affected_rows = (int) m; 00472 00473 if (rstmt) { 00474 *rstmt = stmt; 00475 } else { 00476 SQLFreeHandle(SQL_HANDLE_STMT, stmt); 00477 } 00478 00479 return SWITCH_ODBC_SUCCESS; 00480 00481 error: 00482 00483 00484 if (stmt) { 00485 err_str = switch_odbc_handle_get_error(handle, stmt); 00486 } 00487 00488 if (zstr(err_str)) { 00489 err_str = strdup((char *)"SQL ERROR!"); 00490 } 00491 00492 if (err_str) { 00493 if (!switch_stristr("already exists", err_str) && !switch_stristr("duplicate key name", err_str)) { 00494 switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "ERR: [%s]\n[%s]\n", sql, switch_str_nil(err_str)); 00495 } 00496 if (err) { 00497 *err = err_str; 00498 } else { 00499 free(err_str); 00500 } 00501 } 00502 00503 if (rstmt) { 00504 *rstmt = stmt; 00505 } else if (stmt) { 00506 SQLFreeHandle(SQL_HANDLE_STMT, stmt); 00507 } 00508 #endif 00509 return SWITCH_ODBC_FAIL; 00510 }
| switch_odbc_status_t switch_odbc_handle_exec_string | ( | switch_odbc_handle_t * | handle, | |
| const char * | sql, | |||
| char * | resbuf, | |||
| size_t | len, | |||
| char ** | err | |||
| ) |
Definition at line 397 of file switch_odbc.c.
References SWITCH_ODBC_FAIL, switch_odbc_handle_exec(), switch_odbc_statement_handle_free(), and SWITCH_ODBC_SUCCESS.
Referenced by switch_cache_db_execute_sql2str().
00398 { 00399 #ifdef SWITCH_HAVE_ODBC 00400 switch_odbc_status_t sstatus = SWITCH_ODBC_FAIL; 00401 switch_odbc_statement_handle_t stmt = NULL; 00402 SQLCHAR name[1024]; 00403 SQLLEN m = 0; 00404 00405 handle->affected_rows = 0; 00406 00407 if (switch_odbc_handle_exec(handle, sql, &stmt, err) == SWITCH_ODBC_SUCCESS) { 00408 SQLSMALLINT NameLength, DataType, DecimalDigits, Nullable; 00409 SQLULEN ColumnSize; 00410 int result; 00411 00412 SQLRowCount(stmt, &m); 00413 handle->affected_rows = (int) m; 00414 00415 if (m <= 0) { 00416 goto done; 00417 } 00418 00419 result = SQLFetch(stmt); 00420 00421 if (result != SQL_SUCCESS && result != SQL_SUCCESS_WITH_INFO && result != SQL_NO_DATA) { 00422 goto done; 00423 } 00424 00425 SQLDescribeCol(stmt, 1, name, sizeof(name), &NameLength, &DataType, &ColumnSize, &DecimalDigits, &Nullable); 00426 SQLGetData(stmt, 1, SQL_C_CHAR, (SQLCHAR *) resbuf, (SQLLEN) len, NULL); 00427 00428 sstatus = SWITCH_ODBC_SUCCESS; 00429 } 00430 00431 done: 00432 00433 switch_odbc_statement_handle_free(&stmt); 00434 00435 return sstatus; 00436 #else 00437 return SWITCH_ODBC_FAIL; 00438 #endif 00439 }
| char* switch_odbc_handle_get_error | ( | switch_odbc_handle_t * | handle, | |
| switch_odbc_statement_handle_t | stmt | |||
| ) |
Definition at line 681 of file switch_odbc.c.
References switch_mprintf().
Referenced by switch_odbc_handle_callback_exec_detailed(), switch_odbc_handle_connect(), and switch_odbc_handle_exec().
00682 { 00683 #ifdef SWITCH_HAVE_ODBC 00684 00685 char buffer[SQL_MAX_MESSAGE_LENGTH + 1] = ""; 00686 char sqlstate[SQL_SQLSTATE_SIZE + 1] = ""; 00687 SQLINTEGER sqlcode; 00688 SQLSMALLINT length; 00689 char *ret = NULL; 00690 00691 if (SQLError(handle->env, handle->con, stmt, (SQLCHAR *) sqlstate, &sqlcode, (SQLCHAR *) buffer, sizeof(buffer), &length) == SQL_SUCCESS) { 00692 ret = switch_mprintf("STATE: %s CODE %ld ERROR: %s\n", sqlstate, sqlcode, buffer); 00693 }; 00694 00695 return ret; 00696 #else 00697 return NULL; 00698 #endif 00699 }
| switch_odbc_state_t switch_odbc_handle_get_state | ( | switch_odbc_handle_t * | handle | ) |
Definition at line 672 of file switch_odbc.c.
References SWITCH_ODBC_STATE_ERROR, and SWITCH_ODBC_STATE_INIT.
00673 { 00674 #ifdef SWITCH_HAVE_ODBC 00675 return handle ? handle->state : SWITCH_ODBC_STATE_INIT; 00676 #else 00677 return SWITCH_ODBC_STATE_ERROR; 00678 #endif 00679 }
| switch_odbc_handle_t* switch_odbc_handle_new | ( | const char * | dsn, | |
| const char * | username, | |||
| const char * | password | |||
| ) |
Definition at line 64 of file switch_odbc.c.
References DEFAULT_ODBC_RETRIES, SWITCH_ODBC_STATE_INIT, and switch_safe_free.
Referenced by _switch_cache_db_get_db_handle().
00065 { 00066 #ifdef SWITCH_HAVE_ODBC 00067 switch_odbc_handle_t *new_handle; 00068 00069 if (!(new_handle = malloc(sizeof(*new_handle)))) { 00070 goto err; 00071 } 00072 00073 memset(new_handle, 0, sizeof(*new_handle)); 00074 00075 if (!(new_handle->dsn = strdup(dsn))) { 00076 goto err; 00077 } 00078 00079 if (username) { 00080 if (!(new_handle->username = strdup(username))) { 00081 goto err; 00082 } 00083 } 00084 00085 if (password) { 00086 if (!(new_handle->password = strdup(password))) { 00087 goto err; 00088 } 00089 } 00090 00091 new_handle->env = SQL_NULL_HANDLE; 00092 new_handle->state = SWITCH_ODBC_STATE_INIT; 00093 new_handle->affected_rows = 0; 00094 new_handle->num_retries = DEFAULT_ODBC_RETRIES; 00095 00096 return new_handle; 00097 00098 err: 00099 if (new_handle) { 00100 switch_safe_free(new_handle->dsn); 00101 switch_safe_free(new_handle->username); 00102 switch_safe_free(new_handle->password); 00103 switch_safe_free(new_handle); 00104 } 00105 #endif 00106 return NULL; 00107 }
| void switch_odbc_set_num_retries | ( | switch_odbc_handle_t * | handle, | |
| int | num_retries | |||
| ) |
Definition at line 109 of file switch_odbc.c.
00110 { 00111 #ifdef SWITCH_HAVE_ODBC 00112 if (handle) { 00113 handle->num_retries = num_retries; 00114 } 00115 #endif 00116 }
| switch_odbc_status_t switch_odbc_SQLEndTran | ( | switch_odbc_handle_t * | handle, | |
| switch_bool_t | commit | |||
| ) |
Definition at line 732 of file switch_odbc.c.
References SWITCH_FALSE.
Referenced by switch_cache_db_persistant_execute_trans().
00733 { 00734 #ifdef SWITCH_HAVE_ODBC 00735 if (commit) { 00736 return SQLEndTran(SQL_HANDLE_DBC, handle->con, SQL_COMMIT); 00737 } else { 00738 return SQLEndTran(SQL_HANDLE_DBC, handle->con, SQL_ROLLBACK); 00739 } 00740 #else 00741 return (switch_odbc_status_t) SWITCH_FALSE; 00742 #endif 00743 }
| switch_odbc_status_t switch_odbc_SQLSetAutoCommitAttr | ( | switch_odbc_handle_t * | handle, | |
| switch_bool_t | on | |||
| ) |
Definition at line 719 of file switch_odbc.c.
References SWITCH_FALSE.
Referenced by switch_cache_db_persistant_execute_trans().
00720 { 00721 #ifdef SWITCH_HAVE_ODBC 00722 if (on) { 00723 return SQLSetConnectAttr(handle->con, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER *) SQL_AUTOCOMMIT_ON, 0 ); 00724 } else { 00725 return SQLSetConnectAttr(handle->con, SQL_ATTR_AUTOCOMMIT, (SQLPOINTER *) SQL_AUTOCOMMIT_OFF, 0 ); 00726 } 00727 #else 00728 return (switch_odbc_status_t) SWITCH_FALSE; 00729 #endif 00730 }
| switch_odbc_status_t switch_odbc_statement_handle_free | ( | switch_odbc_statement_handle_t * | stmt | ) |
Definition at line 318 of file switch_odbc.c.
References SWITCH_ODBC_FAIL, and SWITCH_ODBC_SUCCESS.
Referenced by switch_odbc_handle_exec_string().
00319 { 00320 if (!stmt || !*stmt) { 00321 return SWITCH_ODBC_FAIL; 00322 } 00323 #ifdef SWITCH_HAVE_ODBC 00324 SQLFreeHandle(SQL_HANDLE_STMT, *stmt); 00325 *stmt = NULL; 00326 return SWITCH_ODBC_SUCCESS; 00327 #else 00328 return SWITCH_ODBC_FAIL; 00329 #endif 00330 }
1.4.7