Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Christian Butz
VTK
Commits
9519226c
Commit
9519226c
authored
Feb 22, 2008
by
Timothy M. Shead
Browse files
COMP: Working to isolate a reference-counting bug
parent
0e0e2f2f
Changes
1
Show whitespace changes
Inline
Side-by-side
IO/Testing/Cxx/TestMySQLDatabase.cxx
View file @
9519226c
...
...
@@ -22,17 +22,20 @@
// this test.
#include
"vtkMySQLDatabase.h"
#include
"vtkSQLQuery.h"
#include
"vtkRowQueryToTable.h"
#include
"vtkSQLQuery.h"
#include
"vtkSmartPointer.h"
#include
"vtkStdString.h"
#include
"vtkTable.h"
#include
"vtkToolkits.h"
#include
"vtkVariant.h"
#include
"vtkVariantArray.h"
#include
"vtkToolkits.h"
int
TestMySQLDatabase
(
int
,
char
**
const
)
{
vtkMySQLDatabase
*
db
=
vtkMySQLDatabase
::
SafeDownCast
(
vtkSQLDatabase
::
CreateFromURL
(
VTK_MYSQL_TEST_URL
)
);
vtkSmartPointer
<
vtkMySQLDatabase
>
db
;
db
.
TakeReference
(
vtkMySQLDatabase
::
SafeDownCast
(
vtkSQLDatabase
::
CreateFromURL
(
VTK_MYSQL_TEST_URL
)
)
);
bool
status
=
db
->
Open
();
if
(
!
status
)
...
...
@@ -41,7 +44,10 @@ int TestMySQLDatabase( int, char ** const )
return
1
;
}
vtkSQLQuery
*
query
=
db
->
GetQueryInstance
();
vtkSmartPointer
<
vtkSQLQuery
>
query
;
query
.
TakeReference
(
db
->
GetQueryInstance
());
/*
vtkStdString createQuery( "CREATE TABLE IF NOT EXISTS people (name TEXT, age INTEGER, weight FLOAT)" );
cout << createQuery << endl;
query->SetQuery( createQuery.c_str() );
...
...
@@ -113,7 +119,8 @@ int TestMySQLDatabase( int, char ** const )
cerr << query->GetFieldName( col );
}
cerr << endl;
vtkVariantArray
*
va
=
vtkVariantArray
::
New
();
vtkSmartPointer<vtkVariantArray> va = vtkSmartPointer<vtkVariantArray>::New();
while ( query->NextRow( va ) )
{
for ( int field = 0; field < va->GetNumberOfValues(); ++ field )
...
...
@@ -126,10 +133,9 @@ int TestMySQLDatabase( int, char ** const )
}
cerr << endl;
}
va
->
Delete
();
cerr << endl << "Using vtkRowQueryToTable to execute query:" << endl;
vtkRowQueryToTable
*
reader
=
vtkRowQueryToTable
::
New
();
vtkSmartPointer<
vtkRowQueryToTable
>
reader =
vtkSmartPointer<
vtkRowQueryToTable
>
::New();
reader->SetQuery( query );
reader->Update();
vtkTable* table = reader->GetOutput();
...
...
@@ -150,10 +156,7 @@ int TestMySQLDatabase( int, char ** const )
query->SetQuery( "DROP TABLE people" );
query->Execute();
reader
->
Delete
();
query
->
Delete
();
db
->
Delete
();
*/
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment