dbo | simple PHP database objects
kandi X-RAY | dbo Summary
kandi X-RAY | dbo Summary
simple PHP database objects. This is a cut down version of mod_dbo, the database object module from the aphplix project. Some features (including error handling and security features) have been removed to simplify the code. The code uses object oriented PHP 5 features including: * Public, private & protected methods and properties. * Static methods. * Class inheritance. * Object overloading. * Implementation of an iterator. * Use of the singleton design pattern. * Use of the __clone() method. A sample script is included (sample.php) which demonstrates the functionality of mod_dbo. use the following mysql commands to create the database & user required for the sample script.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of dbo
dbo Key Features
dbo Examples and Code Snippets
Community Discussions
Trending Discussions on dbo
QUESTION
I'm having some performance issues due to full scans being run on some larger tables for a report. I've narrowed things down to this section of the query but can't figure out how to avoid the scans without changing the results.
To explain, we have a data archiving system that copies data from the live table to the archive table daily. The data is not removed from the live table until a period of time has passed. This results in a state where the live table and archive table will both have the same rows, but the data in the rows may not match.
This rules out a UNION query (which would eliminate the full scans). The requirements are for the report to show live data, so I also can't query just the archive table.
Any ideas? Here is the query. The primary keys of both tables is DetailIdent, but I do have an index on OrderIdent, as it's a foreign key back to the parent table. You can see that we take the main table results if they exist, otherwise we fall back to the archive data.
...ANSWER
Answered 2022-Mar-21 at 21:48The filtering predicate COALESCE(RegOD.OrderIdent,ArcOD.OrderIdent) = 717010
is killing performance and it's forcing the engine to perform a full scan first, and filter data later.
Rephrase the COALESCE()
function and let the engine do its work. With a bit of luck the engine will be smart enough to find the optimization. In this case the query can take the form:
QUESTION
I have a requirement to build a SSIS package that sends HTML formatted emails and then saves the emails as tiff files. I have created a script task that processes the necessary records and then coverts the HTML code to the tiff. I have split the process into separate packages, the email send works fine the converting HTML to tiff is causing the issue.
When running the package manually it will process all files without any issues. my test currently is about 315 files this needs to be able to process at least 1,000 when finished with the ability to send up to 10,000 at one time. The problem is when I set the package to execute using SQL Server Agent it stops at 207 files. The package is deployed to SQL Server 2019 in the SSIS Catalog
What I have tried so far
I started with the script being placed in a SSIS package and deployed to the server and calling the package from a step (works 99.999999% of the time with all packages) tried both 32 and 64 bit runtime. Never any error messages just Unexpected Termination when looking at the execution reports. When clicking in the catalog and executing package it will process all the files. The SQL Server Agent is using a proxy and I also created another proxy account with my admin credentials to test for any issues with the account.
Created another package to call the package and used the Execute Package Task to call the first package, same result 207 files. Changed the execute Process task to an Execute SQL Task and tried the script that is created to manually start a package in the catalog 207 files. Tried executing the script from the command line both through the other SSIS package and the SQL Server Agent directly same results 207 files. If I try any of those methods directly outside SQL Server Agent the process runs no issues.
I converted the script task to a console application and it works processing all the files. When calling the executable file from any method from the SQL Server Agent it once again stops at the 207 files.
I have consulted with the companies DBA and Systems teams and they have not found anything that could be causing this error. There seems to be some type of limit that no matter the method of execution SQL Server Agent will not allow. I have mentioned looking at third-party applications but have been told no.
I have included the code below that I have been able to piece together. I am a SQL developer so C# is outside my knowledge base. Is there a way to optimize the code so it only uses one thread or does a cleanup between each letter. There may be a need for this to create over ten thousand letters at certain times.
Update
I have replaced the code with the new updated code. The email and image creation are all included as this is what the final product must do. When sending the emails there is a primary and secondary email address and depending on what email address is used it will change what the body of the email contains. When looking at the code there is a section of try catch that sends to primary when indicated to and if that fails it send to secondary instead. I am guessing there is a much cleaner way of doing that section but this is my first program as I work in SQL for everything else.
Thank You for all the suggestions and help.
Updated Code
...ANSWER
Answered 2022-Mar-07 at 16:58I have resolved the issue so it meets the needs of my project. There is probably a better solution but this does work. Using the code above I created an executable file and limited the result set to top 100. Created a ssis package with a For Loop that does a record count from the staging table and kicks off the executable file. I performed several tests and was able to exceed the 10,000 limit that was a requirement to the project.
QUESTION
I am trying to make sense of the following error that I started getting when I setup my python code to run on a VM server, which has 3.9.5 installed instead of 3.8.5 on my desktop. Not sure that matters, but it could be part of the reason.
The error
...ANSWER
Answered 2022-Feb-11 at 16:30Is pyodbc becoming deprecated?
No. For at least the last couple of years pandas' documentation has clearly stated that it wants either a SQLAlchemy Connectable
(i.e., an Engine
or Connection
object) or a SQLite DBAPI connection. (The switch-over to SQLAlchemy was almost universal, but they continued supporting SQLite connections for backwards compatibility.) People have been passing other DBAPI connections (like pyodbc Connection
objects) for read operations and pandas hasn't complained … until now.
Is there a better way to achieve similar results without warning?
Yes. You can take your existing ODBC connection string and use it to create a SQLAlchemy Engine
object as described here:
QUESTION
I have two procedures, one outer procedure and one inner procedure, where I would like to understand the behaviour of the error handling. The inner procedure provokes an error and is trying to insert something in the catch block into a table. After that the error is raised, passed to the outer procedure and then should roll back the transaction.
I'm trying to understand why my code is throwing the error message:
...ANSWER
Answered 2022-Jan-05 at 17:08I would like to understand what is making this transaction a "doomed" transaction even though the XACT_ABORT is set to off.
XACT_STATE()
is -1
in the catch block so the transaction is doomed.
QUESTION
Ok, I'm totally lost on deadlock issue. I just don't know how to solve this.
I have these three tables (I have removed not important columns):
...ANSWER
Answered 2021-Dec-26 at 12:54You are better off avoiding serializable isolation level. The way the serializable guarantee is provided is often deadlock prone.
If you can't alter your stored procs to use more targeted locking hints that guarantee the results you require at a lesser isolation level then you can prevent this particular deadlock scenario shown by ensuring that all locks are taken out on ServiceChange
first before any are taken out on ServiceChangeParameter
.
One way of doing this would be to introduce a table variable in spGetManageServicesRequest
and materialize the results of
QUESTION
Suppose I have a table like this,
id tagId 1 1 1 2 1 5 2 1 2 5 3 2 3 4 3 5 3 8I want to select id's where tagId includes both 2 and 5. For this fake data set, It should return 1 and 3.
I tried,
...ANSWER
Answered 2021-Dec-24 at 21:17One option is to count the number of distinct tagId
s (from the ones you're looking for) each id
has:
QUESTION
In Mongodb I have this field:
...ANSWER
Answered 2021-Dec-17 at 19:10It should be
QUESTION
I'm trying to create a procedure that will:
- take any number as an input e.g.
102
- find the sequence range it belongs e.g.
100 to 103
- return a suggested next number to the user e.g.
104
The table itself will look something like this:
Num 100 101 102 103 110 111 112 113 114 115 120 121Ideally the output of the query would return something like this:
start end nextNr 100 103 104 110 115 116 120 121 122I this what I'm trying to do is linked to some kind of Gap and Island technique. I had a look at trying something from here but couldn't quite get it to work. Gaps and Islands Link
This is what I tried coming up with...
...ANSWER
Answered 2021-Dec-09 at 16:05Perhaps this will help.
QUESTION
I have a stored procedure it takes comma separated string as input. Which might be too large some times approximately more than 8 thousand characters or more. In that situation, query performance goes down sometimes. And I think there is a limitation for the character length inside the IN
clause. For that, sometimes I get errors. Now, I need to know is it better to use a Custom TABLE TYPE as parameter and use Inner JOIN
to find the result. If it is then why is it. Here are my 2 stored procedures (minimal code):
ANSWER
Answered 2021-Nov-18 at 06:53For the very best performance you can use this function:
QUESTION
I have setup a local SPARQL endpoint with DBPedia database using Openlink Virtuoso through this guide. Then I tried to query my database through Python with the help of RDFLib and SPARQLWrapper.
Problem is the time it take for a query (through Python) is very long, usually 2 to 3 seconds before I can get a result back. But when I use my browser to query directly at the endpoint (go to localhost from Chrome), for the same type of query I get the result instantly.
I don't think it's a problem with my Python code, because if I keep the same code and just change to DBPedia endpoint, I can get a query result within 0.1 to 0.2 seconds. My database file is around 6GB and I have configured the ini file to use more memory as instructed.
Anyone can troubleshoot the problem for me? I'm thinking I need to tweak some parameter with the virtuoso server but I don't know where to start. Thanks!
Here's what my query looks like (DBPedia endpoint or local endpoint directly from Chrome: almost instant result; local endpoint through Python: 2+ seconds):
...ANSWER
Answered 2021-Nov-12 at 21:43As I suggested in the comments, which did the trick --
You might try changing
localhost
to127.0.0.1
. DNS is often the cause of weirdly slow things like this.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install dbo
PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see visualstudio.microsoft.com. You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page