![]() |
Using requestsql2 with an unconfigured database will result in silence, may be can set the error variable. For the future it could be possible to configure additional databases in the server options but right now it's not possible.
|
Quote:
As good as all of this information is, none of it helps with my original question of how to create 'sub-tables'. Just a light reminder... |
The requestsql2 information is correct, it lets you select the (configured) database. Right now you cannot configure databases, so there is only "default".
|
Quote:
|
I tried using string.escape() as you suggested, but like I thought, it escaped single quotes using a backslash which is incorrect, you're supposed to escape single quotes using another single quote.
I also suggest adding "parameterized queries." Which is basically when question marks in the query are replaced by function parameters to protect against SQL injection and stuff. Example: executesql("INSERT INTO options VALUES (?,?)", {"profit", 9001}); |
Quote:
I've looked in to creating VIEWS, but I'm not sure if I'm doing it correctly. PHP Code:
|
Would using this in an onPlayerLogin() still work? I tried Stefan's sample age code thing, and I get the working output, but if i try to edit it the slightest bit and use findPlayer( p.account ); (p is a param in the onPlayerLogin() function) I get this:
NPC Code:Accounts in database: 0 Here's what I'm using: PHP Code:
|
Quote:
PHP Code:
Also, you don't really need the first sql query if you have already created the table (but I guess it doesn't really hurt to include it). And, you don't need to do the findplayer(), since the 'p' passed in is a player object (so you could use temp.p.account and temp.p.id right off the bat). |
Quote:
|
It's better to format queries like this:
PHP Code:
|
Quote:
|
Quote:
NPC Code:Accounts in database: 0 Although, not sure since it could have been Stefan's suggestion that broke it ;o |
Quote:
Also, SQLite only has a few column types: TEXT, NUMERIC, INTEGER, REAL, NONE. Other types work for compatibility but they're just aliases for one of these types, I suggest these be used for clarity. http://www.sqlite.org/datatype3.html |
Quote:
Update: fixed it, will work fine with the next npcserver update. |
Well until the next update I've been using this as a work around.
PHP Code:
|
Quote:
|
Quote:
Also I noticed that you seem to have changed the behavior of trigger(), if this was intentional than I'm very annoyed because that's not something you should change without warning. Example: #1. trigger onSpecial() with trigger("Special", ...): FAIL #2. trigger onSpecial() with trigger("onSpecial", ...): SUCCEED #3. trigger Special() with trigger("Special", ...): FAIL #1 is how it used to work, #2 is how it works now, and #3 shouldn't work either way, but you would think it would if #2 does. I assume you've changed this to eliminate the inconsistency with functions that use event names and whether the "on" prefix is part of the event name. Note: This is all on the same object, if it behaves differently when triggering other objects then I'd like to know. Edit: #1 works fine when triggering to a different object, I guess doing #1 on self makes the event catchable by catchevent()? |
Quote:
|
Quote:
|
Quote:
|
I was mainly referring to using format instead of an array and format2
Think your player account example but with 19 parameters, 18 of which were variables with .escape() on the end. |
Quote:
|
Quote:
|
Yeah that's what I'm doing now.
|
The npcserver has been uploaded to all machines, restart it manually to get the new escape() command.
|
Quote:
|
Quote:
|
Currently NULL in SQL is represented as "" in Graal, this is a problem and there needs to be a way to differentiate between zero, an empty string, and NULL.
I was thinking perhaps a literal like "\\NULL\\" or "\\0" in GScript. c = '\0' just causes a compiler error. |
TSQLRequest.affectedrows doesn't appear to be working with my update statement even though I can see the change in a later query.
|
affectedrows is currently only used for mysql, is not touched by the sqlite database.
|
Any idea how to use the auto increment option as a primary key? I can't figure it out- thanks
|
Quote:
Google will serve you well. :) |
Quote:
|
Sorry for the bump, but is it possible in a future RC Update to have a console specifically for SQL Management, and to place and receive queries, with the ability to view a table, without relying on an Echo to RC, to do possible click sorting, displaying and indicating primary keys, composite keys, surrogate, etc.
|
Quote:
I also built a basic in-game "SQL Explorer". If it was finished, it could eventually be added to client-RC (would actually be quite a nifty feature). http://img11.imageshack.us/img11/928...1248746452.png |
Quote:
|
Quote:
|
Quote:
|
Quote:
EDIT: What exactly are you trying to do? PHP Code:
EDIT: I have noticed that it unnecessarily escapes quotations. |
Actually, nevermind. Seems another part of the code was parsing it wrong, making me think it wasn't working. I'll go ahead and delete my previous posts. x_x
|
All times are GMT +2. The time now is 03:33 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.