how to get query string parameters from a string? LUA/nginx - nginx

i am using lua module inside nginx for routing to a stored string.
The thing i want to do is to change the values of query string parameters from the stored string.
Is there any function which will give me table of query string parameters from a string?
And after changing the values, any function to change the values from the string.
Thanks

I think you're looking for ngx.encode_args and ngx.decode_args respectively.

Related

Searching for blob field in SQLite

I have column in my database that stores BLOB.
I want to run a query to check if specific byte array value is present in the table.
The value is b'\xf4\x8f\xc6{\xc2mH(\x97\x9c\x83hkE\x8b\x95' (python bytes).
I tried to run this query:
SELECT * from received_message
WHERE "EphemeralID"
LIKE HEX('\xf4\x8f\xc6{\xc2mH(\x97\x9c\x83hkE\x8b\x95');
But I get 0 results though I 100% sure that I store this value in the database.
Is there something wrong with my query?
Your search string is a bit weird-- you appear to have some complex things in there like { and (. Maybe you should search through the blob the way it is stored instead?
From the Sqlite documentation:
BLOB literals are string literals containing hexadecimal data and
preceded by a single "x" or "X" character. Example: X'53514C697465'
So maybe do a like with the ascii representation of the hex value you want? Maybe start with looking for just f48f or F48F if your sqlite stores it upper case.

Is there any way to change datatype of a field in Firestore?

Actual variable is Long but while saving it to Firestore I accidentally converted it to String, now I cannot perform queries like whereGreaterThan, whereLessThan, orderBy etc on this String field
There isn't a way to magically change the data type. The easiest way will be to re-write all the documents that were saved as a string.
You could use something like the Python server libraries to do this, using Cloud Shell in the GCP Console.
Note, you can grab all the documents with the field set to a string by doing a filter for >= "". This will get you every field that has a string with any value, as well as empty strings.

Should I encode names of parameters in a query string of a URI?

I know I need to encode the arguments of parameters in a query string of a URI, but what about the parameter names, do they need to be encoded too?
Yes. Special characters in query strings have their special meaning anywhere in the query string.
If the parameter name is foo=bar then ?foo=bar=something won't be parsed as foo=bar equals something.

Is it possible to change the query string value

Let me know Is their any possibility to change the query string value? i have tried
like the following:
Dim tab As Integer = CInt(Request.QueryString("tab"))
Request.QueryString("tab") = ""
but it says System.NotSupportedException: Collection is read-only.. does it means that assigning values to the query string only at the time of redirection using Response.Redirect(----)?
I know i can use session or cookies instead for this.
does it means that assigning values to the query string only at the time of redirection
Yes. The query string comes from the request the browser makes. You can't change a request that is being processed. You'll have to redirect using the new query string values.
HttpRequest.QueryString Property is for Gets the collection of HTTP query string variables. QueryString dos not support set value operation

How can I update a database string value from a TextBox?

I cant update my database through textbox.in the case of numeric value i can update but cant with a string value.
my coding is...
SqlCommand cmdup= new SqlCommand("UPDATE [port1] SET [prt1]=#prt1 WHERE [no]= 1",cn);
cmdup.Parameters.Add("#prt1", TextBox1.Text);
cmdup.ExecuteNonQuery();
if any one know the ans: reply me
I'd recommend explicitly defining the parameter type to match the type in the DB, and passing the value to Parameters.Add as the appropriate type.
e.g. at the moment, you are passing a string typed value to Parameters.Add, and not defining the type explicitly. Therefore, it will assume the data type from the type of value supplied...so the #prt1 type will be passed in to the DB as NVARCHAR I believe.
If the prt1 field is an INTEGER for example, much safer IMHO to do something like:
cmd.Parameters.Add("#prt", SqlDbType.Int,4).Value = Int32.Parse(TextBox1.Text);
or
cmd.Parameters.AddWithValue("#prt", Int32.Parse(TextBox1.Text));
I always like to fully define the type of the parameters I pass in to SQL to rule out any potential, unexpected issues.
Check the datatype for the #prt1 to see if it is a Int value because you are setting to the same column two different values.
Parse the textBox to Integer as you want to insert a numeric value i.e. Int64.Parse("Textbox1.Text"); well with string it does have problems.
Just a wild guess: Does prt maybe only accept numeric values?

Resources