Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for directly providing ODBC DNS #28

Closed
wants to merge 68 commits into from

Conversation

blumf
Copy link
Contributor

@blumf blumf commented Jan 27, 2015

A new way of using the env.connect method, providing a table of options.

In this case, the old method can now be used as:
env.connect{ user = "foo", password = "bar", source = "My DB DSN from odbcad32" }

But also, a DSN can be provided:
env.connect{ dsn = [[DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};PWD=bar;DBQ=C:\path\my_db.mdb]] }

A new way of using the env.connect method, providing a table of options.

In this case, the old method can now be used as:
env.connect{ user = "foo", password = "bar", source = "My DB DSN from odbcad32" }

But also, a DSN can be provided:
env.connect{ dsn = [[DRIVER={Microsoft Access Driver (*.mdb, *.accdb)};PWD=bar;DBQ=C:\path\my_db.mdb]] }
@blumf blumf mentioned this pull request Jan 27, 2015
blumf added 28 commits April 9, 2015 12:42
Changed readme file to match project's intentions and use markdown
Just some stuff to save typing when pulling info from tables
Mainly just to shut up MSVC compiler
Firebird driver now uses connection info table for opening up
connections. Next step will involve adding support for optional
parameters
When requiring a driver, it will search for other LuaSQL drivers already
loaded and use that table to place their environment function in. i.e.

```
luasql = require"luasql.odbc"
luasql = require"luasql.mysql"
```

Results in both drivers being available via the luasql table
Connection charset can now be selected for Firebird, defaults to 'UTF8'
These may end up in the wider LuaSQL API, plus their current name made
them look like official Lua API
Mass of refactoring and other work, but the Firebird driver now has
prepared statements.
No ability to set parameters yet though.
Now specify the SQL dialect via a connection parameter
Avoid potential buffer overrun from connection parameters
Both connection and statement objects now accept parameters being passed
to their execute method
Handling of cursor state and it's relation to statements is laid out
properly
Statements now check if any open cursors are depending on it and
properly releases itself from the connection
Close statements on conn:execute when they don't return cursors
Also some minor fixes/tidy
Convert date stamps to unambiguous YYYY-MM-DD format also supported by
Firebird (e.g. value can be passed as a param)
As well as timestamp strings, parameters can handle values returned from
os.time()
Too much repetition of code, slimmed it down
When a cursor created from a direct con:execute call closes, the
associated statement wasn't closed until garbage collection. Now
flagging those internal statements so they can be forced closed with the
cursor
Didn't make much sense to use a short just to hold a bool value (and
can't rely on <stdbool.h> existing)
Forgot luasql_tostring relies on the layout of the structs starting with
short
Reducing the line count
Neater layout to the ODBC driver's connect function
Opening up the struct and metatable for statements in ODBC
Mainly always use braces
blumf added 25 commits April 23, 2015 18:11
Bit more flexible and clear, should be a quick copy/paste for other
drivers
Was written after it's calling function
Connection details table support in
Using the following command:
astyle --style=1tbs --indent=tab=5 --align-pointer=name --align-reference=name --max-code-length=80 --lineend=linux ls_firebird.c
Then tidied up a bit
Using the following command:
astyle --style=1tbs --indent=tab=5 --align-pointer=name --align-reference=name --max-code-length=80 --lineend=linux ls_firebird.c
Then tidied up a bit
Using the following command:
astyle --style=1tbs --indent=tab=5 --align-pointer=name --align-reference=name --max-code-length=80 --lineend=linux ls_mysql.c
Then tidied up a bit
Not 100% on this, ideally we'd want the lowest common denominator, but for now it avoids some warnings (e.g. no 'long long' and 'snprintf' support in plain ANSI)
Also bumped the version in the makefile to 3.0.0
astyle --style=1tbs --indent=tab=5 --align-pointer=name --align-reference=name --max-code-length=80 --lineend=linux ls_sqlite.c ls_sqlite3.c
Plus, making sure the Firebird drive compiles under Linux
Basic struct and metadata entries
There are different ways to register libs on Lua between 5.1 and 5.3.
Lua 5.1 support is handy because LuaJIT stuck with the 5.1 API
Handy to be able to find out what's available to use
Technically these should been here for the function decs
The old version was a bit clunky; required editing the config file to
compile different drivers, and didn't support passing alt parameters
(include/lib dirs) from the command line.
Compiles but untested
Issues with integer sizes differing between 32 & 64-bit archs
(same as committed to Kepler root, but the code is far to different to merge now)
@blumf blumf mentioned this pull request Jul 1, 2016
- - -

## LuaSQL 3.0.0 [09/Apr/2015]
This is a proposed branch to add much needed features
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not qualified to comment on the LuaSQL codebase, but...
Should this type of comments be merged into the README? These "proposed" comments here seem appropriate for the PR text, not to the user-facing documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, shouldn't have been there. I'll redo the pull req neater next week.

@blumf
Copy link
Contributor Author

blumf commented Jul 4, 2016

See new pull #54 using minimal changeset

@blumf blumf closed this Jul 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants