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
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
83992a4
Support for directly providing ODBC DNS
blumf Jan 27, 2015
0a69e30
Merge remote-tracking branch 'upstream/master'
blumf Apr 9, 2015
2ab1e68
Update README
blumf Apr 9, 2015
2ce67ee
Bumping version and copyright notes
blumf Apr 9, 2015
c300729
New table helper functions
blumf Apr 9, 2015
0c06ede
Avoided use of strcpy and sprintf
blumf Apr 9, 2015
2a65a4b
Convert Firebird driver to use table for connection
blumf Apr 9, 2015
3e6a06e
All drivers use same table
blumf Apr 9, 2015
862be2a
Connect now supports 'charset'
blumf Apr 10, 2015
c4a5d2f
Document change in comment
blumf Apr 10, 2015
342e875
Renamed functions to avoid confusion
blumf Apr 10, 2015
e3d3898
Firebird driver supports basic prepared statements
blumf Apr 11, 2015
2be82a8
Firebird SQL dialect config
blumf Apr 11, 2015
7aa596e
Protecting against buffer overrun
blumf Apr 15, 2015
cffa10b
Execute now accepts parameters
blumf Apr 16, 2015
9327b23
Proper cursor handling
blumf Apr 16, 2015
b4fd2b4
Proper statement handling
blumf Apr 16, 2015
507fe0c
Close none cursor statements
blumf Apr 16, 2015
36b6a08
Using unambiguous date format
blumf Apr 17, 2015
5b79d90
Parameters now take os.time values
blumf Apr 17, 2015
65bfb3d
Neaten up parameter fill code
blumf Apr 17, 2015
f405cb8
Force close of statements used internally
blumf Apr 17, 2015
7a709dc
Using uchar for holding bool value
blumf Apr 17, 2015
2e20062
Scratch prev commit
blumf Apr 17, 2015
2a4a816
Unified a bunch of memory code
blumf Apr 17, 2015
2eb89ba
Merge branch 'upstream/master'
blumf Apr 17, 2015
1bb7db1
Tidied up ODBC's env:connect functions
blumf Apr 20, 2015
fc1ac8b
Create concept of statements
blumf Apr 20, 2015
8af1e32
Format tidy up
blumf Apr 20, 2015
f7f9169
Move (un)registerobj functions into wider library
blumf Apr 20, 2015
cb62a5e
Using more direct locking
blumf Apr 20, 2015
67ba726
Added con:prepare function
blumf Apr 20, 2015
8b82654
Fixed stmt:close
blumf Apr 20, 2015
1a434d7
Split up ODBC execution steps
blumf Apr 21, 2015
fbb6245
ODBC stmt:execute now runs
blumf Apr 21, 2015
fc220a5
ODBC stmt:getparamtypes function support
blumf Apr 21, 2015
3dd893e
Tidy up recent code changes
blumf Apr 22, 2015
f6ee06d
First stab at ODBC parameter binding
blumf Apr 22, 2015
bc252b2
ODBC con:execute now accepts parameters
blumf Apr 23, 2015
4d90417
ODBC supports NULL & bool params
blumf Apr 23, 2015
6f41ec6
Moved luasql_pushinteger into wider project
blumf Apr 23, 2015
0e770ca
Return whole number for SQL update statements
blumf Apr 23, 2015
22cebe4
ODBC Cursor now closes itself when out of results
blumf Apr 23, 2015
210e800
Better method to fix old connection calls
blumf Apr 23, 2015
d6b8f1a
Function in wrong place
blumf Apr 23, 2015
9241007
MySQL driver supports new env:connect style
blumf Apr 23, 2015
e4e14f4
Tidy up some compiler warnings
blumf Apr 23, 2015
d8702e4
Ran file through beautifier
blumf Apr 25, 2015
be804c6
Ran file through beautifier
blumf Apr 25, 2015
87e0475
Ran file through beautifier
blumf Apr 25, 2015
4edf87b
Using C99 for now
blumf Apr 25, 2015
721822f
Ran file through beautifier
blumf Apr 25, 2015
4f39b91
More tidying
blumf Apr 25, 2015
2c99c56
Created statement object for MySQL driver
blumf Apr 25, 2015
1a6e57a
Sorted out differences between driver reg on 5.1/5.3
blumf Apr 27, 2015
66d924d
Using wrong count in XSQLDA field
blumf Apr 27, 2015
81eb6c1
ODBC function to list available drivers
blumf Apr 30, 2015
817e8ad
More tidying
blumf May 2, 2015
f077127
Progress on the MySQL driver statement support
blumf May 3, 2015
76c4cc3
Merge branch 'MySQL_WIP'
blumf May 3, 2015
c5ad4a3
Added includes to luasql.h
blumf May 4, 2015
0a2c974
Improved *nix makefile
blumf May 4, 2015
28f3b3e
Pre-definition to avoid compiler warning
blumf May 5, 2015
e484b48
MySQL now uses statements directly
blumf May 7, 2015
60d2635
Wasn't creating a new connection object
blumf May 8, 2015
66bbede
Removed unused var
blumf May 8, 2015
8d45355
Merge branch 'master' of https://github.com/keplerproject/luasql
blumf May 26, 2015
2900df6
Platform agnostic column buffers
blumf Jul 31, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 20 additions & 18 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
V= 2.3.0
V= 3.0.0
CONFIG= ./config

include $(CONFIG)

OBJS= src/luasql.o src/ls_$T.o
OBJS= src/luasql.o
SRCS= src/luasql.h src/luasql.c

# list of all driver names
DRIVER_LIST= $(subst src/ls_,,$(basename $(wildcard src/ls_*.c)))

SRCS= src/luasql.h src/luasql.c \
src/ls_firebird.c \
src/ls_postgres.c \
src/ls_odbc.c \
src/ls_oci8.c \
src/ls_mysql.c \
src/ls_sqlite.c \
src/ls_sqlite3.c
# used for help formatting
EMPTY=
SPACE= $(EMPTY) $(EMPTY)

AR= ar rcu
RANLIB= ranlib
all :
@echo "usage: make { $(subst $(SPACE),$(SPACE)|$(SPACE),$(DRIVER_LIST)) }"

# explicity matches against the list of avilable driver names
$(DRIVER_LIST) : % : src/%.so

lib: src/$(LIBNAME)
# builds the specified driver
src/%.so : src/ls_%.c $(OBJS)
$(CC) $(CFLAGS) src/ls_$*.c -o $@ $(LIB_OPTION) $(OBJS) $(DRIVER_INCS_$*) $(DRIVER_LIBS_$*)

src/$(LIBNAME): $(OBJS)
export MACOSX_DEPLOYMENT_TARGET="10.3"; $(CC) $(CFLAGS) -o $@ $(LIB_OPTION) $(OBJS) $(DRIVER_LIBS)
# builds the general LuaSQL functions
$(OBJS) : $(SRCS)
$(CC) $(CFLAGS) -c src/luasql.c -o src/luasql.o

