add README.md
This commit is contained in:
parent
f5219bb297
commit
a79f0de942
|
@ -0,0 +1,82 @@
|
||||||
|
|
||||||
|
# ODBC Driver #
|
||||||
|
|
||||||
|
- **very initial implementation of ODBC driver for TAOS
|
||||||
|
|
||||||
|
- **currently partially supported ODBC functions are: `
|
||||||
|
SQLAllocEnv
|
||||||
|
SQLFreeEnv
|
||||||
|
SQLAllocConnect
|
||||||
|
SQLFreeConnect
|
||||||
|
SQLConnect
|
||||||
|
SQLDisconnect
|
||||||
|
SQLAllocStmt
|
||||||
|
SQLAllocHandle
|
||||||
|
SQLFreeStmt
|
||||||
|
SQLExecDirect
|
||||||
|
SQLExecDirectW
|
||||||
|
SQLNumResultCols
|
||||||
|
SQLRowCount
|
||||||
|
SQLColAttribute
|
||||||
|
SQLGetData
|
||||||
|
SQLFetch
|
||||||
|
SQLPrepare
|
||||||
|
SQLExecute
|
||||||
|
SQLGetDiagField
|
||||||
|
SQLGetDiagRec
|
||||||
|
SQLBindParameter
|
||||||
|
SQLDriverConnect
|
||||||
|
SQLSetConnectAttr
|
||||||
|
SQLDescribeCol
|
||||||
|
SQLNumParams
|
||||||
|
SQLSetStmtAttr
|
||||||
|
`
|
||||||
|
|
||||||
|
- **internationalized, you can specify different charset/code page for easy going. eg.: insert `utf-8.zh_cn` characters into database located in linux machine, while query them out in `gb2312/gb18030/...` code page in your chinese windows machine, or vice-versa. and much fun, insert `gb2312/gb18030/...` characters into database located in linux box from
|
||||||
|
your japanese windows box, and query them out in your local chinese windows machine.
|
||||||
|
|
||||||
|
- **enable ODBC-aware software to communicate with TAOS.
|
||||||
|
|
||||||
|
- **enable any language with ODBC-bindings/ODBC-plugings to communicate with TAOS
|
||||||
|
|
||||||
|
- **still going on...
|
||||||
|
|
||||||
|
# Building and Testing
|
||||||
|
**Note**: all `work` is done in TDengine's project directory
|
||||||
|
|
||||||
|
|
||||||
|
# Building under Linux, use Ubuntu as example
|
||||||
|
```
|
||||||
|
sudo apt install unixodbc unixodbc-dev flex
|
||||||
|
rm -rf debug && cmake -B debug && cmake --build debug && cmake --install debug && echo yes
|
||||||
|
```
|
||||||
|
# Building under Windows, use Windows 10 as example
|
||||||
|
- install windows `flex` port. We use [https://github.com/lexxmark/winflexbison](url) at the moment. Please be noted to append `<path_to_win_flex.exe>` to your `PATH`.
|
||||||
|
- install Microsoft Visual Studio, take VS2015 as example here
|
||||||
|
- `"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64`
|
||||||
|
- `rmdir /s /q debug`
|
||||||
|
- `cmake -G "NMake Makefiles" -B debug`
|
||||||
|
- `cmake --build debug`
|
||||||
|
- `cmake --install debug`
|
||||||
|
- open your `Command Prompt` with Administrator's privilidge
|
||||||
|
- remove previously installed TAOS ODBC driver: run `C:\TDengine\todbcinst -u -f -n TAOS`
|
||||||
|
- install TAOS ODBC driver that was just built: run `C:\TDengine\todbcinst -i -n TAOS -p C:\TDengine\driver`
|
||||||
|
|
||||||
|
# Test
|
||||||
|
we highly suggest that you build both in linux(ubuntu) and windows(windows 10) platform, because currently TAOS only has it's server-side port on linux platform.
|
||||||
|
**Note1**: content within <> shall be modified to match your environment
|
||||||
|
**Note2**: `.stmts` source files are all encoded in `UTF-8`
|
||||||
|
## start taosd in linux, suppose charset is `UTF-8` as default
|
||||||
|
```
|
||||||
|
taosd -c ./debug/test/cfg
|
||||||
|
```
|
||||||
|
## create data in linux
|
||||||
|
```
|
||||||
|
./debug/build/bin/tcodbc 'Driver=TAOS;UID=<uid>;PWD=<pwd>;Host=<fqdn>:6030;server_enc=UTF-8' ./src/connector/odbc/tests/create_data.stmts
|
||||||
|
```
|
||||||
|
## query data in windows
|
||||||
|
```
|
||||||
|
.\debug\build\bin\tcodbc "Driver=TAOS;UID=<uid>;PWD=<pwd>;Host=<fqdn>:6030;server_enc=UTF-8" .\src\connector\odbc\tests\query_data.stmts
|
||||||
|
```
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,10 @@
|
||||||
do { \
|
do { \
|
||||||
D("testing: %s", #statement); \
|
D("testing: %s", #statement); \
|
||||||
int r = (statement); \
|
int r = (statement); \
|
||||||
if (r) return 1; \
|
if (r) { \
|
||||||
|
D("testing failed: %s", #statement); \
|
||||||
|
return 1; \
|
||||||
|
} \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
|
|
||||||
|
@ -543,6 +546,7 @@ int main(int argc, char *argv[]) {
|
||||||
CHK_TEST(test_sqls(dsn, uid, pwd, connstr, sqls));
|
CHK_TEST(test_sqls(dsn, uid, pwd, connstr, sqls));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
D("Done!");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,8 @@ static int do_install(int i, int argc, char *argv[]) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "ODBC driver [%s] has been installed in [%s], and UsageCount is now [%d]\n",
|
||||||
|
driverName, driverPath, usageCount);
|
||||||
return argc;
|
return argc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,8 +154,12 @@ static int do_uninstall(int i, int argc, char *argv[]) {
|
||||||
fprintf(stderr, "failed to remove driver [%s]\n", driverName);
|
fprintf(stderr, "failed to remove driver [%s]\n", driverName);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!forceful) return argc;
|
if (!forceful) {
|
||||||
|
fprintf(stderr, "UsageCount for ODBC driver [%s] is now: [%d]\n", driverName, usageCount);
|
||||||
|
return argc;
|
||||||
|
}
|
||||||
} while (usageCount > 0);
|
} while (usageCount > 0);
|
||||||
|
fprintf(stderr, "ODBC driver [%s] is now fully uninstalled\n", driverName);
|
||||||
return argc;
|
return argc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue