AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   About dbi_query too long[already resolve] (https://forums.alliedmods.net/showthread.php?t=62994)

griefhy 11-09-2007 06:17

About dbi_query too long[already resolve]
 
dbi_query(dbc,"CREATE TABLE IF NOT EXISTS `%s` (`Username` VARCHAR(32) NOT NULL......................................... ............................................. ........................

is too long,

now, i try

new query[1024]
new len = 0
len += format(query[len],512,"........"
len += format(query[len],512-len,..............

but
Error: Input line too long (after substitutions) on line 109
why ? how ? please!!!:cry::cry:

griefhy 11-09-2007 10:22

Re: About dbi_query too long
 
now ,is not any err
but can't creat table
please ,help me !

new query[1024]
new len = 0
len += format(query[len],512,"CREATE TABLE IF NOT EXISTS `%s` ....",tbl_table)
len += format(query[len],512-len,".........")
len += format(query[len],512-len,".........")
dbi_query(g_dbc,"%s",query)

where is wrong ?

Alka 11-09-2007 10:28

Re: About dbi_query too long
 
STOP IT! OMG... Patient is the "Key"! Just wait

YamiKaitou 11-09-2007 10:39

Re: About dbi_query too long
 
Have you tried examining your script closely and seeing that maybe you forgot to change an arg in format?

griefhy 11-09-2007 21:32

Re: About dbi_query too long
 
Thanks everyone,SQL is right,i think

for example:

new query[2048]
new len = 0
len += format(query[len], 256,"CREATE TABLE IF NOT EXISTS `%s` (`Username` VARCHAR(32) NOT NULL,`date` TIMESTAMP(10) NOT NULL ,",tbltable)
len += format(query[len], 256-len,"`password` INT NOT NULL ,")
len += format(query[len], 256-len,"PRIMARY KEY (`password`))")
dbi_query(g_dbc,"%s",query)

but can't creat table,it's wrong ???

griefhy 11-09-2007 21:47

Re: About dbi_query too long
 
hahahaha,already resolve!
not "256-len", 256 is too short,
use
800-len
thanks hlep of everyone

YamiKaitou 11-09-2007 22:31

Re: About dbi_query too long[already resolve]
 
Why not use the length of the string. In your above example, try 2047 instead of 256. Now, since you figured it out, decrease the length of query to save memory

griefhy 11-10-2007 05:08

Re: About dbi_query too long[already resolve]
 
thanks ,you are right!
"new query[800]" is better than "new query[2048]"
I try !

YamiKaitou 11-10-2007 10:38

Re: About dbi_query too long[already resolve]
 
Also, have the length of the string when you declare it 1 higher than the max you are planning to use. So, if you are telling it to use up to 800 characters, define it as having 801. This allows for it to add the terminating "/0" in the last spot so the complier knows that it is a string and not an array


All times are GMT -4. The time now is 01:12.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.