Raised This Month: $ Target: $400
 0% 

Input Line Too Long Errors (Ugh) - Solution ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mugwump
Senior Member
Join Date: May 2004
Old 09-09-2004 , 10:28   Input Line Too Long Errors (Ugh) - Solution ?
Reply With Quote #1

Oye, this is a fun one. ;)

I have a largish SQL table that I want to check for its existance and create it if it does not. The table has 2 VARCHARS, 1 TINYINT and 40 INT fields. The sql query string to create it is too long, gives me that 'Input Line Too Long' error.

Is there a compiler option to allow larger input strings? I could split the table into several smaller tables if absolutely necessary but thats not the elegant solution I am hoping for. ;)

Thanks,
Mug
Mugwump is offline
BAILOPAN
Join Date: Jan 2004
Old 09-09-2004 , 10:32  
Reply With Quote #2

Break the string up and keep formatting it like this:

Code:
  len = format(str, 500, "adsf")   len += format(str[len], 500-len, "asdfad")
__________________
egg
BAILOPAN is offline
Mugwump
Senior Member
Join Date: May 2004
Old 09-09-2004 , 14:06  
Reply With Quote #3

Thanks, that seems to work!

-Mug
Mugwump is offline
Mugwump
Senior Member
Join Date: May 2004
Old 09-09-2004 , 14:22  
Reply With Quote #4

Erm, I spoke too soon... No compile errors but the table doesnt get created, I'm wondering if the dbi_query routine has a limit in the size of the query string it can accept... Here is a code snippet:

Code:
   new squery[2048]    new len = 0    len += format(squery[len], 512, "CREATE TABLE IF NOT EXISTS %s ( name VARCHAR(32) NOT NULL, steamid VARCHAR(32) NOT NULL, nset TINYINT NOT NULL, skill1 SMALLINT, skill2 SMALLINT, skill3 SMALLINT, skill4 SMALLINT, skill5 SMALLINT, skill6 SMALLINT, skill7 SMALLINT, skill8 SMALLINT, skill9 SMALLINT, skill10 SMALLINT, ", sqltable_skills)    len += format(squery[len], 512-len, "skill11 SMALLINT, skill12 SMALLINT, skill13 SMALLINT, skill14 SMALLINT, skill15 SMALLINT, skill16 SMALLINT, skill17 SMALLINT, skill18 SMALLINT, skill19 SMALLINT, skill20 SMALLINT, ")    len += format(squery[len], 512-len, "skill21 SMALLINT, skill22 SMALLINT, skill23 SMALLINT, skill24 SMALLINT, skill25 SMALLINT, skill26 SMALLINT, skill27 SMALLINT, skill28 SMALLINT, skill29 SMALLINT, skill30 SMALLINT, ")    len += format(squery[len], 512-len, "skill31 SMALLINT, skill32 SMALLINT, skill33 SMALLINT, skill34 SMALLINT, skill35 SMALLINT, skill36 SMALLINT, skill37 SMALLINT, skill38 SMALLINT, skill39 SMALLINT, skill40 SMALLINT, PRIMARY KEY ( steamid, nset ) )")    dbi_query(sql, "%s", squery)    server_print("Executing query: %s", squery)


The server_print dumps this:

Executing query: CREATE TABLE IF NOT EXISTS uwc3_skills ( name VARCHAR(32) NOT NULL, steamid VARCHAR(32) NOT NULL, nset TINYINT NOT NULL, skill1 SMALLINT, skill2 SMALLINT, skill3 SMALLINT, skill4 SMALLINT, skill5 SMALLINT, skill6 SMALLINT, skill7 SMALLIN

I would have guessed that the Mysql server would have spat out an error but nothing shows up and no table created.

-K2
Mugwump is offline
BAILOPAN
Join Date: Jan 2004
Old 09-09-2004 , 14:59  
Reply With Quote #5

The server_print() is cut off after something like 190 characters...
you will have to find another way of du mping it, perhaps by reading mysql logs or by using a file output function
__________________
egg
BAILOPAN is offline
Mugwump
Senior Member
Join Date: May 2004
Old 09-09-2004 , 16:16  
Reply With Quote #6

Gotcha Bail... Ok, I cleared the Mysql server error log, I dropped all the tables, I reran the server and this is the logged error:


Aborted connection 93 to db: 'uwc3' user: 'gmd' host: `localhost.localdomain' (Got an error reading communication packets)


I tried a few times to make sure that one large table causes that error, it does, the other 2 tables being created in the same routine are created successfully.

I also tested creating this particular large table with the mysql client, and a perl script and it worked fine which leads me to believe it is something with the amxx dbi module.

-Mug
Mugwump is offline
Reply



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 17:19.


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