install:
mkdir -p $(LUA_LIBDIR)/luasql
cp src/$(LIBNAME) $(LUA_LIBDIR)/luasql
cp src/*.so $(LUA_LIBDIR)/luasql

jdbc_driver:
cd src/jdbc; make $@

clean:
rm -f src/$(LIBNAME) src/*.o
rm -f src/*.so src/*.o

# $Id: Makefile,v 1.56 2008/05/30 17:21:18 tomas Exp $
20 changes: 0 additions & 20 deletions README

This file was deleted.

25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# LuaSQL 3.0 (proposed)
http://www.keplerproject.org/luasql/
https://github.com/keplerproject/luasql/

LuaSQL is a simple interface from Lua to a DBMS. It enables a Lua program to:

* Connect to ODBC, ADO, Oracle, MySQL, SQLite and PostgreSQL databases;
* Execute arbitrary SQL statements;
* Retrieve results in a row-by-row cursor fashion.

LuaSQL is free software and uses the same license as Lua 5.1.

Source code for LuaSQL can be downloaded from the Kepler Project Github page.

- - -

## 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.

* Prepared statements with parameters
+ Really a major requirement for any DB system that takes data from the web
* More flexible connection method
+ Current method of just passing DB name/path with user name+password is not enough to support the complexities of connecting to a DB
* Explicit handling of BLOB fields (? maybe)
+ It might be useful to handle true binary data from BLOB fields rather than blindly convert them to Lua strings

108 changes: 47 additions & 61 deletions config
Original file line number Diff line number Diff line change
@@ -1,68 +1,54 @@
# $Id: config,v 1.10 2008/05/30 17:21:18 tomas Exp $

# Driver (leave uncommented ONLY the line with the name of the driver)
T= mysql
#T= oci8
#T= odbc
#T= postgres
#T= sqlite
#T=sqlite3
#T=firebird

# Installation directories

# Default prefix
PREFIX = /usr/local

# System's libraries directory (where binary libraries are installed)
LUA_LIBDIR= $(PREFIX)/lib/lua/5.1

# System's lua directory (where Lua libraries are installed)
LUA_DIR= $(PREFIX)/share/lua/5.1

# Lua includes directory
LUA_INC= $(PREFIX)/include
PREFIX ?= /usr

# Lua version number (first and second digits of target version)
LUA_VERSION_NUM= 501
# Lua version and dirs
LUA_SYS_VER ?= 5.2
LUA_LIBDIR ?= $(PREFIX)/lib/lua/$(LUA_SYS_VER)
LUA_DIR ?= $(PREFIX)/share/lua/$(LUA_SYS_VER)
LUA_INC ?= $(PREFIX)/include/lua$(LUA_SYS_VER)

# OS dependent
LIB_OPTION= -shared #for Linux
#LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X

LIBNAME= $T.so

# Compilation parameters
# Driver specific
######## MySQL
#DRIVER_LIBS= -L/usr/local/mysql/lib -lmysqlclient -lz
#DRIVER_INCS= -I/usr/local/mysql/include
DRIVER_LIBS= -L/usr/lib -lmysqlclient -lz
DRIVER_INCS= -I/usr/include/mysql
######## Oracle OCI8
#DRIVER_LIBS= -L/home/oracle/OraHome1/lib -lz -lclntsh
#DRIVER_INCS= -I/home/oracle/OraHome1/rdbms/demo -I/home/oracle/OraHome1/rdbms/public
######## PostgreSQL
#DRIVER_LIBS= -L/usr/local/pgsql/lib -lpq
#DRIVER_INCS= -I/usr/local/pgsql/include/
#DRIVER_LIBS= -L/usr/lib -lpq
#DRIVER_INCS= -I/usr/include/postgresql
######## SQLite
#DRIVER_LIBS= -lsqlite
#DRIVER_INCS=
######## SQLite3
#DRIVER_LIBS= -L/opt/local/lib -lsqlite3
#DRIVER_INCS= -I/opt/local/include
######## ODBC
#DRIVER_LIBS= -L/usr/local/lib -lodbc
#DRIVER_INCS= -DUNIXODBC -I/usr/local/include
######## Firebird
#DRIVER_LIBS= -L/usr/local/firebird -lfbclient
#DRIVER_INCS=

WARN= -Wall -Wmissing-prototypes -Wmissing-declarations -ansi -pedantic
INCS= -I$(LUA_INC)
CFLAGS= -O2 $(WARN) -fPIC $(DRIVER_INCS) $(INCS) -DLUASQL_VERSION_NUMBER='"$V"' $(DEFS)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin) # MacOS
LIB_OPTION ?= -bundle -undefined dynamic_lookup -mmacosx-version-min=10.3
else # Linux/BSD
LIB_OPTION ?= -shared
endif

# driver specific params
# - MySQL
#DRIVER_LIBS_mysql ?= -L/usr/local/mysql/lib -lmysqlclient -lz
#DRIVER_INCS_mysql ?= -I/usr/local/mysql/include
DRIVER_LIBS_mysql ?= -L/usr/lib -lmysqlclient -lz
DRIVER_INCS_mysql ?= -I/usr/include/mysql
# - Oracle OCI8
DRIVER_LIBS_oci8 ?= -L/home/oracle/OraHome1/lib -lz -lclntsh
DRIVER_INCS_oci8 ?= -I/home/oracle/OraHome1/rdbms/demo \
-I/home/oracle/OraHome1/rdbms/public
# - PostgreSQL
#DRIVER_LIBS_postgres ?= -L/usr/local/pgsql/lib -lpq
#DRIVER_INCS_postgres ?= -I/usr/local/pgsql/include/
DRIVER_LIBS_postgres ?= -L/usr/lib -lpq
DRIVER_INCS_postgres ?= -I/usr/include/postgresql
# - SQLite
DRIVER_LIBS_sqlite ?= -lsqlite
DRIVER_INCS_sqlite ?=
# - SQLite3
DRIVER_LIBS_sqlite3 ?= -L/opt/local/lib -lsqlite3
DRIVER_INCS_sqlite3 ?= -I/opt/local/include
# - ODBC
DRIVER_LIBS_odbc ?= -L/usr/local/lib -lodbc
DRIVER_INCS_odbc ?= -DUNIXODBC -I/usr/local/include
# - Firebird
DRIVER_LIBS_firebird ?= -L/usr/local/firebird -lfbclient
DRIVER_INCS_firebird ?=

# general compilation parameters
WARN = -Wall -Wmissing-prototypes -Wmissing-declarations -pedantic
INCS = -I$(LUA_INC)
DEFS =
CFLAGS = -O2 -std=gnu99 $(WARN) -fPIC $(DRIVER_INCS) $(INCS) \
-DLUASQL_VERSION_NUMBER='"$V"' $(DEFS)
CC= gcc

# $Id: config,v 1.10 2008/05/30 17:21:18 tomas Exp $
Loading