database,delphi,calculated-field,tdatasetRelated issues-Collection of common programming errors
Rachel Gallen
database index db2 non-clustered-index
Can you please tell me how to create a nonclustered index in DB2 ?I am not able to find any commands for that. I want to create one index on three columns. I tried:CREATE INDEX IX_ACCOUNTNOTES_DATE_TYPE ON CPMTD.ACCOUNT_NS (ACCOUNT_ID,CREATED_DATE,NOTE_TYPE);”Its giving me error as:DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=;;TED_DATE,NOTE_TYPE );END-OF-STATEMENT, DRIVER=3.50.152 Message: An unexpected token “” was found following “”. Expected tokens may include: “TED_DATE,
pritzo
sql database
Suppose I have a SQL Query that isn’t really “nice”.The SQL Query has a lot inner join with long conditions, and finally a simple “where” statement. Now suppose I make a View that corresponds to that SQL Query, excepting the final “where” statement. So that instead of make that long query, I use the view and simply add the “where” statement.My question is the following: Which one would have best performance?I’m not sure if the “View” option corresonds to two sql statement, instead of the one sql
otter606
database liquibase
I am trying to integrate Liquibase with our Spring/Hibernate web-app to replace our existing home-grown solution. So far Liquibase is great, but there’s one use-case that is important to us and I don’t know if Liquibase supports it or not, which is this:We deploy our web app to clients who host the webapp and the database (MySQL) themselves. So, supposing we deploy to our first client (client1) with a new clean DB schema ( generated from Hibernate mappings) and no items in Liquibase changeset.
ppeterka
php database
I’m not 100% comfortable with a PHP class defined here: mysqliI stripped out the guts to shorten it somewhat and get a parse error at runtime.<?phpfunction query($x) { if ($x > 8) {return ‘greater than eight!’; } else {return true; } } else {exit();} } print query(7);It’s the same construct (I think) as the original, isn’t it? Apart from the signature and the body of the method of course. I haven’t come across an if else else clause before and it somehow doesn’t ‘feel right’ for me at
Thiago Moraes
database oracle logging plsql
I have one Oracle XXg database running on a remote client and it’s not possible to reproduce the environment for tests. Right now, there is one stored procedure that’s returning an unexpected value (it’s just an integer that should be zero but is returning some other number) and I want to discover which value is that. I can edit the functions and procedures, but I can’t call the function without using a big java application that I cannot debug. Is there any way to log the return value to a text
Lukas
php database class
I’m working on a project for school (Deadline in June; plenty of time given ^^).At the moment there is a database in the conf.php (every other .php includes this one; it has a variable which references a mysqli-object) and i am accessing the database in every method of a classs via “global $db_conn;”. The problem is, if I open just the class.php, it doesn’t include the conf.php and it throws errors. So I thought about adding an private instance/static variable for the mysqli-Object with EVERY ob
user2644708
python database django error-handling
am trying to fech data from database using count function in django, whenever i try this code using tablename.objects.count() than its working fine. ehan i try this :-views.py:-def home(request):getsessionuserid = request.session[‘getuser_id’]getlatestproject = jobs.objects.all()getcountvalues = applicationform.objects.count(user_id=getsessionuserid) getinterviewcount = interview.objects.count() getjobscount = jobs.objects.count()return render_to_response(‘home.html’,{ ‘user’: request.user,
Shankar Damodaran
php mysql database oop
I don’t know why I am having this error. I’m using WampServer. I am trying to configure my database thru OOP and I came up with this error.Parse error: syntax error, unexpected ‘?>’, expecting function(T_FUNCTION)<?phpClass Database{private $_host = null;private $_user = null;private $_pass = null;private $_db = null;var $con = false;public function connects($host, $user, $pass, $db){$this->_host = $host;$this->_user = $user;$this->_pass = $pass;$this->_db = $db;$this->con = my
Developer
java database hibernate
I’m using Hibernate to read data from database I used the following named query:<query name=”getTable”>select tbl from ? as tbl order by col</query>In the DAO public List<Object> selectTables(String className){Query query = session.getNamedQuery(“getTable”);query.setParameter(0, className);return (List<Object>)query.list();}When I run the code, I get the following exception14:13:57,463 ERROR SessionFactoryImpl:405 – Error in named query: getTable org.hibernate.hql.ast.Que
GeekedOut
mysql sql database
I have this database query:select scheduled_hike_id , hike_date , hike_title , hike_group_id , hike_privacy , hike_description , DAYOFMONTH(hike_date) , DAYNAME(hike_date) , YEAR(hike_date) , MONTH(hike_date) from scheduled_hikes where is_cancelled is null and hike_date > DATE_ADD(NOW(), INTERVAL -1 DAY) and show_on_home_page = 1 order by hike_date limit 4It returns what I expected. When I add a clause “and hike_privacy != 3” it re
lkessler
delphi replace components
In a Delphi Form, I would like to replace one visual component with another. Example: I want to replace a Panel component with an ElPanel from a 3rd party package. I would like all identical properties and events of the first component to be transferred to the new one, and all the components that belong to the first component (e.g. Toolbars, memos,status bars, etc.) to end up placed on the new component exactly where they were on the first one.Is there a best/easiest way to do this other than ad
frogb
windows delphi performancecounter
I am trying to obtain the CPU utilization of each of the (up to 200) threads in my (Delphi XE) application. To prepare for this I pass to PdhExpandWildCardPath a string ‘\Thread(myappname/*)\% Processor Time’. However (on Win7/64) the buffer returned from this function returns a string for every thread running in the system, in other words it seems to have treated the input as if it were ‘\Thread(*/*)\% Processor Time’. This was unexpected. The same happens when I subsequently expand a string
Tamm
delphi xpath msxml
Can I use Xpath node set function position() in Delphi’s function selectNodes() to select only a certain number of element from a node list? If I do like this: selectNodes(‘Item[1]’)its all fine and I get the element with index 1, but when I try selectNodes(‘Item[position()<10]’)I get exception ‘unknown method’, when I try selectNodes(‘Item[<10]’)I get ‘unexpected token <‘. Im using delphi7 and I also imported new type library into my project with newer versions of msxml.
Sebastian Zartner
delphi imap indy indy10
RFC 3501 states in section 6.1.2. that you should use the NOOP command for polling.Though in TIdIMAP4 there’s only the KeepAlive method using it, which is implemented as a procedure, i.e. doesn’t return anything.So how to check for status updates like e.g. new messages or read status changes? I.e. how can I do manual polling with TIdIMAP4? Which methods and properties are involved in doing that? And how to get the (U)IDs these messages?Or is it even possible to use the IDLE command specified in
Runner
delphi indy
When I disconnect echo client like :EchoClient1.Disconnect;client disconnects fine… but EchoServer does NOT EVEN register client disconnection and it ends up with high process usage !?!?in every example and every doc it says that calling EchoClient.Disconnect is sufficient !anyone, any idea ?(I am working in Win7, could that be a problem ?)Server code :procedure TForm2.EServerConnect(AContext: TIdContext); beginSrvMsg.Lines.Add(‘ECHO Client connected !’); end;procedure TForm2.EServerDisconn
dahook
delphi generics soap delphi-xe2
For reasons not really relevant to the question I want to use generics in my TRemotable classes. I’ve found that Soap.OPToSOAPDomConv.pas has some problems with this. It’s using the old RTTI which I guess can’t handle generics so the classes is not serialized into xml.I’ve managed to change Soap.OPToSOAPDomConv.pas so that it works with generics. My main question is if it is considered ok to do changes in the Delphi source files? If it isn’t, is there a better way to do this? As long as it’s jus
Sertac Akyuz
delphi override
After having read Ian Boyd’s constructor series questions (1, 2, 3, 4), I realize I don’t quite grasp the literal meaning on what’s being hidden.I know (correct me if I’m wrong) override’s sole purpose is to be able to have polymorphic behavior, so that run-time can resolve a method depending on the actual type of an instance – as opposed to the declared type. Consider the following code:typeTBase = classprocedure Proc1; virtual;procedure Proc2; virtual;end;TChild = class(TBase)procedure Proc1;
Holgerwa
delphi omnithreadlibrary
I am creating an OmniWorker-Task to do some data processing. So far, the Task is able to receive and send messages from/to other tasks.Now I need to implement the main function for this task. This function will run continuously and do the data processing, while messages will modify it’s behavior.But where do I put this main function? Is there anything like an “Execute”-method for an OmniWorker, that I need to implement?
Terry
delphi win32gui
I’ve got a Delphi app that is running in an environment where it gets minimized by another aggressive app that is trying to seize the screen entirely (it’s POS stuff). When a second application is started it get hunts down the windows and minimizes them, probably by enumerating the windows and hitting them with a ‘ShowWindow(handle,SW_MINIMIZE)’.It seems to me that the thing to do is to pick up these commands and block resize/minimize messages to the window. I’ve tried hacking around a few handl
mjn
delphi console
According to System.pas, it is documented as True if compiled as console app. In System.pas, there is also an assignment{$IFDEF LINUX}IsConsole := True; …I have a strange problem where an app is launched from a Delphi app, using ShellExecute, and then it runs into this code, raising the (unexpected) exceptionif System.IsConsole thenraise Exception.Create(Msg)The application is not compiled with Project/Options/Linking/Generate console application. What else could set IsConsole to true?Note tha
Wodzu
delphi dataset ado field calculated-field
Scenerio:I want to add a calculated field to given (any) dataset during runtime. I don’t know any other way to obtain a dataset structure other than performing DataSet.Open method.But the Open method causes that atleast one row of a data needs to be transfered from server to client. Then I need to close the DataSet, add field and reopen it. This is an unnecessery overhead in my opinion. Is there a better way of doing this? Please not that I want to be able adding a calcuated field to any dataset
kobik
database delphi calculated-field tdataset
As in the question’s title, I argue with a colleague about how calculated fields should be used. From my knowledge, calculated fields are created at runtime as in the François’s answer on the question Adding a calculated field to a Query at run time. On the same question there is another answer, from sabri.arslan which suggest to change an existing field to a calculated one(code bellow) variniting:boolean;procedure TSampleForm.dsSampleAfterOpen(DataSet: TDataSet); vari:integer;dmp:tfield; begin
Ebad gh
jquery forms calculated-field
i want a jquery source to calculate my form<form><input type=”radio” name=”type” value=”1000″> $1000<input type=”radio” name=”type” value=”2000″> $2000<input type=”radio” name=”type” value=”3000″> $3000<input type=”radio” name=”type” value=”4000″> $4000<input type=”radio” name=”type” value=”5000″> $5000<select name=”number”><option name=”number” value=”1″>1</option><option name=”number” value=”1″>2</option><option name=”number”
v1n_vampire
javascript calculated-field
I can’t get my javascript calculation works for cart.My HTML part got many other input element except those with “price-” and “qty-” id. Somehow the other input element mess up the array I guess. Sample:<input type=”hidden” id=”price-1″ value=”10.50″/> <input type=”hidden” id=”qty-1″ value=”1″/> <input type=”hidden” id=”shipFee-1″ value=”4.00″/> <input type=”hidden” id=”tax-1″ value=”0.70″/><input type=”hidden” id=”price-2″ value=”19.20″/> <input type=”hidden” id
William Leader
delphi data-binding tdataset
I am looking for a way to provide a ListSource to a TDBLookupComboBox in delphi without having an actual table on the database server to draw that list from. The DataField for the Combo Box is a 1 character field that contains a coded value such as ‘A’ = ‘Drivers License’, ‘B’ = ‘Passport’, ‘C’ = ‘Library Card’, etc. That is to say that the table only contains A, B, or C. The application is responsible for Displaying ‘Drivers License’ in the GUI. Normally a database might have a look up table bu
kobik
database delphi calculated-field tdataset
As in the question’s title, I argue with a colleague about how calculated fields should be used. From my knowledge, calculated fields are created at runtime as in the François’s answer on the question Adding a calculated field to a Query at run time. On the same question there is another answer, from sabri.arslan which suggest to change an existing field to a calculated one(code bellow) variniting:boolean;procedure TSampleForm.dsSampleAfterOpen(DataSet: TDataSet); vari:integer;dmp:tfield; begin
Web site is in building