Re: ERROR: there is no parameter $1

Поиск
Список
Период
Сортировка
От Kevin Jenkins
Тема Re: ERROR: there is no parameter $1
Дата
Msg-id 449762C2.5080704@rakkar.org
обсуждение исходный текст
Ответ на Re: ERROR: there is no parameter $1  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: ERROR: there is no parameter $1  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Tom Lane wrote:
> Kevin Jenkins <gameprogrammer@rakkar.org> writes:
>> I get ERROR:  there is no parameter $1.
>
>> INSERT INTO FileVersionHistory(applicationID, filename, createFile,
>> changeSetID, userName) VALUES (1,$1::text,FALSE,9,'postgres');
>
>> outTemp[0]=deletedFiles.fileList[fileListIndex].filename;
>> outLengths[0]=strlen(deletedFiles.fileList[fileListIndex].filename);
>> formats[0]=0;
>> result = PQexecParams(pgConn, query,1,0,outTemp,outLengths,formats,0);
>
>> There obviously is a $1 parameter.
>
> Hm, nothing obviously wrong there.  What PG version is this exactly?
> Can you supply a self-contained test case?
>
>             regards, tom lane

I made the smallest test case that I can and uploaded it here:
http://www.rakkarsoft.com/PostgreBug.zip

I'm sorry in advance I couldn't make it smaller but hopefully this is
still manageable.

It assumes you have C:\Program Files\PostgreSQL\8.1 in the project
settings for the include path.

To run,
1. Open the solution
2. Build the project "Autopatcher"
3. Build the solution "AutopatcherPostgreSQL"
4. Put a breakpoint on line 346 of PostgreSQLRepository.cpp in the
solution AutopatcherPostgreSQL (in the directory
"DependentExtensions\AutopatcherPostgreSQL")

The code at that breakpoint should be at:
sprintf(query, "INSERT INTO FileVersionHistory(applicationID,
filename, createFile, changeSetID, userName) VALUES (%i,
$1::text,FALSE,%i,'%s');", applicationID, changeSetId, userName);

5. Run the project autopatcher.
6. Hit 's' for server.  It will assume the username is postgre (if
this is wrong then just modify AutopatcherTest.cpp - it should be
obvious).
7. Enter the password
8. Hit 'c' for create database
9. Hit 'a' for add application.  Name it whatever you want.
10. Hit 'u' for update revision.  Use a directory with some temporary
files when prompted
11. Delete one of the files in the directory you specified in 10.
12. Hit 'u' again with the same arguments.

At this point you should hit the breakpoint.

What this does is populates a table with the files in that directory.
  You then delete one of the files, it detects it, and adds it to the
table.

The bug is that, at the line of the breakpoint, it returns the error I
described rather than correctly processing the INSERT.


В списке pgsql-general по дате отправления:

Предыдущее
От: Jerry LeVan
Дата:
Сообщение: Re: psql for winxp?
Следующее
От: "shyju c.k"
Дата:
Сообщение: incremental backup?