23.04.2013, 07:08
hey guys - beenplaying around with sqlite a bit and Had some pretty god luck until i hit a query that is rather large ad have to split the string and join using strcat():
Is that the right way to do it or am I being dumb because it don't work lol. Is there a better way to do it than this and would somebody be kind enough to show me it? Thanks in advance guys
pawn Код:
format(QueryA, sizeof(QueryA), "INSERT INTO `VEHICLES` (`ID`, `VALID`, `MODEL`, `XPOS`, `YPOS`, `ZPOS`, `ZAPOS`, `COL1`, `COL2`, `COST`, `BOUGHT`, `SECURE`, `ASECURE`, `BUYBAR`, `MOD1`, `MOD2`,` MOD3`, `MOD4`, `MOD5`, `MOD6`, `MOD7`, `MOD8`, `MOD9`, `MOD10`, `MOD11`, `MOD12`, `MOD13`, `MOD14`, `MOD15`, `MOD16`, `MOD17`, `OWNER`, `NAME`, `PAINTJOB`, `FACTION`)");
format(QueryB, sizeof(QueryB), " VALUES('%d', '1', '%d', '%f', '%f', '%f', '%f', '%d', '%d', '%d', ",varID, VehicleSetupInfo[varID][model], VehicleSetupInfo[varID][x_spawn], VehicleSetupInfo[varID][y_spawn], VehicleSetupInfo[varID][z_spawn], VehicleSetupInfo[varID][za_spawn], VehicleSetupInfo[varID][color_1], VehicleSetupInfo[varID][color_2], VehicleSetupInfo[varID][vehiclecost]);
strcat(QueryA, QueryB);
format(QueryB, sizeof(QueryB), "'0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '[NULL]', '%s', '-1', '-1' )", DB_Escape(VehicleSetupInfo[varID][name]));
strcat(QueryA, QueryB);
db_query(TSYS_Database, QueryA);
Is that the right way to do it or am I being dumb because it don't work lol. Is there a better way to do it than this and would somebody be kind enough to show me it? Thanks in advance guys