mirror of https://github.com/adamdruppe/arsd.git
Merge pull request #126 from quickfur/bind_int64
[sqlite.d] Fix 64-bit int binding/selecting troubles
This commit is contained in:
commit
4dd218fd95
11
sqlite.d
11
sqlite.d
|
@ -325,7 +325,7 @@ struct Statement {
|
||||||
Variant v;
|
Variant v;
|
||||||
final switch(sqlite3_column_type(s, a)){
|
final switch(sqlite3_column_type(s, a)){
|
||||||
case SQLITE_INTEGER:
|
case SQLITE_INTEGER:
|
||||||
v = sqlite3_column_int(s, a);
|
v = sqlite3_column_int64(s, a);
|
||||||
break;
|
break;
|
||||||
case SQLITE_FLOAT:
|
case SQLITE_FLOAT:
|
||||||
v = sqlite3_column_double(s, a);
|
v = sqlite3_column_double(s, a);
|
||||||
|
@ -502,6 +502,11 @@ template extract(A, T, R...){
|
||||||
throw new DatabaseException("bind " ~ db.error());
|
throw new DatabaseException("bind " ~ db.error());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bind(int col, long value){
|
||||||
|
if(sqlite3_bind_int64(s, col, value) != SQLITE_OK)
|
||||||
|
throw new DatabaseException("bind " ~ db.error());
|
||||||
|
}
|
||||||
|
|
||||||
void bind(int col, const byte[] value){
|
void bind(int col, const byte[] value){
|
||||||
if(value is null) {
|
if(value is null) {
|
||||||
if(sqlite3_bind_null(s, col) != SQLITE_OK)
|
if(sqlite3_bind_null(s, col) != SQLITE_OK)
|
||||||
|
@ -513,6 +518,8 @@ template extract(A, T, R...){
|
||||||
}
|
}
|
||||||
|
|
||||||
void bind(int col, Variant v) {
|
void bind(int col, Variant v) {
|
||||||
|
if(v.peek!long)
|
||||||
|
bind(col, v.get!long);
|
||||||
if(v.peek!int)
|
if(v.peek!int)
|
||||||
bind(col, v.get!int);
|
bind(col, v.get!int);
|
||||||
if(v.peek!string)
|
if(v.peek!string)
|
||||||
|
@ -714,6 +721,7 @@ int sqlite3_bind_blob(sqlite3_stmt*, int, void*, int n, void*);
|
||||||
//int sqlite3_bind_blob(sqlite3_stmt*, int, void*, int n, void(*)(void*));
|
//int sqlite3_bind_blob(sqlite3_stmt*, int, void*, int n, void(*)(void*));
|
||||||
int sqlite3_bind_double(sqlite3_stmt*, int, double);
|
int sqlite3_bind_double(sqlite3_stmt*, int, double);
|
||||||
int sqlite3_bind_int(sqlite3_stmt*, int, int);
|
int sqlite3_bind_int(sqlite3_stmt*, int, int);
|
||||||
|
int sqlite3_bind_int64(sqlite3_stmt*, int, long);
|
||||||
int sqlite3_bind_null(sqlite3_stmt*, int);
|
int sqlite3_bind_null(sqlite3_stmt*, int);
|
||||||
int sqlite3_bind_text(sqlite3_stmt*, int, const(char)*, int n, void*);
|
int sqlite3_bind_text(sqlite3_stmt*, int, const(char)*, int n, void*);
|
||||||
//int sqlite3_bind_text(sqlite3_stmt*, int, char*, int n, void(*)(void*));
|
//int sqlite3_bind_text(sqlite3_stmt*, int, char*, int n, void(*)(void*));
|
||||||
|
@ -722,6 +730,7 @@ void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
|
||||||
int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
|
int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
|
||||||
double sqlite3_column_double(sqlite3_stmt*, int iCol);
|
double sqlite3_column_double(sqlite3_stmt*, int iCol);
|
||||||
int sqlite3_column_int(sqlite3_stmt*, int iCol);
|
int sqlite3_column_int(sqlite3_stmt*, int iCol);
|
||||||
|
long sqlite3_column_int64(sqlite3_stmt*, int iCol);
|
||||||
char *sqlite3_column_text(sqlite3_stmt*, int iCol);
|
char *sqlite3_column_text(sqlite3_stmt*, int iCol);
|
||||||
int sqlite3_column_type(sqlite3_stmt*, int iCol);
|
int sqlite3_column_type(sqlite3_stmt*, int iCol);
|
||||||
char *sqlite3_column_name(sqlite3_stmt*, int N);
|
char *sqlite3_column_name(sqlite3_stmt*, int N);
|
||||||
|
|
Loading…
Reference in New Issue