dbtable_emit = db_exec + dbstmt_emit
| 2569 | |
| 2570 | // dbtable_emit = db_exec + dbstmt_emit |
| 2571 | static int dbtable_emit_int(Lua L, dbtable_t *table) |
| 2572 | { |
| 2573 | char n1[MAXTABLELEN] = {0}, separator[2], n2[MAXTABLELEN]; |
| 2574 | query_tbl_name(table->table_name, n1, separator, n2); |
| 2575 | |
| 2576 | char sql[128]; |
| 2577 | sprintf(sql, "select * from %s%s\"%s\"", n1, separator, n2); |
| 2578 | |
| 2579 | lua_getglobal(L, "db"); |
| 2580 | lua_pushstring(L, sql); |
| 2581 | db_exec(L); |
| 2582 | if (lua_isnumber(L, -1) && lua_tonumber(L, -1) == 0) { |
| 2583 | /* |
| 2584 | ** Lua stack: |
| 2585 | ** 1. number |
| 2586 | ** 2. stmt |
| 2587 | ** 3. sql string |
| 2588 | ** 4. db |
| 2589 | */ |
| 2590 | lua_pop(L, 1); |
| 2591 | lua_insert(L, 1); |
| 2592 | lua_settop(L, 1); |
| 2593 | /* |
| 2594 | ** Lua stack: |
| 2595 | ** 1. stmt |
| 2596 | */ |
| 2597 | return dbstmt_emit(L); |
| 2598 | } |
| 2599 | return 1; |
| 2600 | } |
| 2601 | |
| 2602 | static int dbtable_emit(Lua L) |
| 2603 | { |
no test coverage detected