|
|
| version 1.31, 2008/07/01 08:56:06 | version 1.32, 2008/07/01 10:21:03 |
|---|---|
| Line 116 public: | Line 116 public: |
| size_t url_length=strlen(url); | size_t url_length=strlen(url); |
| char *options=lsplit(url, '?'); | char *options=lsplit(url, '?'); |
| // todo: analize connect string and if 'SQL Server' found, modify query and add TOP into SELECTs | |
| while(options){ | while(options){ |
| if(char *key=lsplit(&options, '&')){ | if(char *key=lsplit(&options, '&')){ |
| if(*key){ | if(*key){ |
| Line 140 public: | Line 142 public: |
| TRY { | TRY { |
| connection.db=new CDatabase(); | connection.db=new CDatabase(); |
| connection.db->OpenEx(url, CDatabase::noOdbcDialog); | connection.db->OpenEx(url, CDatabase::noOdbcDialog); |
| connection.db->BeginTrans(); | |
| if(!connection.autocommit) | |
| connection.db->BeginTrans(); | |
| } | } |
| CATCH_ALL (e) { | CATCH_ALL (e) { |
| _throw(services, e); | _throw(services, e); |
| Line 163 public: | Line 163 public: |
| void commit(void *aconnection){ | void commit(void *aconnection){ |
| Connection& connection=*static_cast<Connection*>(aconnection); | Connection& connection=*static_cast<Connection*>(aconnection); |
| if(!connection.autocommit){ | TRY |
| TRY | connection.db->CommitTrans(); |
| connection.db->CommitTrans(); | connection.db->BeginTrans(); |
| connection.db->BeginTrans(); | CATCH_ALL (e) { |
| CATCH_ALL (e) { | _throw(*connection.services, e); |
| _throw(*connection.services, e); | |
| } | |
| END_CATCH_ALL | |
| } | } |
| END_CATCH_ALL | |
| } | } |
| void rollback(void *aconnection){ | void rollback(void *aconnection){ |
| Connection& connection=*static_cast<Connection*>(aconnection); | Connection& connection=*static_cast<Connection*>(aconnection); |
| if(!connection.autocommit){ | TRY |
| TRY | connection.db->Rollback(); |
| connection.db->Rollback(); | connection.db->BeginTrans(); |
| connection.db->BeginTrans(); | CATCH_ALL (e) { |
| CATCH_ALL (e) { | _throw(*connection.services, e); |
| _throw(*connection.services, e); | |
| } | |
| END_CATCH_ALL | |
| } | } |
| END_CATCH_ALL | |
| } | } |
| bool ping(void *connection){ | bool ping(void *connection){ |
| Line 317 public: | Line 313 public: |
| break; | break; |
| default: | default: |
| transcode_column[i]=transcode_needed; | transcode_column[i]=transcode_needed; |
| break; | |
| } | } |
| size_t length=fieldinfo.m_strName.GetLength(); | size_t length=fieldinfo.m_strName.GetLength(); |
| char *str=0; | char *str=0; |
| Line 344 public: | Line 340 public: |
| rs.Move(offset); | rs.Move(offset); |
| } else { | } else { |
| unsigned long row=offset; | unsigned long row=offset; |
| while(!rs.IsEOF() && row>0){ | while(!rs.IsEOF() && row--) |
| rs.MoveNext(); | rs.MoveNext(); |
| row--; | |
| } | |
| } | } |
| } | } |
| Line 398 public: | Line 392 public: |
| } CATCH_ALL (e) { | } CATCH_ALL (e) { |
| _throw(services, e); | _throw(services, e); |
| } END_CATCH_ALL | } END_CATCH_ALL |
| if(connection.autocommit) | |
| commit(aconnection); | |
| } | } |
| private: | private: |
| Line 422 private: | Line 419 private: |
| ptr=v.m_boolVal?"1":"0"; | ptr=v.m_boolVal?"1":"0"; |
| length=1; | length=1; |
| break;*/ | break;*/ |
| /* case DBVT_UCHAR: | /* case DBVT_UCHAR: |
| length=strlen(ptr=v.m_chVal); | length=strlen(ptr=v.m_chVal); |
| break; | break; |
| case DBVT_SHORT: | case DBVT_SHORT: |
| Line 493 private: | Line 490 private: |
| services._throw(msg); | services._throw(msg); |
| } | } |
| void _throw(Connection& connection, long value){ | |
| char msg[MAX_STRING]; | |
| snprintf(msg, MAX_STRING, "%u", value); | |
| connection.services->_throw(msg); | |
| } | |
| }; | }; |
| extern "C" SQL_Driver *SQL_DRIVER_CREATE() { | extern "C" SQL_Driver *SQL_DRIVER_CREATE() { |