View previous topic :: View next topic |
Author |
Message |
pethrowilo
Joined: 21 Dec 2014 Posts: 7 Location: China
|
Posted: Sun Dec 21, 2014 20:03 Post subject: CURRENT_TIMESTAMP not working for SQLite? |
|
|
This was what I get, and:
Code: | CREATE TABLE server_main (
player varchar(64) NOT NULL default '~',
tag varchar(64) NOT NULL default '~',
name varchar(64) NOT NULL default '~',
val text,
expire int(11) default NULL,
last timestamp NOT NULL default CURRENT_TIMESTAMP,
PRIMARY KEY (player,tag,name)
) |
This was what I trying to do.
Changing CURRENT_TIMESTAMP to (CURRENT_TIMESTAMP) would result nothing created.
So... must I switch to MySQL... |
|
Back to top |
|
|
Terra_777
Joined: 27 Jun 2008 Posts: 216 Location: Sweden
|
Posted: Mon Dec 22, 2014 22:56 Post subject: |
|
|
It honestly looks like you're inserting it as a string. IE:
Code: | INSERT INTO server_main (player,tag,name,val,expire,last)VALUE('player','tag','name','val','0','CURRENT_TIMESTAMP') |
If you want it to insert the default value then exclude the column or run the above without the quotes around CURRENT_TIMESTAMP:
Code: | INSERT INTO server_main (player,tag,name,val,expire)VALUES('player','tag','name','val','0') |
_________________ I dun have any signature, I'm happy anyway. |
|
Back to top |
|
|
pethrowilo
Joined: 21 Dec 2014 Posts: 7 Location: China
|
Posted: Tue Dec 23, 2014 19:39 Post subject: |
|
|
Thank you for your reply Terra
Yes I know it seems like that.
But in fact there were no quotes included around it.
It works fine in MySQL, but not so smoothly in SQLite
Code: | // Set oObject's persistent string variable sVarName to sValue
// Optional parameters:
// iExpiration: Number of days the persistent variable should be kept in database (default: 0=forever)
// sTable: Name of the table where variable should be stored (default: pwdata)
void SetPersistentString(object oObject, string sVarName, string sValue, int iExpiration = 0, string sTable = "pwdata");
|
I was using this function in aps_include to save some one-time mark to my database. This should be quite simple.
Table creation outside NWN would be alright, but in-game creation with
Code: | // Execute statement in sSQL
void SQLExecDirect(string sSQL); |
works strangely.
I recall forgetting to call
Code: | // Setup placeholders for ODBC requests and responses
void SQLInit(); |
before table creation, would that affect SQLExecDirect()?
I am inserting time data manually now anyway. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|