lib/riddle/configuration/sql_source.rb in riddle-1.0.3 vs lib/riddle/configuration/sql_source.rb in riddle-1.0.4

- old
+ new

@@ -28,9 +28,22 @@ @sql_query_post = [] @sql_query_post_index = [] @unpack_zlib = [] @unpack_mysqlcompress = [] end + + def sql_query=(query) + unless query.nil? + max_length = 8178 # max is: 8192 - "sql_query = ".length - "\\\n".length + i = max_length + while i < query.length + i = query.rindex(" ", i) + query.insert(i, "\\" + "\n") + i = i + max_length + end + end + @sql_query = query + end def valid? super && (!( @sql_host.nil? || @sql_user.nil? || @sql_db.nil? || @sql_query.nil? ) || !@parent.nil?) end \ No newline at end of file