Raised This Month: $ Target: $400
 0% 

About dbi_query too long[already resolve]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
griefhy
Member
Join Date: Jul 2006
Old 11-09-2007 , 06:17   About dbi_query too long[already resolve]
Reply With Quote #1

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!!!

Last edited by griefhy; 11-09-2007 at 21:47.
griefhy is offline
griefhy
Member
Join Date: Jul 2006
Old 11-09-2007 , 10:22   Re: About dbi_query too long
Reply With Quote #2

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 ?
griefhy is offline
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 11-09-2007 , 10:28   Re: About dbi_query too long
Reply With Quote #3

STOP IT! OMG... Patient is the "Key"! Just wait
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-09-2007 , 10:39   Re: About dbi_query too long
Reply With Quote #4

Have you tried examining your script closely and seeing that maybe you forgot to change an arg in format?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
griefhy
Member
Join Date: Jul 2006
Old 11-09-2007 , 21:32   Re: About dbi_query too long
Reply With Quote #5

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 is offline
griefhy
Member
Join Date: Jul 2006
Old 11-09-2007 , 21:47   Re: About dbi_query too long
Reply With Quote #6

hahahaha,already resolve!
not "256-len", 256 is too short,
use
800-len
thanks hlep of everyone
griefhy is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-09-2007 , 22:31   Re: About dbi_query too long[already resolve]
Reply With Quote #7

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
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
griefhy
Member
Join Date: Jul 2006
Old 11-10-2007 , 05:08   Re: About dbi_query too long[already resolve]
Reply With Quote #8

thanks ,you are right!
"new query[800]" is better than "new query[2048]"
I try !
griefhy is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 11-10-2007 , 10:38   Re: About dbi_query too long[already resolve]
Reply With Quote #9

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
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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