comparison Modules/_sqlite/statement.c @ 46657:6db392ac9f4e legacy-trunk

SQLite requires 64-bit integers in order to build. So the whole HAVE_LONG_LONG #ifdefing was useless.
author Gerhard Häring <gh@ghaering.de>
date Sun, 04 May 2008 12:59:57 +0000
parents a21854e510b4
children 4fe192d48960
comparison
equal deleted inserted replaced
46656:de76be02db42 46657:6db392ac9f4e
98 98
99 int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObject* parameter, int allow_8bit_chars) 99 int pysqlite_statement_bind_parameter(pysqlite_Statement* self, int pos, PyObject* parameter, int allow_8bit_chars)
100 { 100 {
101 int rc = SQLITE_OK; 101 int rc = SQLITE_OK;
102 long longval; 102 long longval;
103 #ifdef HAVE_LONG_LONG
104 PY_LONG_LONG longlongval; 103 PY_LONG_LONG longlongval;
105 #endif
106 const char* buffer; 104 const char* buffer;
107 char* string; 105 char* string;
108 Py_ssize_t buflen; 106 Py_ssize_t buflen;
109 PyObject* stringval; 107 PyObject* stringval;
110 parameter_type paramtype; 108 parameter_type paramtype;
155 switch (paramtype) { 153 switch (paramtype) {
156 case TYPE_INT: 154 case TYPE_INT:
157 longval = PyInt_AsLong(parameter); 155 longval = PyInt_AsLong(parameter);
158 rc = sqlite3_bind_int64(self->st, pos, (sqlite_int64)longval); 156 rc = sqlite3_bind_int64(self->st, pos, (sqlite_int64)longval);
159 break; 157 break;
160 #ifdef HAVE_LONG_LONG
161 case TYPE_LONG: 158 case TYPE_LONG:
162 longlongval = PyLong_AsLongLong(parameter); 159 longlongval = PyLong_AsLongLong(parameter);
163 /* in the overflow error case, longlongval is -1, and an exception is set */ 160 /* in the overflow error case, longlongval is -1, and an exception is set */
164 rc = sqlite3_bind_int64(self->st, pos, (sqlite_int64)longlongval); 161 rc = sqlite3_bind_int64(self->st, pos, (sqlite_int64)longlongval);
165 break; 162 break;
166 #endif
167 case TYPE_FLOAT: 163 case TYPE_FLOAT:
168 rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter)); 164 rc = sqlite3_bind_double(self->st, pos, PyFloat_AsDouble(parameter));
169 break; 165 break;
170 case TYPE_STRING: 166 case TYPE_STRING:
171 string = PyString_AS_STRING(parameter); 167 string = PyString_AS_STRING(parameter);