The opencart 3.0.2.0 system will limit users from entering their address in checkout more than 128 characters, is there any possible ways to modify this?
I do have some customers complain to me about this.
You can change it with this query:
ALTER TABLE `oc_address` CHANGE `address_1` `address_1` VARCHAR(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
Note: if your database prefix is not oc_, edit above query and use your actual database prefix.
This query will change the address_1 limit from 128 to 256.
Related
I am working with the WSO2 IS 5.2.0
for some reasons, I would like to change the data schema of the default embedded H2 database.
for example,
the maximum length of volume "ACCESS_TOKEN" in table "IDN_OAUTH2_ACCESS_TOKEN" is 255 chars. I would like to change it to 8194.
I made the following change the configuration file "/dbscripts/identity/h2.sql" (see the value "8194")
CREATE TABLE IF NOT EXISTS IDN_OAUTH2_ACCESS_TOKEN (
TOKEN_ID VARCHAR (255),
ACCESS_TOKEN VARCHAR (8194),
REFRESH_TOKEN VARCHAR (255),
CONSUMER_KEY_ID INTEGER,
AUTHZ_USER VARCHAR (100),
TENANT_ID INTEGER,
USER_DOMAIN VARCHAR(50),
USER_TYPE VARCHAR (25),
GRANT_TYPE VARCHAR (50),
TIME_CREATED TIMESTAMP DEFAULT 0,
REFRESH_TOKEN_TIME_CREATED TIMESTAMP DEFAULT 0,
VALIDITY_PERIOD BIGINT,
REFRESH_TOKEN_VALIDITY_PERIOD BIGINT,
TOKEN_SCOPE_HASH VARCHAR (32),
TOKEN_STATE VARCHAR (25) DEFAULT 'ACTIVE',
TOKEN_STATE_ID VARCHAR (128) DEFAULT 'NONE',
SUBJECT_IDENTIFIER VARCHAR(255),
PRIMARY KEY (TOKEN_ID),
FOREIGN KEY (CONSUMER_KEY_ID) REFERENCES IDN_OAUTH_CONSUMER_APPS(ID) ON DELETE CASCADE,
CONSTRAINT CON_APP_KEY UNIQUE (CONSUMER_KEY_ID,AUTHZ_USER,TENANT_ID,USER_DOMAIN,USER_TYPE,TOKEN_SCOPE_HASH,
TOKEN_STATE,TOKEN_STATE_ID)
the problems is that I just cannot put this change into effect. I did everything (restart, reinstall), the original settings ("256") persists...
it seems that the database schema had been generated in the IS server image. and the generating script file says "GENERATE IF NOT EXISTS..."
anyone has any idea?
thanks
Remove <IS_HOME>/repository/database/*. Then start server with -Dsetup.
./wso2server.sh -Dsetup
Yes, It is generated with the server distribution. What you can do is (backup and) remove the content of repository/database, update the db scripts and start the server with bin/wso2server.sh -Dsetup. This needs to be done only once, from next time on you can start the server as usual.
One other possibility is to use the H2 console. If you already have data, it will be the better option.
I would like to retrieve ROWID of a table from Oracle DB and store in memory as a character array for later use. For example, I run the following query:
SELECT ROWID, MARKS FROM MTB WHERE EID='123';
Then using Pro*C, I would like to store this ROWID as a character array rrr to use later as:
UPDATE MTB SET MARKS = 80 WHERE ROWID='<rrr>'
Please help and point to appropriate documentation of Pro*C usage to convert a ROWID to an array of character strings.
You can use the ROWIDTOCHAR and CHARTOROWID functions:
SELECT ROWIDTOCHAR(ROWID), MARKS INTO :rrr, :marks FROM MTB WHERE EID='123';
And then
UPDATE MTB SET MARKS = 80 WHERE ROWID=CHARTOROWID(:rrr);
So last week I was able to begin to stream my Appengine logs into BigQuery and am now attempting to pull some data out of the log entries into a table.
The data in protoPayload.resource is the page requested with the querystring paramters included.
The contents of protoPayload.resource looks like the following examples:
/service.html?device_ID=123456
/service.html?v=2&device_ID=78ec9b4a56
I am getting close, but when there is another entry before device_ID, I am not getting it. As you can see I am not great with Regex, but it is the only way I think I can parse the data in the query. To get just the device ID from the first example, I was able to use the following example. Works great. My next challenge is to the data when the second parameter exists. The device IDs can vary in length from about 10 to 26 characters.
SELECT
RIGHT(Regexp_extract(protoPayload.resource,r'[\?&]([^&]+)'),
length(Regexp_extract(protoPayload.resource,r'[\?&]([^&]+)'))-10) as Device_ID
FROM logs
What I would like is just the values from the querystring device_ID such as:
123456
78ec9b4a56
Assuming you have just 1 query string per record then you can do this:
SELECT REGEXP_EXTRACT(protoPayload.resource, r'device_ID=(.*)$') as device_id FROM mytable
The part within the parentheses will be captured and returned in the result.
If device_ID isn't guaranteed to be the last parameter in the string, then use something like this:
SELECT REGEXP_EXTRACT(protoPayload.resource, r'device_ID=([^\&]*)') as device_id FROM mytable
One approach is to split protoPayload.resource into multiple service entries, and then apply regexp - this way it will support arbitrary number of device_id, i.e.
select regexp_extract(service_entry, r'device_ID=(.*$)') from
(select split(protoPayload.resource, ' ') service_entry from
(select
'/service.html?device_ID=123456 /service.html?v=2&device_ID=78ec9b4a56'
as protoPayload.resource))
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production.
I have a table in the below format.
Name Department
Johny Dep1
Jacky Dep2
Ramu Dep1
I need an output in the below format.
Dep1 - Johny,Ramu
Dep2 - Jacky
I have tried the 'LISTAGG' function, but there is a hard limit of 4000 characters. Since my db table is huge, this cannot be used in the app. The other option is to use the
SELECT CAST(COLLECT(Name)
But my framework allows me to execute only select queries and no PL/SQL scripts.Hence i dont find any way to create a type using "CREATE TYPE" command which is required for the COLLECT command.
Is there any alternate way to achieve the above result using select query ?
You should add GetClobVal and also need to rtrim as it will return delimiter in the end of the results.
SELECT RTRIM(XMLAGG(XMLELEMENT(E,colname,',').EXTRACT('//text()')
ORDER BY colname).GetClobVal(),',') from tablename;
if you cant create types (you can't just use sql*plus to create on as a one off?), but you're OK with COLLECT, then use a built-in array. There's several knocking around in the RDBMS. run this query:
select owner, type_name, coll_type, elem_type_name, upper_bound, length
from all_coll_types
where elem_type_name = 'VARCHAR2';
e.g. on my db, I can use sys.DBMSOUTPUT_LINESARRAY which is a varray of considerable size.
select department,
cast(collect(name) as sys.DBMSOUTPUT_LINESARRAY)
from emp
group by department;
A derivative of #anuu_online but handle unescaping the XML in the result.
dbms_xmlgen.convert(xmlagg(xmlelement(E, name||',')).extract('//text()').getclobval(),1)
For IBM DB2, Casting the result to a varchar(10000) will give more than 4000.
select column1, listagg(CAST(column2 AS VARCHAR(10000)), x'0A') AS "Concat column"...
I end up in another approach using the XMLAGG function which doesn't have the hard limit of 4000.
select department,
XMLAGG(XMLELEMENT(E,name||',')).EXTRACT('//text()')
from emp
group by department;
You can use:
SELECT department
, REGEXP_REPLACE(XMLCAST(XMLAGG(XMLELEMENT(x, name, ',')) AS CLOB), ',$')
FROM emp
GROUP BY department
it will return CLOB that has no size limit, handles correctly XML entity escapes and separators.
Instead of REGEXP_REPLACE(..., ',$')) you can use RTRIM(..., ','), which should be faster, but will remove all separators from the end of the result (including those that can appear in name at the end, or previous ones if last names are empty).
I use C++ Builder 6.0
I use TADODataSet execute following SQL statement:
SELECT Id, SUM(Saldo) AS Saldo
FROM Table
GROUP BY Id
I use this DataSet only for reporting. No need update date back to database.
When I try to modify field "Saldo"
adospCard->Edit();
adospCard->FieldByName("Saldo")->AsFloat=0.0;
adospCard->Post();
I get error:
Field 'Saldo' cannot be modified.
I add this line
adospCard->FieldByName("Saldo")->ReadOnly=false;
and error no more occurred, but field 'Saldo' has not changed.
adospCard->Edit();
//adospCard->FieldByName("Saldo")->AsFloat=1536.5
adospCard->FieldByName("Saldo")->AsFloat=0.0;
//adospCard->FieldByName("Saldo")->AsFloat=0
adospCard->Post();
//adospCard->FieldByName("Saldo")->AsFloat=1536.5
Howe to change ‘Saldo’ field value?
Add a calculated field to your dataset.
Calculate the right value for Saldo
in this calculated field (you can
use Saldo as source for it if you
want to)
display this calculated field in your report in
stead of the Saldo field.
Edit:
For examples of how to add calculated fields, see for instance here, here and here.
--jeroen
As ldsandon said, you cannot modify the "Saldo" field as it is computed.
If you need to set the value to zero when Id is "something" you are better off doing it in your query. The best approach depends on the criteria for setting the value to zero.
Or, save the results of the original query in a temp table then modify that before returning the results to the report.
Finally, what reporting tool are you using? Can that do the "Saldo = 0" change when rendering the report?
Consider storing your result in a ClientDataset - if you can be assured the result isn't too large.
I don't use "TADODataSet" so the following may not apply :)...
When I do the same (or similar) using my DB of choice (i.e. Advantage Database Server) I would use the INTO clause, albeit, with a TSQLQuery component (with the RequestLive property enabled). For example:
SELECT Id, SUM(Saldo) AS Saldo INTO #TempTable FROM Table GROUP BY Id