mirror of
https://github.com/gnustep/libs-gsweb.git
synced 2025-04-22 15:00:45 +00:00
* Examples/WebBookStore1: New example.
* Examples/WebBookStore1/Application.h, * Examples/WebBookStore1/Application.m, * Examples/WebBookStore1/DirectAction.h, * Examples/WebBookStore1/DirectAction.m, * Examples/WebBookStore1/GNUmakefile, * Examples/WebBookStore1/Main.h, * Examples/WebBookStore1/Main.m, * Examples/WebBookStore1/Session.h, * Examples/WebBookStore1/Session.m, * Examples/WebBookStore1/WebBookStore1_main.m, * Examples/WebBookStore1/BookStore.eomodeld/Author.plist, * Examples/WebBookStore1/BookStore.eomodeld/Book.plist, * Examples/WebBookStore1/BookStore.eomodeld/Customer.plist, * Examples/WebBookStore1/BookStore.eomodeld/Order.plist, * Examples/WebBookStore1/BookStore.eomodeld/OrderPos.plist, * Examples/WebBookStore1/BookStore.eomodeld/index.eomodeld, * Examples/WebBookStore1/Main.gswc/Main.gswd, * Examples/WebBookStore1/Main.gswc/Main.gswi, * Examples/WebBookStore1/Main.gswc/Main.html, * Examples/WebBookStore1/WebServerResources/Insert.png, * Examples/WebBookStore1/WebServerResources/Save.png, * Examples/WebBookStore1/WebServerResources/Delete.png, * Examples/WebBookStore1/WebServerResources/CreateTables.png, * Examples/WebBookStore1/WebServerResources/DropTables.png: New files. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gsweb/trunk@20316 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
dc31139434
commit
9e5e84d05b
25 changed files with 627 additions and 0 deletions
29
ChangeLog
29
ChangeLog
|
@ -1,3 +1,32 @@
|
|||
2004-11-08 David Ayers <d.ayers@inode.at>
|
||||
|
||||
* Examples/WebBookStore1: New example.
|
||||
* Examples/WebBookStore1/Application.h,
|
||||
* Examples/WebBookStore1/Application.m,
|
||||
* Examples/WebBookStore1/DirectAction.h,
|
||||
* Examples/WebBookStore1/DirectAction.m,
|
||||
* Examples/WebBookStore1/GNUmakefile,
|
||||
* Examples/WebBookStore1/Main.h,
|
||||
* Examples/WebBookStore1/Main.m,
|
||||
* Examples/WebBookStore1/Session.h,
|
||||
* Examples/WebBookStore1/Session.m,
|
||||
* Examples/WebBookStore1/WebBookStore1_main.m,
|
||||
* Examples/WebBookStore1/BookStore.eomodeld/Author.plist,
|
||||
* Examples/WebBookStore1/BookStore.eomodeld/Book.plist,
|
||||
* Examples/WebBookStore1/BookStore.eomodeld/Customer.plist,
|
||||
* Examples/WebBookStore1/BookStore.eomodeld/Order.plist,
|
||||
* Examples/WebBookStore1/BookStore.eomodeld/OrderPos.plist,
|
||||
* Examples/WebBookStore1/BookStore.eomodeld/index.eomodeld,
|
||||
* Examples/WebBookStore1/Main.gswc/Main.gswd,
|
||||
* Examples/WebBookStore1/Main.gswc/Main.gswi,
|
||||
* Examples/WebBookStore1/Main.gswc/Main.html,
|
||||
* Examples/WebBookStore1/WebServerResources/Insert.png,
|
||||
* Examples/WebBookStore1/WebServerResources/Save.png,
|
||||
* Examples/WebBookStore1/WebServerResources/Delete.png,
|
||||
* Examples/WebBookStore1/WebServerResources/CreateTables.png,
|
||||
* Examples/WebBookStore1/WebServerResources/DropTables.png:
|
||||
New files.
|
||||
|
||||
2004-11-03 David Ayers <d.ayers@inode.at>
|
||||
|
||||
* GSWeb.framework/GSWRepetition.h: Only use ASCII characters
|
||||
|
|
13
Examples/WebBookStore1/Application.h
Normal file
13
Examples/WebBookStore1/Application.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#ifndef INC_Application_h_
|
||||
#define INC_Application_h_
|
||||
|
||||
#include <GSWeb/GSWeb.h>
|
||||
|
||||
@interface Application : GSWApplication
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
19
Examples/WebBookStore1/Application.m
Normal file
19
Examples/WebBookStore1/Application.m
Normal file
|
@ -0,0 +1,19 @@
|
|||
#include "Application.h"
|
||||
|
||||
@implementation Application
|
||||
|
||||
- (id)init
|
||||
{
|
||||
if ((self = [super init]))
|
||||
{
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
34
Examples/WebBookStore1/BookStore.eomodeld/Author.plist
Normal file
34
Examples/WebBookStore1/BookStore.eomodeld/Author.plist
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
attributes = (
|
||||
{
|
||||
allowsNull = Y;
|
||||
columnName = FNAME;
|
||||
externalType = varchar;
|
||||
name = firstName;
|
||||
valueClassName = NSString;
|
||||
width = 30;
|
||||
},
|
||||
{
|
||||
allowsNull = Y;
|
||||
columnName = LNAME;
|
||||
externalType = varchar;
|
||||
name = lastName;
|
||||
valueClassName = NSString;
|
||||
width = 30;
|
||||
},
|
||||
{
|
||||
columnName = PID;
|
||||
externalType = integer;
|
||||
name = pid;
|
||||
valueClassName = NSNumber;
|
||||
valueType = i;
|
||||
}
|
||||
);
|
||||
attributesUsedForLocking = (pid, firstName, lastName);
|
||||
className = EOGenericRecord;
|
||||
classProperties = (firstName, lastName);
|
||||
externalName = BSAUTHOR;
|
||||
fetchSpecificationDictionary = {};
|
||||
name = Author;
|
||||
primaryKeyAttributes = (pid);
|
||||
}
|
44
Examples/WebBookStore1/BookStore.eomodeld/Book.plist
Normal file
44
Examples/WebBookStore1/BookStore.eomodeld/Book.plist
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
attributes = (
|
||||
{
|
||||
allowsNull = Y;
|
||||
columnName = FK_AUTHOR;
|
||||
externalType = integer;
|
||||
name = fk_author;
|
||||
valueClassName = NSNumber;
|
||||
valueType = i;
|
||||
},
|
||||
{
|
||||
columnName = PID;
|
||||
externalType = integer;
|
||||
name = pid;
|
||||
valueClassName = NSNumber;
|
||||
valueType = i;
|
||||
},
|
||||
{
|
||||
allowsNull = Y;
|
||||
columnName = TITLE;
|
||||
externalType = varchar;
|
||||
name = title;
|
||||
valueClassName = NSString;
|
||||
width = 30;
|
||||
}
|
||||
);
|
||||
attributesUsedForLocking = (pid, title, fk_author);
|
||||
className = EOGenericRecord;
|
||||
classProperties = (title, author);
|
||||
externalName = BSBOOK;
|
||||
fetchSpecificationDictionary = {};
|
||||
name = Book;
|
||||
primaryKeyAttributes = (pid);
|
||||
relationships = (
|
||||
{
|
||||
destination = Author;
|
||||
isToMany = N;
|
||||
joinSemantic = EOInnerJoin;
|
||||
joins = ({destinationAttribute = pid; sourceAttribute = fk_author; });
|
||||
name = author;
|
||||
ownsDestination = Y;
|
||||
}
|
||||
);
|
||||
}
|
34
Examples/WebBookStore1/BookStore.eomodeld/Customer.plist
Normal file
34
Examples/WebBookStore1/BookStore.eomodeld/Customer.plist
Normal file
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
attributes = (
|
||||
{
|
||||
allowsNull = Y;
|
||||
columnName = FNAME;
|
||||
externalType = varchar;
|
||||
name = firstName;
|
||||
valueClassName = NSString;
|
||||
width = 30;
|
||||
},
|
||||
{
|
||||
allowsNull = Y;
|
||||
columnName = LNAME;
|
||||
externalType = varchar;
|
||||
name = lastName;
|
||||
valueClassName = NSString;
|
||||
width = 30;
|
||||
},
|
||||
{
|
||||
columnName = PID;
|
||||
externalType = integer;
|
||||
name = pid;
|
||||
valueClassName = NSNumber;
|
||||
valueType = i;
|
||||
}
|
||||
);
|
||||
attributesUsedForLocking = (pid, firstName, lastName);
|
||||
className = EOGenericRecord;
|
||||
classProperties = (firstName, lastName);
|
||||
externalName = BSCUSTOMER;
|
||||
fetchSpecificationDictionary = {};
|
||||
name = Customer;
|
||||
primaryKeyAttributes = (pid);
|
||||
}
|
45
Examples/WebBookStore1/BookStore.eomodeld/Order.plist
Normal file
45
Examples/WebBookStore1/BookStore.eomodeld/Order.plist
Normal file
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
attributes = (
|
||||
{
|
||||
allowsNull = Y;
|
||||
columnName = FK_CUSTOMER;
|
||||
externalType = integer;
|
||||
name = fk_customer;
|
||||
valueClassName = NSNumber;
|
||||
valueType = i;
|
||||
},
|
||||
{
|
||||
columnName = PID;
|
||||
externalType = integer;
|
||||
name = pid;
|
||||
valueClassName = NSNumber;
|
||||
valueType = i;
|
||||
}
|
||||
);
|
||||
attributesUsedForLocking = (pid, fk_customer);
|
||||
className = EOGenericRecord;
|
||||
classProperties = (customer, position);
|
||||
externalName = BSORDER;
|
||||
fetchSpecificationDictionary = {};
|
||||
name = Order;
|
||||
primaryKeyAttributes = (pid);
|
||||
relationships = (
|
||||
{
|
||||
destination = Customer;
|
||||
isMandatory = Y;
|
||||
isToMany = N;
|
||||
joinSemantic = EOInnerJoin;
|
||||
joins = ({destinationAttribute = pid; sourceAttribute = fk_customer; });
|
||||
name = customer;
|
||||
},
|
||||
{
|
||||
deleteRule = EODeleteRuleCascade;
|
||||
destination = OrderPos;
|
||||
isToMany = Y;
|
||||
joinSemantic = EOInnerJoin;
|
||||
joins = ({destinationAttribute = fk_order; sourceAttribute = pid; });
|
||||
name = position;
|
||||
ownsDestination = Y;
|
||||
}
|
||||
);
|
||||
}
|
25
Examples/WebBookStore1/BookStore.eomodeld/OrderPos.plist
Normal file
25
Examples/WebBookStore1/BookStore.eomodeld/OrderPos.plist
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
attributes = (
|
||||
{
|
||||
allowsNull = Y;
|
||||
columnName = FK_ORDER;
|
||||
externalType = integer;
|
||||
name = fk_order;
|
||||
valueClassName = NSNumber;
|
||||
valueType = i;
|
||||
},
|
||||
{
|
||||
columnName = PID;
|
||||
externalType = integer;
|
||||
name = pid;
|
||||
valueClassName = NSNumber;
|
||||
valueType = i;
|
||||
}
|
||||
);
|
||||
attributesUsedForLocking = (pid, fk_order);
|
||||
className = EOGenericRecord;
|
||||
externalName = BSORDERPOS;
|
||||
fetchSpecificationDictionary = {};
|
||||
name = OrderPos;
|
||||
primaryKeyAttributes = (pid);
|
||||
}
|
15
Examples/WebBookStore1/BookStore.eomodeld/index.eomodeld
Normal file
15
Examples/WebBookStore1/BookStore.eomodeld/index.eomodeld
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
EOModelVersion = 2;
|
||||
adaptorName = Postgres95;
|
||||
connectionDictionary = {
|
||||
databaseName = BookStore;
|
||||
};
|
||||
entities = (
|
||||
{className = EOGenericRecord; name = Author; },
|
||||
{className = EOGenericRecord; name = Book; },
|
||||
{className = EOGenericRecord; name = Customer; },
|
||||
{className = EOGenericRecord; name = Order; },
|
||||
{className = EOGenericRecord; name = OrderPos; }
|
||||
);
|
||||
internalInfo = {};
|
||||
}
|
17
Examples/WebBookStore1/DirectAction.h
Normal file
17
Examples/WebBookStore1/DirectAction.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
#ifndef INC_DirectAction_h_
|
||||
#define INC_DirectAction_h_
|
||||
|
||||
#include <GSWeb/GSWeb.h>
|
||||
|
||||
@class GSWComponent;
|
||||
|
||||
@interface DirectAction : GSWDirectAction
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
- (GSWComponent *)defaultAction;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
11
Examples/WebBookStore1/DirectAction.m
Normal file
11
Examples/WebBookStore1/DirectAction.m
Normal file
|
@ -0,0 +1,11 @@
|
|||
#include "DirectAction.h"
|
||||
#include <GSWeb/GSWeb.h>
|
||||
|
||||
@implementation DirectAction : GSWDirectAction
|
||||
|
||||
- (GSWComponent *)defaultAction
|
||||
{
|
||||
return [self pageWithName:@"Main"];
|
||||
}
|
||||
|
||||
@end
|
47
Examples/WebBookStore1/GNUmakefile
Normal file
47
Examples/WebBookStore1/GNUmakefile
Normal file
|
@ -0,0 +1,47 @@
|
|||
#
|
||||
# WebBookStore1 Example
|
||||
#
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
#
|
||||
# Written by: David Ayers <d.ayers@inode.at>
|
||||
#
|
||||
# This file is part of the GNUstepWeb Library.
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
#
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
include $(GNUSTEP_MAKEFILES)/Auxiliary/gsweb.make
|
||||
|
||||
GSWAPP_NAME=WebBookStore1
|
||||
WebBookStore1_HAS_GSWCOMPONENTS=YES
|
||||
WebBookStore1_PRINCIPAL_CLASS=WebBookStore1
|
||||
WebBookStore1_GSWAPP_INFO_PLIST=Resources/Info-WebBookStore1.plist
|
||||
|
||||
# The Objective-C source files to be compiled
|
||||
WebBookStore1_OBJC_FILES = Application.m Session.m DirectAction.m Main.m \
|
||||
WebBookStore1_main.m
|
||||
|
||||
WebBookStore1_RESOURCE_FILES = BookStore.eomodeld
|
||||
WebBookStore1_WEBSERVER_RESOURCE_FILES = Insert.png Delete.png Save.png \
|
||||
CreateTables.png DropTables.png
|
||||
|
||||
WebBookStore1_COMPONENTS = Main.gswc
|
||||
|
||||
-include Makefile.preamble
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/gswapp.make
|
||||
|
||||
-include Makefile.postamble
|
73
Examples/WebBookStore1/Main.gswc/Main.gswd
Normal file
73
Examples/WebBookStore1/Main.gswc/Main.gswd
Normal file
|
@ -0,0 +1,73 @@
|
|||
QueryForm: GSWForm {};
|
||||
|
||||
firstNameQueryField: GSWTextField
|
||||
{
|
||||
value = authorDG.queryMatch.firstName;
|
||||
};
|
||||
|
||||
lastNameQueryField: GSWTextField
|
||||
{
|
||||
value = authorDG.queryMatch.lastName;
|
||||
};
|
||||
|
||||
ExecuteQuery: GSWSubmitButton
|
||||
{
|
||||
action = authorDG.qualifyDataSource;
|
||||
value = "Search";
|
||||
};
|
||||
|
||||
SelectionList: GSWRepetition
|
||||
{
|
||||
item = author;
|
||||
list = authorDG.displayedObjects;
|
||||
};
|
||||
|
||||
SelectObjectLink: GSWHyperlink
|
||||
{
|
||||
action = selectObject;
|
||||
};
|
||||
|
||||
ObjectIdentifier: GSWString
|
||||
{
|
||||
value = author.lastName;
|
||||
};
|
||||
|
||||
ModificationForm: GSWForm {};
|
||||
|
||||
lastNameField: GSWTextField
|
||||
{
|
||||
value = authorDG.selectedObject.lastName;
|
||||
};
|
||||
|
||||
firstNameField: GSWTextField
|
||||
{
|
||||
value = authorDG.selectedObject.firstName;
|
||||
};
|
||||
|
||||
InsertButton: GSWImageButton
|
||||
{
|
||||
action = authorDG.insert;
|
||||
filename = "Insert.png";
|
||||
};
|
||||
UpdateButton: GSWImageButton
|
||||
{
|
||||
action = saveChanges;
|
||||
filename = "Save.png";
|
||||
};
|
||||
DeleteButton: GSWImageButton
|
||||
{
|
||||
action = authorDG.delete;
|
||||
filename = "Delete.png";
|
||||
};
|
||||
|
||||
CreateTablesButton: GSWImageButton
|
||||
{
|
||||
action = createTables;
|
||||
filename = "CreateTables.png";
|
||||
};
|
||||
|
||||
DropTablesButton: GSWImageButton
|
||||
{
|
||||
action = dropTables;
|
||||
filename = "DropTables.png";
|
||||
};
|
21
Examples/WebBookStore1/Main.gswc/Main.gswi
Normal file
21
Examples/WebBookStore1/Main.gswc/Main.gswi
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
variables = {
|
||||
authorDG = {
|
||||
class = GSWDisplayGroup;
|
||||
dataSource = {
|
||||
class = EODatabaseDataSource;
|
||||
editingContext = session.defaultEditingContext;
|
||||
fetchSpecification = {
|
||||
class = EOFetchSpecification;
|
||||
entityName = Author;
|
||||
fetchLimit = 0;
|
||||
isDeep = YES;
|
||||
};
|
||||
};
|
||||
formatForLikeQualifier = "%@*";
|
||||
localKeys = ();
|
||||
numberOfObjectsPerBatch = 0;
|
||||
selectsFirstObjectAfterFetch = YES;
|
||||
};
|
||||
};
|
||||
}
|
50
Examples/WebBookStore1/Main.gswc/Main.html
Normal file
50
Examples/WebBookStore1/Main.gswc/Main.html
Normal file
|
@ -0,0 +1,50 @@
|
|||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>Authors</TITLE>
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<!-- Query section -->
|
||||
<CENTER>
|
||||
<H2>Search for Authors</H2>
|
||||
<P>Specify which authors to display below:</P>
|
||||
<GSWEB name=QueryForm>
|
||||
<P>
|
||||
First Name: <GSWEB name=firstNameQueryField></GSWEB> <BR/>
|
||||
Last Name: <GSWEB name=lastNameQueryField></GSWEB> <BR/>
|
||||
</P>
|
||||
<GSWEB name=ExecuteQuery></GSWEB>
|
||||
</GSWEB >
|
||||
</CENTER>
|
||||
|
||||
<!-- Selection section -->
|
||||
<CENTER>
|
||||
<P>Click a link to select that author.</P>
|
||||
<P><GSWEB name=SelectionList>
|
||||
<GSWEB name=SelectObjectLink>
|
||||
<GSWEB name=ObjectIdentifier></GSWEB>
|
||||
</GSWEB>
|
||||
<BR>
|
||||
</GSWEB></P>
|
||||
</CENTER>
|
||||
<HR>
|
||||
|
||||
<!-- Displayed objects section -->
|
||||
<GSWEB name=ModificationForm>
|
||||
<TABLE BORDER=0>
|
||||
<TR><TD>First Name: </TD> <TD> <GSWEB name=firstNameField></GSWEB> </TD></TR>
|
||||
<TR><TD>Last Name: </TD> <TD> <GSWEB name=lastNameField></GSWEB> </TD></TR>
|
||||
</TABLE>
|
||||
<CENTER>
|
||||
<GSWEB name=InsertButton></GSWEB>
|
||||
<GSWEB name=UpdateButton></GSWEB>
|
||||
<GSWEB name=DeleteButton></GSWEB>
|
||||
</CENTER>
|
||||
<CENTER>
|
||||
<GSWEB name=CreateTablesButton></GSWEB>
|
||||
<GSWEB name=DropTablesButton></GSWEB>
|
||||
</CENTER>
|
||||
</GSWEB>
|
||||
<HR>
|
||||
|
||||
</BODY>
|
||||
</HTML>
|
20
Examples/WebBookStore1/Main.h
Normal file
20
Examples/WebBookStore1/Main.h
Normal file
|
@ -0,0 +1,20 @@
|
|||
#ifndef INC_Main_h_
|
||||
#define INC_Main_h_
|
||||
|
||||
#include <GSWeb/GSWeb.h>
|
||||
|
||||
@class GSWDisplayGroup;
|
||||
|
||||
@interface Main : GSWComponent
|
||||
{
|
||||
id author; /* Custom objects or EOGenericRecord. */
|
||||
GSWDisplayGroup *authorDG; /* Initiilaized by [GSWComponent-init]
|
||||
via the components .gswi file. */
|
||||
}
|
||||
|
||||
- (void)selectObject;
|
||||
- (void)saveChanges;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
98
Examples/WebBookStore1/Main.m
Normal file
98
Examples/WebBookStore1/Main.m
Normal file
|
@ -0,0 +1,98 @@
|
|||
#include <EOControl/EOControl.h>
|
||||
#include <EOAccess/EOAccess.h>
|
||||
|
||||
#include "Main.h"
|
||||
|
||||
@implementation Main
|
||||
|
||||
- (void)selectObject
|
||||
{
|
||||
[authorDG selectObject: author];
|
||||
}
|
||||
|
||||
- (void)saveChanges
|
||||
{
|
||||
[[[self session] defaultEditingContext] saveChanges];
|
||||
}
|
||||
|
||||
- (void)createTables
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
EODatabaseDataSource *dataSource = (id)[authorDG dataSource];
|
||||
EOEntity *entity = [dataSource entity];
|
||||
EOModel *model = [entity model];
|
||||
NSArray *entities = [model entities];
|
||||
EOAdaptor *adaptor = [EOAdaptor adaptorWithModel: model];
|
||||
Class exprClass = [adaptor expressionClass];
|
||||
NSDictionary *createOptDict
|
||||
= [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"NO", @"EODropTablesKey",
|
||||
@"NO", @"EODropPrimaryKeySupportKey", nil];
|
||||
|
||||
EOAdaptorContext *context = [adaptor createAdaptorContext];
|
||||
EOAdaptorChannel *channel = [context createAdaptorChannel];
|
||||
NSArray *exprs;
|
||||
EOSQLExpression *expr;
|
||||
unsigned i,c;
|
||||
|
||||
exprs = [exprClass schemaCreationStatementsForEntities: entities
|
||||
options: createOptDict];
|
||||
|
||||
[channel openChannel];
|
||||
for (i=0, c=[exprs count]; i<c; i++)
|
||||
{
|
||||
expr = [exprs objectAtIndex: i];
|
||||
[channel evaluateExpression: expr];
|
||||
}
|
||||
[channel closeChannel];
|
||||
|
||||
[pool release];
|
||||
}
|
||||
|
||||
- (void)dropTables
|
||||
{
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
EODatabaseDataSource *dataSource = (id)[authorDG dataSource];
|
||||
EOEntity *entity = [dataSource entity];
|
||||
EOModel *model = [entity model];
|
||||
NSArray *entities = [model entities];
|
||||
EOAdaptor *adaptor = [EOAdaptor adaptorWithModel: model];
|
||||
Class exprClass = [adaptor expressionClass];
|
||||
NSDictionary *dropOptDict
|
||||
= [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"NO", @"EOPrimaryKeyConstraintsKey",
|
||||
@"NO", @"EOCreatePrimaryKeySupportKey",
|
||||
@"NO", @"EOCreateTablesKey",
|
||||
nil];
|
||||
|
||||
EOAdaptorContext *context = [adaptor createAdaptorContext];
|
||||
EOAdaptorChannel *channel = [context createAdaptorChannel];
|
||||
NSArray *exprs;
|
||||
EOSQLExpression *expr;
|
||||
unsigned i,c;
|
||||
|
||||
exprs = [exprClass schemaCreationStatementsForEntities: entities
|
||||
options: dropOptDict];
|
||||
|
||||
[channel openChannel];
|
||||
for (i=0, c=[exprs count]; i<c; i++)
|
||||
{
|
||||
expr = [exprs objectAtIndex: i];
|
||||
[channel evaluateExpression: expr];
|
||||
}
|
||||
[channel closeChannel];
|
||||
|
||||
[pool release];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
/* These variables were set via EOKeyValueCoding (KVC) from
|
||||
the gswi initialization or */
|
||||
DESTROY(author);
|
||||
DESTROY(authorDG);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
13
Examples/WebBookStore1/Session.h
Normal file
13
Examples/WebBookStore1/Session.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
#ifndef INC_Session_h_
|
||||
#define INC_Session_h_
|
||||
|
||||
#include <GSWeb/GSWeb.h>
|
||||
|
||||
@interface Session : GSWSession
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
5
Examples/WebBookStore1/Session.m
Normal file
5
Examples/WebBookStore1/Session.m
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "Session.h"
|
||||
|
||||
@implementation Session
|
||||
|
||||
@end
|
14
Examples/WebBookStore1/WebBookStore1_main.m
Normal file
14
Examples/WebBookStore1/WebBookStore1_main.m
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include <GSWeb/GSWeb.h>
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
/* GSWApplicationMain passes the arguments to process any
|
||||
default settings and instantiates the class named as the
|
||||
first parameter to make it the application object.
|
||||
This should be the name of the principal class of the application.
|
||||
The application object should implement it initialization in its
|
||||
-init method. It will be sent -run to start the default run loop.
|
||||
The run loop will listen for requests from the current web adaptor. */
|
||||
|
||||
return GSWApplicationMain(@"Application", argc, argv);
|
||||
}
|
BIN
Examples/WebBookStore1/WebServerResources/CreateTables.png
Normal file
BIN
Examples/WebBookStore1/WebServerResources/CreateTables.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 KiB |
BIN
Examples/WebBookStore1/WebServerResources/Delete.png
Normal file
BIN
Examples/WebBookStore1/WebServerResources/Delete.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
BIN
Examples/WebBookStore1/WebServerResources/DropTables.png
Normal file
BIN
Examples/WebBookStore1/WebServerResources/DropTables.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
BIN
Examples/WebBookStore1/WebServerResources/Insert.png
Normal file
BIN
Examples/WebBookStore1/WebServerResources/Insert.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
Examples/WebBookStore1/WebServerResources/Save.png
Normal file
BIN
Examples/WebBookStore1/WebServerResources/Save.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
Loading…
Reference in a new issue