68 int n = lua_gettop(L); |
68 int n = lua_gettop(L); |
69 statement_t *statement = (statement_t *)luaL_checkudata(L, 1, DBD_MYSQL_STATEMENT); |
69 statement_t *statement = (statement_t *)luaL_checkudata(L, 1, DBD_MYSQL_STATEMENT); |
70 int num_bind_params = n - 1; |
70 int num_bind_params = n - 1; |
71 int expected_params; |
71 int expected_params; |
72 |
72 |
73 unsigned char b[1024]; |
73 unsigned char *buffer = NULL; |
74 unsigned char *buffer = &b[0]; |
|
75 int offset = 0; |
74 int offset = 0; |
76 |
75 |
77 MYSQL_BIND *bind = NULL; |
76 MYSQL_BIND *bind = NULL; |
78 MYSQL_RES *metadata = NULL; |
77 MYSQL_RES *metadata = NULL; |
79 |
78 |
98 lua_pushboolean(L, 0); |
97 lua_pushboolean(L, 0); |
99 lua_pushfstring(L, DBI_ERR_PARAM_MISCOUNT, expected_params, num_bind_params); |
98 lua_pushfstring(L, DBI_ERR_PARAM_MISCOUNT, expected_params, num_bind_params); |
100 return 2; |
99 return 2; |
101 } |
100 } |
102 |
101 |
103 bind = malloc(sizeof(MYSQL_BIND) * num_bind_params); |
102 if (num_bind_params) { |
104 |
103 bind = malloc(sizeof(MYSQL_BIND) * num_bind_params); |
105 if (bind == NULL) { |
104 if (bind == NULL) { |
106 luaL_error(L, "Could not alloc bind params\n"); |
105 luaL_error(L, "Could not alloc bind params\n"); |
107 } |
106 } |
108 |
107 |
109 memset(bind, 0, sizeof(MYSQL_BIND) * num_bind_params); |
108 buffer = malloc(num_bind_params * sizeof(size_t)); |
|
109 memset(bind, 0, sizeof(MYSQL_BIND) * num_bind_params); |
|
110 } |
110 |
111 |
111 for (p = 2; p <= n; p++) { |
112 for (p = 2; p <= n; p++) { |
112 int type = lua_type(L, p); |
113 int type = lua_type(L, p); |
113 int i = p - 2; |
114 int i = p - 2; |
114 |
115 |